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
This view acts on the Encounter resource to produce a table named "encounter_flat".
The table contains the following columns:
| Name | Fhir Type | SQL Type | Collection |
|---|---|---|---|
| id | string | String | |
| status | string | String | |
| patient_id | string | String | |
| service_org_id | string | String | |
| period_start | dateTime | DateTime | |
| period_end | dateTime | DateTime | |
| type_sys | string | String | |
| type_code | string | String | |
| practitioner_id | string | String | |
| location_id | string | String | |
| episode_of_care_id | string | String |
Selection Rules:
| Item | Coll | Type | Description |
|---|---|---|---|
![]() | Encounter | ||
![]() ![]() | |||
![]() ![]() ![]() | getResourceKey() | ||
![]() ![]() ![]() | status | ||
![]() ![]() ![]() | subject.getReferenceKey(Patient) | ||
![]() ![]() ![]() | serviceProvider.getReferenceKey(Organization) | ||
![]() ![]() ![]() | actualPeriod.start | ||
![]() ![]() ![]() | actualPeriod.end | ||
![]() ![]() | for each type.coding, or null | ||
![]() ![]() ![]() | system | ||
![]() ![]() ![]() | code | ||
![]() ![]() | for each participant, or null | ||
![]() ![]() ![]() | actor.getReferenceKey(Practitioner) | ||
![]() ![]() | for each location, or null | ||
![]() ![]() ![]() | location.getReferenceKey(Location) | ||
![]() ![]() | for each episodeOfCare, or null | ||
![]() ![]() ![]() | getReferenceKey(EpisodeOfCare) |
This will result in an "encounter_flat" table that looks like this:
| id | status | patient_id | service_org_id | period_start | period_end | episode_of_care_id | type_sys | type_code | practitioner_id | location_id |
| 9 | completed | 28 | 27 | 2020-01-01T09:00:00Z | 2020-01-01T10:00:00Z | ActCode | AMB | 31 | 18 | |
| 10 | completed | 29 | 27 | 2020-01-02T14:00:00Z | 2020-01-03T08:00:00Z | ActCode | EMER | 31 | 19 |