@openmrs/esm-form-engine-lib 4.2.2-pre.2673 → 4.2.2-pre.2680
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -210,11 +210,11 @@ export declare class CommonExpressionHelpers {
|
|
|
210
210
|
/**
|
|
211
211
|
* Calculates the Weight-for-Height Z-score for pediatric patients using WHO growth standards.
|
|
212
212
|
* Used to assess acute malnutrition (wasting).
|
|
213
|
-
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm)
|
|
213
|
+
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm). Numeric strings are accepted.
|
|
214
214
|
* @param weight - Patient's weight in kilograms
|
|
215
215
|
* @returns Z-score as a string (e.g., '-2', '0', '1'), or null if out of range, reference missing, or inputs missing
|
|
216
216
|
*/
|
|
217
|
-
calcWeightForHeightZscore: (height: number, weight: number) => string | null;
|
|
217
|
+
calcWeightForHeightZscore: (height: number | string, weight: number) => string | null;
|
|
218
218
|
/**
|
|
219
219
|
* Calculates the BMI-for-Age Z-score for pediatric patients using WHO growth standards.
|
|
220
220
|
* Used to assess both undernutrition and overweight/obesity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-expression-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/common-expression-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAIvC,qBAAa,uBAAuB;IAClC,IAAI,EAAE,QAAQ,CAAQ;IACtB,OAAO,EAAE,GAAG,CAAQ;IACpB,SAAS,EAAE,SAAS,EAAE,CAAM;IAC5B,cAAc,EAAE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OAAO,CAAC,OAAO,CAAC,sBAE/B;CACH;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,UAQrC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,QAuBxE"}
|
|
@@ -407,11 +407,12 @@ export class CommonExpressionHelpers {
|
|
|
407
407
|
/**
|
|
408
408
|
* Calculates the Weight-for-Height Z-score for pediatric patients using WHO growth standards.
|
|
409
409
|
* Used to assess acute malnutrition (wasting).
|
|
410
|
-
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm)
|
|
410
|
+
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm). Numeric strings are accepted.
|
|
411
411
|
* @param weight - Patient's weight in kilograms
|
|
412
412
|
* @returns Z-score as a string (e.g., '-2', '0', '1'), or null if out of range, reference missing, or inputs missing
|
|
413
413
|
*/ _define_property(this, "calcWeightForHeightZscore", (height, weight)=>{
|
|
414
|
-
|
|
414
|
+
const numericHeight = Number(height);
|
|
415
|
+
if (!numericHeight || !weight) {
|
|
415
416
|
return null;
|
|
416
417
|
}
|
|
417
418
|
const birthDate = new Date(this.patient.birthDate);
|
|
@@ -421,10 +422,10 @@ export class CommonExpressionHelpers {
|
|
|
421
422
|
}
|
|
422
423
|
const standardHeightMin = 45;
|
|
423
424
|
const standardMaxHeight = 110;
|
|
424
|
-
if (
|
|
425
|
+
if (numericHeight < standardHeightMin || numericHeight > standardMaxHeight) {
|
|
425
426
|
return null;
|
|
426
427
|
}
|
|
427
|
-
const formattedHeight =
|
|
428
|
+
const formattedHeight = numericHeight.toFixed(1);
|
|
428
429
|
const refSection = filter(weightForHeightRef, (refObject)=>{
|
|
429
430
|
return parseFloat(refObject['Length']).toFixed(1) === formattedHeight;
|
|
430
431
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-form-engine-lib",
|
|
3
|
-
"version": "4.2.2-pre.
|
|
3
|
+
"version": "4.2.2-pre.2680",
|
|
4
4
|
"description": "React Form Engine for O3",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@carbon/react": "1.x",
|
|
53
|
-
"@openmrs/esm-framework": "
|
|
53
|
+
"@openmrs/esm-framework": "11.x",
|
|
54
54
|
"dayjs": "1.x",
|
|
55
55
|
"i18next": "25.x",
|
|
56
56
|
"react": "18.x",
|
|
@@ -486,12 +486,13 @@ export class CommonExpressionHelpers {
|
|
|
486
486
|
/**
|
|
487
487
|
* Calculates the Weight-for-Height Z-score for pediatric patients using WHO growth standards.
|
|
488
488
|
* Used to assess acute malnutrition (wasting).
|
|
489
|
-
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm)
|
|
489
|
+
* @param height - Patient's height/length in centimeters (valid range: 45-110 cm). Numeric strings are accepted.
|
|
490
490
|
* @param weight - Patient's weight in kilograms
|
|
491
491
|
* @returns Z-score as a string (e.g., '-2', '0', '1'), or null if out of range, reference missing, or inputs missing
|
|
492
492
|
*/
|
|
493
|
-
calcWeightForHeightZscore = (height: number, weight: number): string | null => {
|
|
494
|
-
|
|
493
|
+
calcWeightForHeightZscore = (height: number | string, weight: number): string | null => {
|
|
494
|
+
const numericHeight = Number(height);
|
|
495
|
+
if (!numericHeight || !weight) {
|
|
495
496
|
return null;
|
|
496
497
|
}
|
|
497
498
|
|
|
@@ -505,11 +506,11 @@ export class CommonExpressionHelpers {
|
|
|
505
506
|
const standardHeightMin = 45;
|
|
506
507
|
const standardMaxHeight = 110;
|
|
507
508
|
|
|
508
|
-
if (
|
|
509
|
+
if (numericHeight < standardHeightMin || numericHeight > standardMaxHeight) {
|
|
509
510
|
return null;
|
|
510
511
|
}
|
|
511
512
|
|
|
512
|
-
const formattedHeight =
|
|
513
|
+
const formattedHeight = numericHeight.toFixed(1);
|
|
513
514
|
|
|
514
515
|
const refSection = filter(weightForHeightRef, (refObject) => {
|
|
515
516
|
return parseFloat(refObject['Length']).toFixed(1) === formattedHeight;
|