diff --git a/src/controllers/intervention.controller.ts b/src/controllers/intervention.controller.ts index ba79cb1..f2146c8 100644 --- a/src/controllers/intervention.controller.ts +++ b/src/controllers/intervention.controller.ts @@ -1083,7 +1083,7 @@ export class InterventionController { const fortifiableFoodItems = await this.fortifiableFoodItemsRepository.find( { where: { - lsff: true, + LSFF: true, }, }, ); @@ -1095,12 +1095,13 @@ export class InterventionController { }); const focusMicronutrient = interventionDetails[0].focusMicronutrient; + const surveyId = interventionDetails[0].hcesSurveyId; // console.log(fortificationLevelSummary); const foo = metricField === 'afe' ? await this.opencpuService.calculatePreAndPostLSFFSummariesAfe( - 1, + surveyId, [focusMicronutrient], intakeThresholds, fortifiableFoodItems, @@ -1108,7 +1109,7 @@ export class InterventionController { aggregationFields, ) : await this.opencpuService.calculatePreAndPostLSFFSummariesCnd( - 1, + surveyId, [focusMicronutrient], intakeThresholds, fortifiableFoodItems, diff --git a/src/models/fortifiable-food-items.model.ts b/src/models/fortifiable-food-items.model.ts index 6d73aa3..924a668 100644 --- a/src/models/fortifiable-food-items.model.ts +++ b/src/models/fortifiable-food-items.model.ts @@ -121,7 +121,7 @@ export class FortifiableFoodItems extends Entity { nullable: 'YES', }, }) - lsff?: boolean; + LSFF?: boolean; @property({ type: 'boolean', @@ -134,7 +134,7 @@ export class FortifiableFoodItems extends Entity { nullable: 'YES', }, }) - bio?: boolean; + Bio?: boolean; @property({ type: 'boolean', @@ -147,7 +147,7 @@ export class FortifiableFoodItems extends Entity { nullable: 'YES', }, }) - fert?: boolean; + Fert?: boolean; // Define well-known properties here diff --git a/src/models/intervention-fortification-level-summary.model.ts b/src/models/intervention-fortification-level-summary.model.ts index 84bb5a2..7f7b3b7 100644 --- a/src/models/intervention-fortification-level-summary.model.ts +++ b/src/models/intervention-fortification-level-summary.model.ts @@ -119,6 +119,51 @@ export class InterventionFortificationLevelSummary extends Entity { }) perc_average_fortification_level?: number; + @property({ + type: 'number', + jsonSchema: {nullable: true}, + postgresql: { + columnName: 'Ca', + dataType: 'numeric', + dataLength: null, + dataPrecision: null, + dataScale: null, + nullable: 'YES', + generated: undefined, + }, + }) + Ca?: number; + + @property({ + type: 'number', + jsonSchema: {nullable: true}, + postgresql: { + columnName: 'I', + dataType: 'numeric', + dataLength: null, + dataPrecision: null, + dataScale: null, + nullable: 'YES', + generated: undefined, + }, + }) + I?: number; + + @property({ + type: 'number', + jsonSchema: {nullable: true}, + postgresql: { + columnName: 'Fe', + dataType: 'numeric', + dataLength: null, + dataPrecision: null, + dataScale: null, + nullable: 'YES', + generated: undefined, + }, + }) + Fe?: number; + @property({ type: 'number', jsonSchema: {nullable: true}, @@ -198,7 +243,7 @@ export class InterventionFortificationLevelSummary extends Entity { type: 'number', jsonSchema: {nullable: true}, postgresql: { - columnName: 'Fe', + columnName: 'D', dataType: 'numeric', dataLength: null, dataPrecision: null, @@ -207,7 +252,22 @@ export class InterventionFortificationLevelSummary extends Entity { generated: undefined, }, }) - Fe?: number; + D?: number; + + @property({ + type: 'number', + jsonSchema: {nullable: true}, + postgresql: { + columnName: 'E', + dataType: 'numeric', + dataLength: null, + dataPrecision: null, + dataScale: null, + nullable: 'YES', + generated: undefined, + }, + }) + E?: number; @property({ type: 'number', diff --git a/src/models/intervention-list.model.ts b/src/models/intervention-list.model.ts index 2ec04a5..4fb014a 100644 --- a/src/models/intervention-list.model.ts +++ b/src/models/intervention-list.model.ts @@ -240,6 +240,21 @@ export class InterventionList extends Entity { }) parentIntervention?: number; + @property({ + type: 'number', + scale: 0, + id: true, + postgresql: { + columnName: 'hces_survey_id', + dataType: 'integer', + dataLength: null, + dataPrecision: null, + dataScale: 0, + nullable: 'YES', + }, + }) + hcesSurveyId: number; + // Define well-known properties here // Indexer property to allow additional data