SQL on FHIR
            
            2.1.0-pre - release
  
            
          
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
This content is an example of the View Definition Logical Model and is not a FHIR Resource
    
{
  "resourceType": "https://sql-on-fhir.org/ig/StructureDefinition/ViewDefinition",
  "id": "PatientDemographics",
  "select": [
    {
      "column": [
        {
          "path": "getResourceKey()",
          "name": "id"
        },
        {
          "path": "gender",
          "name": "gender"
        }
      ]
    },
    {
      "column": [
        {
          "path": "given.join(' ')",
          "name": "given_name",
          "description": "A single given name field with all names joined together."
        },
        {
          "path": "family",
          "name": "family_name"
        }
      ],
      "forEach": "name.where(use = 'official').first()"
    }
  ],
  "name": "patient_demographics",
  "status": "draft",
  "resource": "Patient"
}
  
This will result in a “patient_demographics” table that looks like this:
| id | gender | given_name | family_name | 
|---|---|---|---|
| 1 | female | Malvina Gerda | Vicario | 
| 2 | male | Yolotzin Adel | Bristow | 
| 3 | other | Jin Gomer | Aarens |