Safety driver
Hazard rcpch/digital-growth-charts-documentation#174 records a case where Trisomy 21 chart curves were displayed with a measurement tooltip whose SDS and centile had been calculated against UK-WHO. A downstream chart cannot guard against this mismatch unless each calculated Measurement carries explicit reference provenance.
This issue previously combined timestamps, API-version information and reference provenance. The safety chain below scopes this implementation to calculation-reference provenance. Timestamps and API-version metadata can be handled independently and must not delay the reference guard.
Sequential delivery chain
- This issue: add the selected calculation reference to every
rcpchgrowth Measurement result.
- rcpch/digital-growth-charts-server#207 passes the package-produced value through the API and OpenAPI schema.
- rcpch/digital-growth-charts-react-component-library#217 rejects missing, unknown, mixed or mismatched measurement references before rendering.
- rcpch/digital-growth-charts-documentation#175 documents the contract and records QMS and hazard mitigation evidence.
This is step 1 and blocks step 2.
Current behaviour
Measurement already stores the caller-selected public reference as self.reference and uses it for calculation, but the public Measurement.measurement dictionary omits it. Consumers commonly retain only .measurement, so provenance is lost at the package boundary.
The public serialized vocabulary already exists in rcpchgrowth/constants/reference_constants.py:
uk-who
trisomy-21
trisomy-21-aap
turners-syndrome
cdc
who
These are public calculation selectors. Internal table identifiers such as uk90_preterm, uk_who_child or trisomy_21_aap_infant are different concepts and must not be returned in this field.
Required change
- Add an always-present top-level
reference field to Measurement.measurement.
- Serialize the exact canonical public selector supplied to the calculation, for example
"reference": "trisomy-21".
- Define or reuse one canonical public reference type/vocabulary for annotations and validation without changing existing serialized string values.
- Keep existing string constants and callers compatible; do not replace them with enum objects whose equality or JSON behaviour could break consumers.
- Propagate the field naturally through
generate_fictional_child_data because those results are also Measurement dictionaries.
- Do not infer the value from calculated centiles or the physical table selected at a particular age.
Compatibility
This is an additive top-level property and should be released as a semver-minor package change. Every existing section and numerical value must remain unchanged. A downstream strict schema may filter or reject the new field, which is why step 2 is a separate coordinated server change.
Acceptance criteria
Safety driver
Hazard rcpch/digital-growth-charts-documentation#174 records a case where Trisomy 21 chart curves were displayed with a measurement tooltip whose SDS and centile had been calculated against UK-WHO. A downstream chart cannot guard against this mismatch unless each calculated Measurement carries explicit reference provenance.
This issue previously combined timestamps, API-version information and reference provenance. The safety chain below scopes this implementation to calculation-reference provenance. Timestamps and API-version metadata can be handled independently and must not delay the reference guard.
Sequential delivery chain
rcpchgrowthMeasurement result.This is step 1 and blocks step 2.
Current behaviour
Measurementalready stores the caller-selected public reference asself.referenceand uses it for calculation, but the publicMeasurement.measurementdictionary omits it. Consumers commonly retain only.measurement, so provenance is lost at the package boundary.The public serialized vocabulary already exists in
rcpchgrowth/constants/reference_constants.py:uk-whotrisomy-21trisomy-21-aapturners-syndromecdcwhoThese are public calculation selectors. Internal table identifiers such as
uk90_preterm,uk_who_childortrisomy_21_aap_infantare different concepts and must not be returned in this field.Required change
referencefield toMeasurement.measurement."reference": "trisomy-21".generate_fictional_child_databecause those results are also Measurement dictionaries.Compatibility
This is an additive top-level property and should be released as a semver-minor package change. Every existing section and numerical value must remain unchanged. A downstream strict schema may filter or reject the new field, which is why step 2 is a separate coordinated server change.
Acceptance criteria
referenceas a plain string.trisomy-21andtrisomy-21-aapremain distinguishable.turners-syndromeretains its existing canonical spelling.