API Calls required to plot existing measurements

Hello, I would appreciate it if someone could check my understanding of the use of the API for the given scenario:

A 5 year old boy has 60 existing recordings of measurements for each of height, weight, BMI and OFC (so 240 measurements in total).
I want use the UK-WHO reference to plot these measurements on centile charts and SDS charts.
To do this I think that I would have to make 61 API calls for each type of measurement:

  • 1 call to /uk-who/chart-coordinates to get the data needed to plot the male growth chart.
  • 60 calls to /uk-who/calculation (one for each measurement) to get the calculated the centile/SDS data.

So to get the data required to plot charts for each measurement type would require 244 API calls.

If the SDS charts and centile value were not required then could I generate the json without the API to plot the measurements? So would only need 1 API call to /uk-who/chart-coordinates per measurement type. I suppose I would need to add in corrected age measurement values as well.

Thanks.

Hi @dpape, welcome to the RCPCH Incubator forum and thanks for posting your question here in the forum. I think we touched on this issue with the TPP team on a call a few weeks back but I’m not sure if you were on that call.

We recommend that the full JSON API response from each of the historical results are stored server-side in your system, each time you make the API call.

The structure of the /uk-who/calculation JSON response does not change, and the centile calculations and results do not change either, so it is perfectly legitimate to store these for future use.

When you want to display the chart component with all 60 measurements, you can retrieve the JSON responses from the database and pass them as a simple Array into the React component, which natively understands the JSON structure and will display the chart points for you.

If we then saw this child again and did a new set of measurements we would have to call the API once for each of the measurements only, so 4 API calls, assuming that we had done all 4 measurements. You would not have to call the API 244 times to render this chart.

Worth also noting that the chart coordinate data at /uk-who/chart-coordinates does not change frequently either so can be cached locally. @eatyourpeas could you confirm if/when the chart coordinate data does change? IIRC it doesn’t change at all?

[Note that it’s quite unusual to still be doing OFC/head circumference measurements on older children like this, and that 60 measurements for a single child is exceedingly rare in primary care]

Happy to set up a call to ensure we are all on the same page.