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

Library: OMOP/FHIR Patient Match with Diagnoses

Official URL: http://hl7.org/fhir/uv/sql-on-fhir/Library/OmopFhirPatientJoin Version: 2.1.0-pre
Standards status: Informative Computable Name: OmopFhirPatientJoin
Other Identifiers: OID:2.16.840.1.113883.4.642.40.77.28.3

Uses labels to disambiguate patient views from different sources and joins patient diagnoses for downstream analytics.

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

Title: OMOP/FHIR Patient Match with Diagnoses
Id: OmopFhirPatientJoin
Version: 2.1.0-pre
Url: OMOP/FHIR Patient Match with Diagnoses

urn:oid:2.16.840.1.113883.4.642.40.77.28.3

Type:

system: http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes

code: sql-query

Date: 2026-07-28 04:38:44+0000
Publisher: HL7 International / FHIR Infrastructure
Description:

Uses labels to disambiguate patient views from different sources and joins patient diagnoses for downstream analytics.

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: 001
Related Artifacts:

Dependencies

  • https://example.org/omop/ViewDefinition/Patient
  • https://example.org/fhir/ViewDefinition/Patient
  • https://example.org/ViewDefinition/diagnoses_view
Parameters:
NameTypeMinMaxIn/Out
source_systemstringIn
Content: application/sql
Encoded data (528 characters)