rcpch / digital-growth-charts-react-component-library

A typescript React library for displaying RCPCH Digital Growth Charts from API data
https://growth.rcpch.ac.uk
MIT License
7 stars 9 forks source link

Very tall Y axis for high BMI on trisomy 21 charts #93

Closed mbarton closed 3 weeks ago

mbarton commented 1 month ago

Porting across https://github.com/rcpch/digital-growth-charts-server/issues/220 to this repo as it seems to be an issue with the chart rendering rather than the data returned from the API.

Birth Date: 08/05/2006 Measurement Date: 01/11/2022 BMI: 36.3 kg/m²

image

Storybook story to reproduce in the mbarton/trisomy21-bmi-rendering-issue branch: https://github.com/rcpch/digital-growth-charts-react-component-library/commit/6aa9181e7cc89c668191100086b0fc94aafd068c

mbarton commented 1 month ago

I think the issue is with the bmiSDSData returned from getDomainsAndData:

https://github.com/rcpch/digital-growth-charts-react-component-library/blob/b6331d27ac116991802313028fcd8257e68affd5/src/functions/getDomainsAndData.ts#L523

For the 3.33 SDS line (the rightmost tallest one in the screenshot) the values ramp up quickly and then end up null:

Screenshot 2024-07-16 13 58 10

mbarton commented 1 month ago

Ah I see those are the actual values from the reference set:

https://github.com/rcpch/digital-growth-charts-react-component-library/blob/b6331d27ac116991802313028fcd8257e68affd5/src/chartdata/trisomy21_bmi_male_sds_data.ts#L7712

I think I will need @eatyourpeas input here on how that reference was calculated. There's also https://github.com/rcpch/digital-growth-charts-server/issues/217 raised already for the nulls

eatyourpeas commented 1 month ago

These values were calculated from our chart-coordinates endpoint and are possibly correct because of the way the maths works at higher values. The BMI curves in trisomy I find much less useful clinically for this reason. @statist7 would better be able to comment whether this is an actual error or whether this is more an issue for rendering where we simply apply an arbitrary upper limit to the visible value of y.

statist7 commented 1 month ago

For particular configurations of L, M, S and z, BMI heads off to infinity. The relevant formula is Centile = M(1+LSz)^(1/L) so if 1+LSz = 0 then there is a problem.

This happens when L is negative (which it nearly always is with BMI) and z is sufficiently large and positive. As @eatyourpeas says, perhaps test for and trap large BMI values.