SQL on FHIR
2.1.0-pre - release International flag

SQL on FHIR - Local Development build (v2.1.0-pre) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Example ViewDefinition: UsCoreBloodPressures

draft

Generated Narrative: ViewDefinition UsCoreBloodPressures

This view acts on the Observation resource to produce a table named "us_core_blood_pressures" where code.coding.exists(system='http://loinc.org' and code=%bp_code).

The table contains the following columns:

NameFhir TypeSQL TypeCollection
idstringString
patient_idstringString
effective_date_timedateTimeDateTime
sbp_quantity_systemuriString
sbp_quantity_codestringString
sbp_quantity_unitstringString
sbp_quantity_valuedecimalDecimal
dbp_quantity_systemuriString
dbp_quantity_codestringString
dbp_quantity_unitstringString
dbp_quantity_valuedecimalDecimal

Constants:

NameValue
systolic_bp8480-6
diastolic_bp8462-4
bp_code85354-9

Selection Rules:

ItemCollTypeDescription
.. us_core_blood_pressuresObservation
... Select
.... idgetResourceKey()
.... patient_idsubject.getReferenceKey(Patient)
Can be used to join to patient tables created by other views.
.... effective_date_timeeffective.ofType(dateTime)
... Selectfor each component.where(code.coding.exists(system='http://loinc.org' and code=%systolic_bp)).first()
.... sbp_quantity_systemvalue.ofType(Quantity).system
.... sbp_quantity_codevalue.ofType(Quantity).code
.... sbp_quantity_unitvalue.ofType(Quantity).unit
.... sbp_quantity_valuevalue.ofType(Quantity).value
... Selectfor each component.where(code.coding.exists(system='http://loinc.org' and code=%diastolic_bp)).first()
.... dbp_quantity_systemvalue.ofType(Quantity).system
.... dbp_quantity_codevalue.ofType(Quantity).code
.... dbp_quantity_unitvalue.ofType(Quantity).unit
.... dbp_quantity_valuevalue.ofType(Quantity).value