Skip to content

Commit

Permalink
reduce mph values to 3 dp for centiles or 2dp for calculated measurem…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
eatyourpeas committed Oct 20, 2024
1 parent bbc62a7 commit 3d0f104
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions routers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def mid_parental_height_endpoint(mid_parental_height_request: MidParentalHeightR
print("It was not possible to calculate midparental SDS.")

try:
mph_centile = centile(mph_sds)
mph_centile = round(centile(mph_sds),3)
except:
print("It was not possible to calculate a centile from midparental height.")

Expand All @@ -89,7 +89,7 @@ def mid_parental_height_endpoint(mid_parental_height_request: MidParentalHeightR
mph_centile_data = []

try:
lower_centile = centile(mph_sds - 2)
lower_centile = round(centile(mph_sds - 2),3)
mph_lower_centile_data = create_chart(
reference=reference,
centile_format=[lower_centile],
Expand All @@ -102,7 +102,7 @@ def mid_parental_height_endpoint(mid_parental_height_request: MidParentalHeightR
mph_lower_centile_data = []

try:
upper_centile = centile(mph_sds + 2)
upper_centile = round(centile(mph_sds + 2),3)

mph_upper_centile_data = create_chart(
reference=reference,
Expand Down Expand Up @@ -140,6 +140,6 @@ def mid_parental_height_endpoint(mid_parental_height_request: MidParentalHeightR
"mid_parental_height_centile_data": mph_centile_data,
"mid_parental_height_lower_centile_data": mph_lower_centile_data,
"mid_parental_height_upper_centile_data": mph_upper_centile_data,
"mid_parental_height_lower_value": lower_height,
"mid_parental_height_upper_value": upper_height,
"mid_parental_height_lower_value": round(lower_height, 2),
"mid_parental_height_upper_value": round(upper_height, 2),
}
2 changes: 1 addition & 1 deletion tests/test_data/test_midparental_height_cdc_valid.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/test_data/test_midparental_height_ukwho_valid.json

Large diffs are not rendered by default.

0 comments on commit 3d0f104

Please sign in to comment.