Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdc #36

Merged
merged 27 commits into from
Oct 19, 2024
Merged

cdc #36

merged 27 commits into from
Oct 19, 2024

Conversation

eatyourpeas
Copy link
Member

Overview

This PR includes the CDC reference data and integrates the calculations into the code base. It will be a minor version change.

A few things about this:
CDC is made up of WHO (0-2) and CDC (2+). The WHO version used by CDC though has been tweaked, presumably to make the disjunction between the references less marked. The effect is that the code base now has 2 versions of WHO - the WHO one and the US interpretation.

CDC BMI is included and for BMI measurements > 95th centile some clever maths is introduced to prevent some of the issues that have been detailed in conversations about the accuracy of z scores.

Note that there is no preterm data for the moment. The Canadian Fenton data is what is typically used, but this is licensed and conversations about the legals are ongoing. This means that for all corrected ages < 0 no values are returned, but a meaningful error is included.

There is also a fix to the confusing error raised when EDD has not yet been reached in a preterm baby.

There are also tests for the same test subjects used in UK-WHO, but recalculated for CDC using the excellent R package [cdcanthro] (https://github.com/CDC-DNPAO/CDCAnthro) by David Freedman, author of the CDC BMI reference.

Code changes

  • cdc.py: selects the correct array for LMS values to pass to functions. Excludes Fenton for the time being and returns an empty string.
  • chart_functions.py: updates create_chart to accept cdc and creates a new functions to generate the correct json object. Keys are 'cdc_infant' and 'cdc_child'
  • age_constants.py and reference_constants: includes some new constants relevant to CDC cutoffs. Also includes values important for Fenton although not implemented yet
  • data_tables/: the data files
  • global_functions: measurement_from_sds has extra code that inspects the array for the sigma key that is found only in CDC BMI reference. This is used to calculate the correct SDS and centiles for BMI values > 95%
  • measurement.py: adds a conditional to not return any data in preterm babies and a suitable error message
  • tests/cdc/...: test files and gold standards

Documentation changes (done or required as a result of this PR)

Documentation will be added separately to the documentation repo

Please describe any changes to documentation here.

Related Issues

Closes #35

…ve the data

fix three percent centiles to remove 5% and create five percent centiles
…dc is linearly interpolated so this added to global_functions. Single fail for CDC height in a 2.5y girl: assert 1.3882029662677624 == 1.3893 ± 1.0e-03
…D. This test therefore is amended erroneously to pass:

{
      "birth_date": "2015-04-01",
      "observation_date": "2017-10-04",
      "gestation_weeks": 30,
      "gestation_days": 2,
      "sex": "female",
      "measurement_method": "height",
      "chronological_age": 2.5106,
      "corrected_age": 2.3244,
      "observation_value": 95.3,
      "corrected_sds": 1.8348,
      "chronological_sds": 1.2788,
      "age": 30.1273,
      "height": 95.3,
      "haz": 1.3893,
      "hap": 91.7623,
      "p50": 16.0277,
      "p95": 18.6016,
      "mod_haz": 1.3864,
      "z_score": 1.3893
    },
…r, do not calculate CDC results for preterm babies and signpost to user
@eatyourpeas eatyourpeas added the enhancement New feature or request label Oct 19, 2024
@eatyourpeas eatyourpeas merged commit 7246f09 into live Oct 19, 2024
4 checks passed
@eatyourpeas eatyourpeas deleted the eatyourpeas/issue35 branch October 19, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CDC data
1 participant