SQL on FHIR
3.0.0-ballot - STU 3 Ballot International flag

SQL on FHIR, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 3.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sql-on-fhir/ and changes regularly. See the Directory of published versions

Example ViewDefinition: Condition Flat

This view acts on the Condition resource to produce a table named "condition_flat".

The table contains the following columns:

NameFhir TypeSQL TypeCollectionNotes
idstringString
patient_idstringString
encounter_idstringString
onset_datetimedateTimeDateTime
systemuriStringThis column is not defined as a collection, but the path statement 'system' might return multiple values for the column 'system' for some inputs
codestringStringThis column is not defined as a collection, but the path statement 'code' might return multiple values for the column 'code' for some inputs
categorystringStringThis column is not defined as a collection, but the path statement 'code' might return multiple values for the column 'category' for some inputs
clinical_statusstringStringThis column is not defined as a collection, but the path statement 'code' might return multiple values for the column 'clinical_status' for some inputs
verification_statusstringStringThis column is not defined as a collection, but the path statement 'code' might return multiple values for the column 'verification_status' for some inputs

Selection Rules:

ItemCollTypeDescription
.. condition_flatCondition
... Select
.... idgetResourceKey()
.... patient_idsubject.getReferenceKey(Patient)
.... encounter_idencounter.getReferenceKey(Encounter)
.... onset_datetimedateTimeonset.ofType(dateTime)
... Selectfor each code.coding, or null
.... systemurisystem
.... codecode
... Selectfor each category.coding, or null
.... categorycode
.... clinical_statuscode
... Selectfor each verificationStatus.coding, or null
.... verification_statuscode