Skip to content

fix: Fix discrepancies in WFH score [DHIS2-22201] - #102

Open
enricocolasante wants to merge 1 commit into
mainfrom
DHIS2-22201
Open

enricocolasante wants to merge 1 commit into
mainfrom
DHIS2-22201

Conversation

@enricocolasante

@enricocolasante enricocolasante commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fix discrepancies in d2:zScoreWFH DHIS2-22201

Problem

  • Wrong reference table between 87 and 110 cm. The weight-for-height tables used WHO weight-for-length values (meant for children measured lying down) all the way up to 110 cm, and only switched to weight-for-height above 110 cm. When age is unknown, the usual convention is to switch at 87 cm, so children 87–110 cm tall were compared against a reference 0.1–0.4 kg too light. Their z-scores came out too high, so a malnourished child could score above a cut-off like −2 SD.
  • Corrupted row. The female row at 112 cm had an LMS parameter (0.09507) as its −3 SD value, with every other column shifted by one.
  • Truncated results. Interpolated z-scores were cut off after 2 decimals instead of rounded, so float noise turned e.g. −0.2 into −0.19.

Changes

  • Regenerated both WFH tables from the WHO reference data (LMS parameters), rounded to 1 decimal like WHO's published tables:
    • weight-for-length below 87 cm, weight-for-height from 87 cm
    • 0.1 cm steps from 45.0 to 120.0 cm (751 rows per sex, up from 151)
    • every existing row is unchanged except 87–110 cm and the female 112 cm row
  • Fixed the female 112 cm row.
  • ZScore: round interpolated z-scores to 2 decimals instead of truncating them, and remove the string-based formatting helpers.

This also affects d2:zScoreWFA and d2:zScoreHFA, which share the rounding code: their results between two SD values can change by up to 0.01.

Known limitations

  • Z-scores are interpolated linearly between SD weights rounded to 0.1 kg, so results can differ from WHO Anthro by up to ~0.1.
  • Values beyond ±3 SD are still reported as ±3.5; Anthro keeps counting past ±3.
  • Heights must match a 0.1 cm row exactly.

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant