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: Shareable Patient Demographics

This view acts on the Patient resource for versions R4 and R5 to produce a table named "shareable_patient_demographics".

The table contains the following columns:

NameFhir TypeSQL TypeCollection
idstringString
genderstringString
given_namestringString
family_namestringString

Selection Rules:

ItemCollTypeDescription
shareable_patient_demographicsPatient
shareable_patient_demographics / Select
shareable_patient_demographics / Select / idstringgetResourceKey()
shareable_patient_demographics / Select / gendercodegender
shareable_patient_demographics / Selectfor each name.where(use = 'official').first()
shareable_patient_demographics / Select / given_namestringgiven.join(' ')
A single given name field with all names joined together.
shareable_patient_demographics / Select / family_namestringfamily

Notes:

This will result in a "shareable_patient_demographics" table that looks like this:

idgendergiven_namefamily_name
28femaleMalvina GerdaVicario
29maleYolotzin AdelBristow
30otherJin GomerAarens