API Error: "No reference data exists below 40 weeks gestation"

Hi,
Performing a calculation API call with a measurement on the birth date for a baby with a shorter than full term gestation period seems to return a “No reference data exists below 40 weeks gestation”:

https://api.rcpch.ac.uk/growth/v1/trisomy-21/calculation
{
“birth_date”:“2023-01-14”,
“observation_date”:“2023-01-14”,
“observation_value”:45.0,
“measurement_method”:“height”,
“sex”:“male”,
“gestation_weeks”:32,
“gestation_days”:0
}
Returns the following response:
{
“detail”:
[
{
“loc”:
[
“body”
],
“msg”:“No reference data exists below 40 weeks gestation”,
“type”:“value_error”,
“input”:“observation_value”
}
]
}

Another calculation for the same patient for an observation recorded at a later age returns a successful reposnse:
https://api.rcpch.ac.uk/growth/v1/trisomy-21/calculation
{
“birth_date”:“2023-01-14”,
“observation_date”:“2024-07-14”,
“observation_value”:80.0,
“measurement_method”:“height”,
“sex”:“male”,
“gestation_weeks”:32,
“gestation_days”:0
}
Returns the following response:
{
“birth_data”:
{

Have I understood the error correctly? What should I do for this case?
I could test that the [observation date] minus [weeks away from 40 weeks gestation] is positive, and if not then do an API call pretending that they are full term. If I did this could I then combine this measurement with other measurements that include gestation adjusted data for chart dispay?

Do API calls that result in errors count towards the number of API calls perfomed in a month?

Is there any documentation listing the different error cases? (Another error case I have found is for turner reference data: “There is no reference data below 1 year.”) . It would be nice to know what they are up-front so I can choose which measurements to skip if I know they will give an errror.

Thanks.

Thanks for getting in touch David

There is a summary of the dataset thresholds in the docs

For sure, very happy to try and put together a summary of the errors you might get also.

Trisomy 21 reference begins at birth as there is no standard for preterm babies with trisomy 21, and tbh their premature growth trajectory should not differ really from babies without trisomy. I did once try and stitch the references together but it looked terrible so I gave up.

Turner reference is only for girls, and only for height > 1y. This is because girls with Turner often receive growth hormone so it is their heights and response to treatment that most interests clinicians.

Within WHO there are also different thresholds for different measurements - head circumference for example runs out at 17 y in girls, and 18 y in boys. The table in the docs hopefully gives a more thorough summary.

Just to add to Simon’s response that we don’t charge for calls that result in an error.

@eatyourpeas perhaps we could change the error message to “Do not use Trisomy 21 specific growth charts before term” or something more meaningful to display to users?