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:
- bump the major version, since there maybe people out there that rely on this for their own chart implementations
- refactor the chart component to accommodate the change
The Measurement class returns a python object with 7 nested elements:
birth_datameasurement_dateschild_observation_valuemeasurement_calculated_valuesbone_ageevents_dataThe 6th is
plottable_datawhich has nested within itcentile_dataandsds_data, which in turn have nested inside them one each ofchronological_decimal_age_dataandcorrected_decimal_age_data. The only really difference is that the decimal ages are mapped tox(depending on whether chronological or corrected) and theobservation_valuein the centiles, or the sds (again depending on chronological or corrected), maps toy. 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 theplottable_dataobject 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_datawould be neater, and would make the API response object leaner and possibly faster (though arguably unlikely noticeably).To implement this we would have to: