rcpch / digital-growth-charts-server

RCPCH's open source Digital Growth Chart API
https://growth.rcpch.ac.uk/
GNU Affero General Public License v3.0
16 stars 11 forks source link

Eatyourpeas/issue200 #201

Closed eatyourpeas closed 7 months ago

eatyourpeas commented 10 months ago

What is this PR for?

Raised in response to error identified by colleagues implementing in Wales who noted a 500 error if heights > 250 cm for maternal height were entered in the midparental height endpoint

A secondary issue is that this endpoint has no tests

What has been fixed?

The upper limit for height in men and women in the midparental height endpoint has been set at 245 cm. The reasoning behind this maximum is documented in the code, but is a pragmatic threshold and well outside the expected height range of adults.

What code has been changed?

utilities.py / mid_parental_height_endpoint now returns empty arrays if parental heights above the documented thresholds are passed in. This will prevent an error being raised (the original cause of the 500 error) though this will likely break the charting component if so - I have not tested this. This should be academic, since the validations should prevent parental heights over 245 cm being passed in

request_validation_classes.py: this sets the validation for the upper limits of the parental heights to 245 cm

test_midparental_height_valid.json: a new test file. the tests are in test_utilities.py

open_api.json and main.py: version bumped

Documentation

I will update this separately

Issues addressed

This closes #200

Reviewers

@pacharanero