Skip to content

Commit

Permalink
Merge pull request #386 from micronutrientsupport/andan-intervention-…
Browse files Browse the repository at this point in the history
…user-costs

fix: minor tweaks
  • Loading branch information
bgsandan authored Nov 29, 2024
2 parents a069aa6 + 200df5e commit a539dd1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/controllers/intervention.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ export class InterventionController {
const fortifiableFoodItems = await this.fortifiableFoodItemsRepository.find(
{
where: {
lsff: true,
LSFF: true,
},
},
);
Expand All @@ -1095,20 +1095,21 @@ 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,
fortificationLevelSummary,
aggregationFields,
)
: await this.opencpuService.calculatePreAndPostLSFFSummariesCnd(
1,
surveyId,
[focusMicronutrient],
intakeThresholds,
fortifiableFoodItems,
Expand Down
6 changes: 3 additions & 3 deletions src/models/fortifiable-food-items.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class FortifiableFoodItems extends Entity {
nullable: 'YES',
},
})
lsff?: boolean;
LSFF?: boolean;

@property({
type: 'boolean',
Expand All @@ -134,7 +134,7 @@ export class FortifiableFoodItems extends Entity {
nullable: 'YES',
},
})
bio?: boolean;
Bio?: boolean;

@property({
type: 'boolean',
Expand All @@ -147,7 +147,7 @@ export class FortifiableFoodItems extends Entity {
nullable: 'YES',
},
})
fert?: boolean;
Fert?: boolean;

// Define well-known properties here

Expand Down
64 changes: 62 additions & 2 deletions src/models/intervention-fortification-level-summary.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand Down
15 changes: 15 additions & 0 deletions src/models/intervention-list.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a539dd1

Please sign in to comment.