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: Encounter Flat

This view acts on the Encounter resource for version R4 to produce a table named "encounter_flat".

The table contains the following columns:

NameFhir TypeSQL TypeCollectionNotes
idstringString
statusstringString
patient_idstringString
service_org_idstringString
period_startdateTimeDateTime
period_enddateTimeDateTime
EpisodeOfCareIdstringString
type_sysuriStringThis column is not defined as a collection, but the path statement 'system' might return multiple values for the column 'type_sys' for some inputs
type_codestringStringThis column is not defined as a collection, but the path statement 'code' might return multiple values for the column 'type_code' for some inputs
practitioner_idstringString
location_idstringString

Selection Rules:

ItemCollTypeDescription
.. encounter_flatEncounter
... Select
.... idgetResourceKey()
.... statusstatus
.... patient_idsubject.getReferenceKey(Patient)
.... service_org_idserviceProvider.getReferenceKey(Organization)
.... period_startperiod.start
.... period_endperiod.end
.... EpisodeOfCareIdepisodeOfCare.getReferenceKey(EpisodeOfCare)
... Selectfor each type.coding, or null
.... type_syssystem
.... type_codecode
... Selectfor each participant, or null
.... practitioner_idindividual.getReferenceKey(Practitioner)
.... location_idlocation.getReferenceKey(Location)