SQL on FHIR
2.1.0-pre - ci-build 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 2.1.0-pre 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

: OMOP/FHIR Patient Match with Diagnoses - XML Representation

Page standards status: Informative

Raw xml | Download


<Library xmlns="http://hl7.org/fhir">
  <id value="OmopFhirPatientJoin"/>
  <meta>
    <profile
             value="http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery"/>
  </meta>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
<div>
    <table class="grid dict">
        
        
        <tr>
            <th scope="row"><b>Title: </b></th>
            <td style="padding-left: 4px;">OMOP/FHIR Patient Match with Diagnoses</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Id: </b></th>
            <td style="padding-left: 4px;">OmopFhirPatientJoin</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Version: </b></th>
            <td style="padding-left: 4px;">2.1.0-pre</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Url: </b></th>
            <td style="padding-left: 4px;"><a href="Library-OmopFhirPatientJoin.html">OMOP/FHIR Patient Match with Diagnoses</a></td>
        </tr>
        

        
        <tr>
            <th scope="row">
                <b>
                    
                        
                    
                </b>
            </th>
            <td style="padding-left: 4px;">
                
                <p style="margin-bottom: 5px;">
                    <span>urn:oid:2.16.840.1.113883.4.642.40.77.28.3</span>
                </p>
                
            </td>
        </tr>
        

        

        

        

        
        <tr>
            <th scope="row"><b>Type: </b></th>
            <td style="padding-left: 4px;">
                
                    
                        
                        <p style="margin-bottom: 5px;">
                            <b>system: </b> <span><a href="CodeSystem-LibraryTypesCodes.html">http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes</a></span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>code: </b> <span>sql-query</span>
                        </p>
                        
                        
                    
                
                
            </td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Date: </b></th>
            <td style="padding-left: 4px;">2026-07-28 04:38:44+0000</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Publisher: </b></th>
            <td style="padding-left: 4px;">HL7 International / FHIR Infrastructure</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Description: </b></th>
            <td style="padding-left: 4px;"><div><p>Uses labels to disambiguate patient views from different sources and joins
patient diagnoses for downstream analytics.</p>
<pre><code class="language-sql">SELECT
  omop_person.person_id AS omop_person_id,
  fhir_patient.id AS fhir_patient_id,
  fhir_patient.name,
  diagnoses_view.code AS diagnosis_code,
  diagnoses_view.display AS diagnosis_display
FROM omop_person
JOIN fhir_patient
  ON omop_person.person_id = fhir_patient.mrn
JOIN diagnoses_view
  ON diagnoses_view.patient_id = fhir_patient.id
WHERE omop_person.source_system = :source_system
</code></pre>
</div></td>
        </tr>
        

        

        

        

        
        <tr>
            <th scope="row"><b>Jurisdiction: </b></th>
            <td style="padding-left: 4px;">001</td>
        </tr>
        

        

        

        

        

        

        

        
        <tr>
            <th scope="row"><b>Related Artifacts: </b></th>
            <td style="padding-left: 4px;">
                
                
                
                <p><b>Dependencies</b></p>
                <ul>
                  
                    <li><code>https://example.org/omop/ViewDefinition/Patient</code></li>
                  
                    <li><code>https://example.org/fhir/ViewDefinition/Patient</code></li>
                  
                    <li><code>https://example.org/ViewDefinition/diagnoses_view</code></li>
                  
                </ul>
                
                
                
                
                
            </td>
        </tr>
        

        
        <tr>
          <th scope="row"><b>Parameters: </b></th>
          <td style="padding-left: 4px;">
            <table class="grid-dict">
              <tr><th><b>Name</b></th><th><b>Type</b></th><th><b>Min</b></th><th><b>Max</b></th><th><b>In/Out</b></th></tr>
              
                <tr><th>source_system</th><th>string</th><th/><th/><th>In</th></tr>
              
            </table>
          </td>
        </tr>
        

        

        
        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><b>Content: </b> application/sql</th></tr>
              <tr><td><pre><code>Encoded data (528 characters)</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
    </table>
