Skip to content

6.5.2.4 ObservationContext

6.5.2.4.1 Purpose

How a value was obtained: method, result basis, time basis and aggregation. One context is shared by every observation produced the same way, so the same observation type can come from a lab test day, a robot milking or a daily sensor mean without multiplying codes.

6.5.2.4.2 Questions it answers

  • Is this value a measurement, an estimate or an aggregate?
  • Does its time refer to sample collection, the phenomenon itself or a test day?
  • Which observations were produced the same way?

6.5.2.4.3 Fields

Field Type Cardinality Description
id string (uuid) 1..1 Key.
method ObservationMethod 0..1 Protocol/version when known; manual transcription is not an analytical method.
result_basis enum 1..1 Values: measurement, calibrated_estimate, aggregate, derived_value, derived_index, unknown.
time_basis enum 1..1 Values: sample_collection, phenomenon, test_day_reference, aggregation_window, unknown.
A test-day date is not automatically the physical sampling date.
aggregation AggregationEnum 1..1 A measurement may cover a window with aggregation none; a mixed physical sample is not a statistical mean.
aggregation_definition CodedValue 0..1 Custom formula/weights when known.
created_at datetime 1..1

6.5.2.4.4 Relationships

References

Referenced by

Uses types

AggregationEnum, CodedValue

6.5.2.4.5 Rules & constraints

  • How a value was obtained, shared by every observation produced the same way.
  • Not in ObservationType: the same type (e.g. milk.scc@1) comes from a lab test day (lab method, no aggregation, test-day date, measurement), from a robot at each milking (sensor, milking time, calibrated estimate) or as a daily sensor mean (aggregate).
  • Putting these in the type would multiply codes (as LOINC does with method and time aspect); we keep them apart, as FHIR does.
  • Not repeated on every row: they are constant per source mapping, so rows of the same mapping cannot contradict each other.
  • (method, result_basis, time_basis, aggregation, aggregation_definition) is unique. Immutable: a different way of obtaining values is a new context.
  • Independent of ObservationType: one context serves e.g. every analyte of the same lab report. Compatibility between the context and the observation type is validated when the observation is written.
  • result_basis=aggregate requires aggregation != none. derived_value and derived_index require a derivation on the observation (CanonicalDerivation) or a ComputedSourceOrigin with computed_by = vendor.
  • Parser mappings choose the context for each source field; the mapping version is audited in ParseJob.
  • A small catalog (tens of rows) that readers keep in memory.