Skip to content

Commit 3cb7f41

Browse files
authored
Merge pull request #49 from rcpch/don't-correct-cdc-term
Don't-correct-cdc-term
2 parents 94fb49d + 84f06f5 commit 3cb7f41

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 4.2.6
2+
current_version = 4.2.7
33
tag = False
44
commit = True
55

rcpchgrowth/age_advice_strings.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,23 @@ def comment_prematurity_correction(
88
"""
99

1010
if chronological_decimal_age == corrected_decimal_age:
11-
# no adjustment has been made so the child was born at 40 weeks
11+
# no adjustment has been made so the child was born at 40 weeks or this child is being plotted on the CDC reference, where no adjustment is made for 37-42 weeks or beyond the age of 2 years
1212
lay_corrected_decimal_age_comment = "Your child was born on their due date."
1313
clinician_corrected_decimal_age_comment = "Born at term. No correction has been made for gestation."
1414
lay_chronological_decimal_age_comment = "Your child was born on their due date."
1515
clinician_chronological_decimal_age_comment = "Born Term. No correction has been made for gestation."
16+
# These fields should only apply to CDC reference, since UK-WHO corrects for all gestations (and therefore corrected_decimal_age will never be equal to chronological_decimal_age if gestation_weeks is not 40)
17+
if gestation_weeks < 42:
18+
if gestation_weeks < 37:
19+
lay_chronological_decimal_age_comment = f"Your child was born at {gestation_weeks}+{gestation_days} weeks gestation. No correction is made for this beyond 2 years of age."
20+
clinician_chronological_decimal_age_comment =f"Born preterm at {gestation_weeks}+{gestation_days} weeks gestation. No correction is made for this beyond 2 years of age."
21+
lay_corrected_decimal_age_comment = f"Your child was born at {gestation_weeks}+{gestation_days} weeks gestation. No correction is made for this beyond 2 years of age."
22+
clinician_corrected_decimal_age_comment = f"Born preterm at {gestation_weeks}+{gestation_days} weeks gestation. No correction is made for this beyond 2 years of age."
23+
else:
24+
lay_chronological_decimal_age_comment = f"Your child was born at {gestation_weeks}+{gestation_days} weeks gestation. This is considered term and no correction for gestation has been made."
25+
clinician_chronological_decimal_age_comment = f"Born at term at {gestation_weeks}+{gestation_days} weeks gestation. No correction for gestation has been made."
26+
lay_corrected_decimal_age_comment = f"Your child was born at {gestation_weeks}+{gestation_days} weeks gestation. This is considered term and no correction for gestation has been made."
27+
clinician_corrected_decimal_age_comment = f"Born at term at {gestation_weeks}+{gestation_days} weeks gestation. No correction for gestation has been made."
1628
elif chronological_decimal_age > corrected_decimal_age or chronological_decimal_age < corrected_decimal_age:
1729
## adjustment for gestational age has been made - even if >=37 weeks
1830
lay_corrected_decimal_age_comment = f"Because your child was born at {gestation_weeks}+{gestation_days} weeks gestation an adjustment has been made to take this into account."

rcpchgrowth/measurement.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,11 @@ def __calculate_ages(
395395
gestation_weeks = 40
396396
# calculate ages from dates and gestational ages at birth
397397

398+
# if reference is CDC, we must treat >37 week infants as term.
399+
if self.reference == CDC and gestation_weeks >= 37:
400+
gestation_weeks = 40
401+
gestation_days = 0
402+
398403
try:
399404
self.corrected_decimal_age = corrected_decimal_age(
400405
birth_date=birth_date,
@@ -412,6 +417,10 @@ def __calculate_ages(
412417
except Exception as err:
413418
self.chronological_decimal_age = None
414419
chronological_decimal_age_error = f"{err}"
420+
421+
# if the reference is CDC, we also stop correcting for prematurity at 2 years of age
422+
if self.reference == CDC and self.corrected_decimal_age >= 2:
423+
self.corrected_decimal_age = self.chronological_decimal_age
415424

416425
if self.corrected_decimal_age is None:
417426
self._age_comments = None

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="rcpchgrowth",
11-
version="4.2.6",
11+
version="4.2.7",
1212
description="SDS and Centile calculations for UK Growth Data",
1313
long_description=long_description,
1414
url="https://github.com/rcpch/digital-growth-charts/blob/master/README.md",

0 commit comments

Comments
 (0)