</div>
</div>
  </text>
  <url
       value="http://hl7.org/fhir/uv/sql-on-fhir/Library/OmopFhirPatientJoin"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.77.28.3"/>
  </identifier>
  <version value="2.1.0-pre"/>
  <name value="OmopFhirPatientJoin"/>
  <title value="OMOP/FHIR Patient Match with Diagnoses"/>
  <status value="active"/>
  <type>
    <coding>
      <system
              value="http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes"/>
      <code value="sql-query"/>
    </coding>
  </type>
  <date value="2026-07-28T04:38:44+00:00"/>
  <publisher value="HL7 International / FHIR Infrastructure"/>
  <contact>
    <name value="HL7 International / FHIR Infrastructure"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/fiwg"/>
    </telecom>
  </contact>
  <description
               value="Uses labels to disambiguate patient views from different sources and joins
patient diagnoses for downstream analytics.

```sql
SELECT
  omop_person.person_id AS omop_person_id,
  fhir_patient.id AS fhir_patient_id,
  fhir_patient.name,
  diagnoses_view.code AS diagnosis_code,
  diagnoses_view.display AS diagnosis_display
FROM omop_person
JOIN fhir_patient
  ON omop_person.person_id = fhir_patient.mrn
JOIN diagnoses_view
  ON diagnoses_view.patient_id = fhir_patient.id
WHERE omop_person.source_system = :source_system
```"/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <relatedArtifact>
    <type value="depends-on"/>
    <label value="omop_person"/>
    <display value="OMOP Person view"/>
    <resource value="https://example.org/omop/ViewDefinition/Patient"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <label value="fhir_patient"/>
    <display value="FHIR Patient view"/>
    <resource value="https://example.org/fhir/ViewDefinition/Patient"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <label value="diagnoses_view"/>
    <display value="Diagnosis facts view"/>
    <resource value="https://example.org/ViewDefinition/diagnoses_view"/>
  </relatedArtifact>
  <parameter>
    <name value="source_system"/>
    <use value="in"/>
    <documentation value="Source system identifier for OMOP records"/>
    <type value="string"/>
  </parameter>
  <content>
    <extension
               url="http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/sql-text">
      <valueString
                   value="SELECT
  omop_person.person_id AS omop_person_id,
  fhir_patient.id AS fhir_patient_id,
  fhir_patient.name,
  diagnoses_view.code AS diagnosis_code,
  diagnoses_view.display AS diagnosis_display
FROM omop_person
JOIN fhir_patient
  ON omop_person.person_id = fhir_patient.mrn
JOIN diagnoses_view
  ON diagnoses_view.patient_id = fhir_patient.id
WHERE omop_person.source_system = :source_system"/>
    </extension>
    <contentType value="application/sql"/>
    <data
          value="U0VMRUNUCiAgb21vcF9wZXJzb24ucGVyc29uX2lkIEFTIG9tb3BfcGVyc29uX2lkLAogIGZoaXJfcGF0aWVudC5pZCBBUyBmaGlyX3BhdGllbnRfaWQsCiAgZmhpcl9wYXRpZW50Lm5hbWUsCiAgZGlhZ25vc2VzX3ZpZXcuY29kZSBBUyBkaWFnbm9zaXNfY29kZSwKICBkaWFnbm9zZXNfdmlldy5kaXNwbGF5IEFTIGRpYWdub3Npc19kaXNwbGF5CkZST00gb21vcF9wZXJzb24KSk9JTiBmaGlyX3BhdGllbnQKICBPTiBvbW9wX3BlcnNvbi5wZXJzb25faWQgPSBmaGlyX3BhdGllbnQubXJuCkpPSU4gZGlhZ25vc2VzX3ZpZXcKICBPTiBkaWFnbm9zZXNfdmlldy5wYXRpZW50X2lkID0gZmhpcl9wYXRpZW50LmlkCldIRVJFIG9tb3BfcGVyc29uLnNvdXJjZV9zeXN0ZW0gPSA6c291cmNlX3N5c3RlbQ=="/>
  </content>
</Library>