rcpch / rcpchgrowth-python

A python package to produce calculations for all growth issues
GNU Affero General Public License v3.0
5 stars 4 forks source link

remove `plottable_data` #24

Open eatyourpeas opened 9 months ago

eatyourpeas commented 9 months ago

The Measurement class returns a python object with 7 nested elements: birth_data measurement_dates child_observation_value measurement_calculated_values bone_age events_data The 6th is plottable_data which has nested within it centile_data and sds_data, which in turn have nested inside them one each of chronological_decimal_age_data and corrected_decimal_age_data. The only really difference is that the decimal ages are mapped to x (depending on whether chronological or corrected) and the observation_value in the centiles, or the sds (again depending on chronological or corrected), maps to y . All the other parts are elsewhere in the object and were added there for convenience. It meant that the chart component could pull out all the elements it needed from the plottable_data object when plotting, rather than mapping different bits first.

In fact though it makes for a slightly complicated structure and it is not very DRY.

Removing plottable_data would be neater, and would make the API response object leaner and possibly faster (though arguably unlikely noticeably).

To implement this we would have to:

  1. bump the major version, since there maybe people out there that rely on this for their own chart implementations
  2. refactor the chart component to accommodate the change