Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bucket/delta.ts3
-rw-r--r--src/document/Document.ts3
-rw-r--r--src/system/DeltaProcessor.ts1
-rw-r--r--src/system/avro/V1MessageWriter.ts2
-rw-r--r--src/system/db/MongoDeltaDao.ts1
-rw-r--r--test/system/DeltaProcessorTest.ts7
-rw-r--r--test/system/V1MessageWriterTest.ts5
7 files changed, 20 insertions, 2 deletions
diff --git a/src/bucket/delta.ts b/src/bucket/delta.ts
index 7c5dd6a..bc48dd1 100644
--- a/src/bucket/delta.ts
+++ b/src/bucket/delta.ts
@@ -81,6 +81,9 @@ export interface DeltaDocument
/** The document id */
id: DocumentId,
+ /** The source program */
+ programId: string,
+
/** The entity name */
agentName: string,
diff --git a/src/document/Document.ts b/src/document/Document.ts
index 8f05bac..5dd3aef 100644
--- a/src/document/Document.ts
+++ b/src/document/Document.ts
@@ -45,6 +45,9 @@ export type DocumentMeta =
/** The document id */
id: DocumentId,
+ /** The source program */
+ program: string,
+
/** The entity name */
entity_name: string,
diff --git a/src/system/DeltaProcessor.ts b/src/system/DeltaProcessor.ts
index f6fc46d..b9d792f 100644
--- a/src/system/DeltaProcessor.ts
+++ b/src/system/DeltaProcessor.ts
@@ -109,6 +109,7 @@ export class DeltaProcessor
const ratedata = doc.ratedata || {};
const meta = {
id: doc.id,
+ program: doc.programId,
entity_name: doc.agentName,
entity_id: +doc.agentEntityId,
startDate: doc.startDate,
diff --git a/src/system/avro/V1MessageWriter.ts b/src/system/avro/V1MessageWriter.ts
index 5a30cd4..c6f491e 100644
--- a/src/system/avro/V1MessageWriter.ts
+++ b/src/system/avro/V1MessageWriter.ts
@@ -139,7 +139,7 @@ export class V1MessageWriter implements MessageWriter
},
program: {
Program: {
- id: 'quote_server',
+ id: meta.program,
version: '',
},
},
diff --git a/src/system/db/MongoDeltaDao.ts b/src/system/db/MongoDeltaDao.ts
index f3507d8..b01ddc7 100644
--- a/src/system/db/MongoDeltaDao.ts
+++ b/src/system/db/MongoDeltaDao.ts
@@ -40,6 +40,7 @@ export class MongoDeltaDao implements DeltaDao
/** The document fields to read */
readonly RESULT_FIELDS: Record<string, number> = {
id: 1,
+ programId: 1,
agentName: 1,
agentEntityId: 1,
startDate: 1,
diff --git a/test/system/DeltaProcessorTest.ts b/test/system/DeltaProcessorTest.ts
index 1587bb2..84f955a 100644
--- a/test/system/DeltaProcessorTest.ts
+++ b/test/system/DeltaProcessorTest.ts
@@ -428,6 +428,7 @@ describe( 'system.DeltaProcessor', () =>
const createdData = <UnixTimestamp>234234234;
const doc = <DeltaDocument[]>[ {
id: <DocumentId>123,
+ programId: 'mega',
agentName: entity_num,
agentEntityId: entity_id,
startDate: createdData,
@@ -447,6 +448,7 @@ describe( 'system.DeltaProcessor', () =>
},
{
id: <DocumentId>234,
+ programId: 'mega',
agentName: entity_num,
agentEntityId: entity_id,
startDate: createdData,
@@ -471,6 +473,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 123,
+ program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},
@@ -483,6 +486,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 234,
+ program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},
@@ -548,6 +552,7 @@ describe( 'system.DeltaProcessor', () =>
const emitter = new EventEmitter();
const doc = <DeltaDocument[]>[ {
id: <DocumentId>123,
+ programId: 'mega',
agentName: 'Some Agency',
agentEntityId: 4321,
startDate: <UnixTimestamp>234234234,
@@ -567,6 +572,7 @@ describe( 'system.DeltaProcessor', () =>
},
{
id: <DocumentId>234,
+ programId: 'mega',
agentName: 'Some Agency',
agentEntityId: 4321,
startDate: <UnixTimestamp>234234234,
@@ -591,6 +597,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 123,
+ program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},
diff --git a/test/system/V1MessageWriterTest.ts b/test/system/V1MessageWriterTest.ts
index 42bd302..a0931c0 100644
--- a/test/system/V1MessageWriterTest.ts
+++ b/test/system/V1MessageWriterTest.ts
@@ -372,11 +372,13 @@ describe( 'system.V1MessageWriter', () =>
} );
+
it( 'Message is formatted correctly', () =>
{
const bucket = { foo: [ 'bar', 'baz' ] };
const ratedata = {};
const doc_id = <DocumentId>123;
+ const program = 'mega';
const entity_name = 'Some Agency';
const entity_id = 123;
const startDate = <UnixTimestamp>345;
@@ -386,6 +388,7 @@ describe( 'system.V1MessageWriter', () =>
const encoder = createMockEncoderCtor( schema );
const meta = <DocumentMeta>{
id: doc_id,
+ program: program,
entity_name: entity_name,
entity_id: entity_id,
startDate: startDate,
@@ -442,7 +445,7 @@ describe( 'system.V1MessageWriter', () =>
},
program: {
Program: {
- id: 'quote_server',
+ id: program,
version: '',
},
},