Skip to content

Commit

Permalink
Merge pull request #48 from rcpch/no-cdc-preterm-data
Browse files Browse the repository at this point in the history
No-cdc-preterm-data
  • Loading branch information
eatyourpeas authored Nov 14, 2024
2 parents 0d94718 + 57a90d5 commit 94fb49d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 4.2.5
current_version = 4.2.6
tag = False
commit = True

Expand Down
15 changes: 8 additions & 7 deletions rcpchgrowth/cdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def reference_data_absent(age: float, measurement_method: str, sex: str):
- CDC data is used from 2-20 years
"""

# if age < 0:
# return True, "CDC data does not exist below 40 weeks."
if age < 0:
return True, "CDC data does not exist below 40 weeks."
if age > TWENTY_YEARS: # upper threshold of UK90 data
return True, "CDC data does not exist above 20 years."
if measurement_method == HEAD_CIRCUMFERENCE and age > THREE_YEARS:
Expand Down Expand Up @@ -109,18 +109,19 @@ def cdc_lms_array_for_measurement_and_sex(

# selects the correct lms data array from the patchwork of references that make up UK-WHO

# Check that the measurement requested has reference data at that age

invalid_data, data_error = reference_data_absent(

age=age, measurement_method=measurement_method, sex=sex
)
try:
selected_reference = cdc_reference(
age=age, measurement_method=measurement_method, default_youngest_reference=default_youngest_reference
)
except: #  there is no reference for the age supplied
return LookupError("There is no CDC reference for the age supplied.")

# Check that the measurement requested has reference data at that age

invalid_data, data_error = reference_data_absent(
age=age, measurement_method=measurement_method, sex=sex
)

if invalid_data:
raise LookupError(data_error)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="rcpchgrowth",
version="4.2.5",
version="4.2.6",
description="SDS and Centile calculations for UK Growth Data",
long_description=long_description,
url="https://github.com/rcpch/digital-growth-charts/blob/master/README.md",
Expand Down

0 comments on commit 94fb49d

Please sign in to comment.