Skip to content

Suppress empty parent objects when required children are absent (on_missing / required_slots) #264

Description

@amc-corey-cox

Sparse-join misses now suppress the nested object (#217), but a parent whose only meaningful content is missing children is still emitted as a hollow shell. Example: a blood-pressure MeasurementObservationSet wrapping systolic + diastolic MeasurementObservations — if neither reading exists, the set still emits with valid identity/constant slots but observations: []. Emitting it asserts "a blood-pressure measurement happened" when nothing was measured (the same silent-shape hazard as #211).

This can't reuse #217's local rule ("object anchored to its populated_from table; no row → no object") because the parent's populated_from row does exist. Suppression here is non-local: it depends on the derived children, and must propagate upward.

Proposed direction:

  • Add an opt-in on_missing: control on a class_derivation (e.g. skip | none | empty), defaulting to current behavior — pruning a parent whose populated_from row exists should never be automatic.
  • Pair it with required_slots: (or similar) to define "empty": the parent is suppressed when its required slots resolve to absent. Needed because constants (observation_type, unit) and parent-derived identity slots (associated_participant) are never null, so "all slots None" is the wrong test — emptiness must be declared, not inferred.
  • Suppression cascades: a suppressed parent should let its container re-evaluate its own required_slots.

Notes:

Origin: design discussion while fixing #217; real-world case from a BDCHM blood-pressure transform.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions