Commit 6b24e0c7 authored by Agustin's avatar Agustin
Browse files

Merge branch 'feature/Calculos' into develop

parents 7f48695f 69fb8d75
Pipeline #15864 passed with stage
in 1 minute and 30 seconds
type PopulationMaternity = {
countryBirthRate: number;
countryWomenInAgeGroup: number;
countryPopulation: number;
};
......
......@@ -11,7 +11,7 @@ enum AgeBracket {
m9 = '9 meses',
m10 = '10 meses',
m11 = '11 meses',
a1 = '1 año',
a1 = '1 años',
a2 = '2 años',
a3 = '3 años',
a4 = '4 años',
......
......@@ -13,7 +13,7 @@ import ParserService from './ParserService';
// eslint-disable-next-line max-len
const isIndividualMaternity = (obj: IndividualMaternity | PopulationMaternity): obj is IndividualMaternity => {
if ((obj as IndividualMaternity).pregnantWomen) {
if ((obj as IndividualMaternity).pregnantWomen !== undefined) {
return true;
}
return false;
......@@ -23,9 +23,9 @@ const isIndividualMaternity = (obj: IndividualMaternity | PopulationMaternity):
const calculateTEE = (group: AgeGroup, params: number[], preval: MinorPAL): number => {
const teeModerate: number = params[0]
+ (params[1] * group.medianWeight)
- params[2] * (group.medianWeight * group.medianWeight);
+ params[2] * (group.medianWeight * group.medianWeight);
const teeLow: number = teeModerate - (teeModerate * params[4]) / 100;
const teeLow: number = teeModerate + (teeModerate * params[4]) / 100;
const teeIntense: number = teeModerate + (teeModerate * params[5]) / 100;
const ret: number = (teeLow * preval.lowPALPrevalence) / 100
......@@ -66,11 +66,11 @@ const calculateERWomenIndividual = (group: AgeGroup, params: number[], popData:
};
// eslint-disable-next-line max-len
const calculateERWomenPopulation = (group: AgeGroup, params: number[], popData: PopulationMaternity, req: number): number => {
const annualBirths = popData.countryBirthRate * popData.countryPopulation;
const calculateERWomenPopulation = (params: number[], popData: PopulationMaternity, req: number): number => {
const annualBirths = (popData.countryBirthRate * popData.countryPopulation) / 1000;
const percentPregnantWomen = (annualBirths * 75) / group.population;
const percentLactatingWomen = (annualBirths * 50) / group.population;
const percentPregnantWomen = (annualBirths * 75) / popData.countryWomenInAgeGroup;
const percentLactatingWomen = (annualBirths * 50) / popData.countryWomenInAgeGroup;
const reqPregnantWomen = (percentPregnantWomen * (req + params[6])) / 100;
const reqLactatingWomen = (percentLactatingWomen * (req + params[7])) / 100;
......@@ -147,7 +147,7 @@ const calculate18To29Years = (group: AgeGroup, params: number[], data: ExtraData
} else if (isIndividualMaternity(data.maternity18To29)) {
requirement = calculateERWomenIndividual(group, params, data.maternity18To29, requirement);
} else {
requirement = calculateERWomenPopulation(group, params, data.maternity18To29, requirement);
requirement = calculateERWomenPopulation(params, data.maternity18To29, requirement);
}
}
......@@ -181,7 +181,7 @@ const calculate30To59Years = (group: AgeGroup, params: number[], data: ExtraData
} else if (isIndividualMaternity(data.maternity30To59)) {
requirement = calculateERWomenIndividual(group, params, data.maternity30To59, requirement);
} else {
requirement = calculateERWomenPopulation(group, params, data.maternity30To59, requirement);
requirement = calculateERWomenPopulation(params, data.maternity30To59, requirement);
}
}
......
......@@ -179,120 +179,120 @@ const getEquationValues = (ageBracket: AgeBracket, sex: Sex): number[] => {
case (AgeBracket.a6): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 11, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 12, 15, 15];
res = [310.2, 63.3, -0.263, 12, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 10, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 13, 15, 15];
res = [263.4, 65.3, -0.454, 13, -15, 15];
}
break;
}
case (AgeBracket.a7): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 14, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 14, 15, 15];
res = [310.2, 63.3, -0.263, 14, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 17, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 17, 15, 15];
res = [263.4, 65.3, -0.454, 17, -15, 15];
}
break;
}
case (AgeBracket.a8): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 16, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 16, 15, 15];
res = [310.2, 63.3, -0.263, 16, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 20, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 20, 15, 15];
res = [263.4, 65.3, -0.454, 20, -15, 15];
}
break;
}
case (AgeBracket.a9): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 19, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 19, 15, 15];
res = [310.2, 63.3, -0.263, 19, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 23, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 23, 15, 15];
res = [263.4, 65.3, -0.454, 23, -15, 15];
}
break;
}
case (AgeBracket.a10): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 22, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 22, 15, 15];
res = [310.2, 63.3, -0.263, 22, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 25, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 25, 15, 15];
res = [263.4, 65.3, -0.454, 25, -15, 15];
}
break;
}
case (AgeBracket.a11): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 25, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 25, 15, 15];
res = [310.2, 63.3, -0.263, 25, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 25, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 25, 15, 15];
res = [263.4, 65.3, -0.454, 25, -15, 15];
}
break;
}
case (AgeBracket.a12): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 29, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 29, 15, 15];
res = [310.2, 63.3, -0.263, 29, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 26, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 26, 15, 15];
res = [263.4, 65.3, -0.454, 26, -15, 15];
}
break;
}
case (AgeBracket.a13): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 33, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 33, 15, 15];
res = [310.2, 63.3, -0.263, 33, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 24, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 24, 15, 15];
res = [263.4, 65.3, -0.454, 24, -15, 15];
}
break;
}
case (AgeBracket.a14): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 33, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 33, 15, 15];
res = [310.2, 63.3, -0.263, 33, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 19, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 19, 15, 15];
res = [263.4, 65.3, -0.454, 19, -15, 15];
}
break;
}
case (AgeBracket.a15): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 31, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 31, 15, 15];
res = [310.2, 63.3, -0.263, 31, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 13, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 13, 15, 15];
res = [263.4, 65.3, -0.454, 13, -15, 15];
}
break;
}
case (AgeBracket.a16): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 24, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 24, 15, 15];
res = [310.2, 63.3, -0.263, 24, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 5, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 5, 15, 15];
res = [263.4, 65.3, -0.454, 5, -15, 15];
}
break;
}
case (AgeBracket.a17): {
if (sex === Sex.Male) {
// 310.2 + (63.3*MP) - 0.263*MP^2 + 14, -15%/+15% for light/intense TEE
res = [310.2, 63.3, -0.263, 14, 15, 15];
res = [310.2, 63.3, -0.263, 14, -15, 15];
} else if (sex === Sex.Female) {
// 263.4 + (65.3*MP) - 0.454*MP^2 + 0, -15%/+15% for light/intense TEE
res = [263.4, 65.3, -0.454, 0, 15, 15];
res = [263.4, 65.3, -0.454, 0, -15, 15];
}
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment