Skip to content

FH02 — Choice element not narrowed

Group: Selector (schema-driven) · Severity: warning · Needs: lint --package

A FHIRPath selector lands on a FHIR choice element (value[x], effective[x], …) without narrowing it to a concrete type. Per the SQL on FHIR v2 spec, a choice must be narrowed with ofType(<Type>) before a value is extracted, so the column has a well-defined type.

Observation.value is a choice; this triggers FH02 (so does value.unit):

{
"resource": "Observation",
"select": [{ "column": [{ "name": "v", "path": "value" }] }]
}
warning [FH02] (v): selects choice element `value` without narrowing; add
ofType(<Type>) to pick a concrete type before extracting a value

Narrow the choice: value.ofType(Quantity) (then navigate, e.g. value.ofType(Quantity).value), or select a concrete element such as valueString directly.