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
| Page standards status: Informative |
{
"resourceType" : "Library",
"id" : "OmopFhirPatientJoin",
"meta" : {
"profile" : [
🔗 "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery"
]
},
"language" : "en",
"text" : {
"status" : "extensions",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <table class=\"narrative-table\">\n <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">OMOP/FHIR Patient Match with Diagnoses</td>\n\n\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n\n<td class=\"content-container\">3.0.0-ballot</td>\n\n\n</tr>\n\n\n\n\n\n\n\n \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">urn:oid:2.16.840.1.113883.4.642.40.77.28.3</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Jurisdiction</th>\n\n\n\n<td class=\"content-container\">\n World\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n\n<td class=\"content-container\">HL7 International / FHIR Infrastructure</td>\n\n\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward Contact</th>\n\n\n\n<td class=\"content-container\">HL7 International / FHIR Infrastructure</td>\n\n\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>Uses labels to disambiguate patient views from different sources and joins\npatient diagnoses for downstream analytics.</p>\n<pre><code class=\"language-sql\">SELECT\n omop_person.person_id AS omop_person_id,\n fhir_patient.id AS fhir_patient_id,\n fhir_patient.name,\n diagnoses_view.code AS diagnosis_code,\n diagnoses_view.display AS diagnosis_display\nFROM omop_person\nJOIN fhir_patient\n ON omop_person.person_id = fhir_patient.mrn\nJOIN diagnoses_view\n ON diagnoses_view.patient_id = fhir_patient.id\nWHERE omop_person.source_system = :source_system\n</code></pre>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n sql-query from <a href=\"CodeSystem-LibraryTypesCodes.html\">http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes</a> \n\n\n</td>\n\n\n</tr>\n\n\n\n<tr>\n \n \n \n \n \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n \n \n <td class=\"content-container\">\n \n <em>Description</em>: OMOP Person view\n \n <br/>\n \n \n \n \n \n \n <em>Resource</em>: <code>https://example.org/omop/ViewDefinition/Patient</code>\n <br/>\n <em>Canonical URL</em>: <tt>https://example.org/omop/ViewDefinition/Patient</tt>\n \n \n \n </td>\n</tr>\n\n<tr>\n \n \n \n \n \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n \n \n <td class=\"content-container\">\n \n <em>Description</em>: FHIR Patient view\n \n <br/>\n \n \n \n \n \n \n <em>Resource</em>: <code>https://example.org/fhir/ViewDefinition/Patient</code>\n <br/>\n <em>Canonical URL</em>: <tt>https://example.org/fhir/ViewDefinition/Patient</tt>\n \n \n \n </td>\n</tr>\n\n<tr>\n \n \n \n \n \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n \n \n <td class=\"content-container\">\n \n <em>Description</em>: Diagnosis facts view\n \n <br/>\n \n \n \n \n \n \n <em>Resource</em>: <code>https://example.org/ViewDefinition/diagnoses_view</code>\n <br/>\n <em>Canonical URL</em>: <tt>https://example.org/ViewDefinition/diagnoses_view</tt>\n \n \n \n </td>\n</tr>\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"parameters\"> </a>Parameters</th>\n\n\n</tr>\n\n<tr>\n \n\n<th scope=\"row\" class=\"row-header\"/>\n\n\n <td class=\"content-container\">\n <table>\n <thead>\n <tr>\n <td><em>Name</em></td>\n <td><em>Use</em></td>\n <td><em>Card.</em></td>\n <td><em>Type</em></td>\n <td><em>Documentation</em></td>\n </tr>\n </thead>\n <tbody>\n \n <tr>\n <td>source_system</td>\n <td>In</td>\n <td>0..1</td>\n <td>string</td>\n <td>Source system identifier for OMOP records</td>\n </tr>\n \n </tbody>\n </table>\n </td>\n</tr>\n\n\n\n\n\n\n\n <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n \n \n <tr>\n <th scope=\"row\" class=\"row-header\">application/sqlContent</th>\n <td>\n <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n </td>\n </tr>\n \n \n\n<tr>\n <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.4 of the sample-content-ig Liquid templates</th>\n</tr>\n\n </tbody>\n </table>\n</div>"
},
"url" : "http://hl7.org/fhir/uv/sql-on-fhir/Library/OmopFhirPatientJoin",
"identifier" : [
{
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.40.77.28.3"
}
],
"version" : "3.0.0-ballot",
"name" : "OmopFhirPatientJoin",
"title" : "OMOP/FHIR Patient Match with Diagnoses",
"status" : "active",
"type" : {
"coding" : [
{
"system" : "http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes",
"code" : "sql-query"
}
]
},
"date" : "2026-08-13T15:42:34+00:00",
"publisher" : "HL7 International / FHIR Infrastructure",
"contact" : [
{
"name" : "HL7 International / FHIR Infrastructure",
"telecom" : [
{
"system" : "url",
"value" : "http://www.hl7.org/Special/committees/fiwg"
}
]
}
],
"description" : "Uses labels to disambiguate patient views from different sources and joins\npatient diagnoses for downstream analytics.\n\n```sql\nSELECT\n omop_person.person_id AS omop_person_id,\n fhir_patient.id AS fhir_patient_id,\n fhir_patient.name,\n diagnoses_view.code AS diagnosis_code,\n diagnoses_view.display AS diagnosis_display\nFROM omop_person\nJOIN fhir_patient\n ON omop_person.person_id = fhir_patient.mrn\nJOIN diagnoses_view\n ON diagnoses_view.patient_id = fhir_patient.id\nWHERE omop_person.source_system = :source_system\n```",
"jurisdiction" : [
{
"coding" : [
{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001",
"display" : "World"
}
]
}
],
"relatedArtifact" : [
{
"type" : "depends-on",
"label" : "omop_person",
"display" : "OMOP Person view",
"resource" : "https://example.org/omop/ViewDefinition/Patient"
},
{
"type" : "depends-on",
"label" : "fhir_patient",
"display" : "FHIR Patient view",
"resource" : "https://example.org/fhir/ViewDefinition/Patient"
},
{
"type" : "depends-on",
"label" : "diagnoses_view",
"display" : "Diagnosis facts view",
"resource" : "https://example.org/ViewDefinition/diagnoses_view"
}
],
"parameter" : [
{
"name" : "source_system",
"use" : "in",
"documentation" : "Source system identifier for OMOP records",
"type" : "string"
}
],
"content" : [
{
"extension" : [
{
"url" : "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/sql-text",
"valueString" : "SELECT\n omop_person.person_id AS omop_person_id,\n fhir_patient.id AS fhir_patient_id,\n fhir_patient.name,\n diagnoses_view.code AS diagnosis_code,\n diagnoses_view.display AS diagnosis_display\nFROM omop_person\nJOIN fhir_patient\n ON omop_person.person_id = fhir_patient.mrn\nJOIN diagnoses_view\n ON diagnoses_view.patient_id = fhir_patient.id\nWHERE omop_person.source_system = :source_system"
}
],
"contentType" : "application/sql",
"data" : "U0VMRUNUCiAgb21vcF9wZXJzb24ucGVyc29uX2lkIEFTIG9tb3BfcGVyc29uX2lkLAogIGZoaXJfcGF0aWVudC5pZCBBUyBmaGlyX3BhdGllbnRfaWQsCiAgZmhpcl9wYXRpZW50Lm5hbWUsCiAgZGlhZ25vc2VzX3ZpZXcuY29kZSBBUyBkaWFnbm9zaXNfY29kZSwKICBkaWFnbm9zZXNfdmlldy5kaXNwbGF5IEFTIGRpYWdub3Npc19kaXNwbGF5CkZST00gb21vcF9wZXJzb24KSk9JTiBmaGlyX3BhdGllbnQKICBPTiBvbW9wX3BlcnNvbi5wZXJzb25faWQgPSBmaGlyX3BhdGllbnQubXJuCkpPSU4gZGlhZ25vc2VzX3ZpZXcKICBPTiBkaWFnbm9zZXNfdmlldy5wYXRpZW50X2lkID0gZmhpcl9wYXRpZW50LmlkCldIRVJFIG9tb3BfcGVyc29uLnNvdXJjZV9zeXN0ZW0gPSA6c291cmNlX3N5c3RlbQ=="
}
]
}