Chuyển đến nội dung chính
Kiến trúc hệ thống

FHIR ↔ OMOP: bridge giữa operational và analytics layer

Tổ chức 2026 thường có cả FHIR (operational) và OMOP (analytics). Bài viết hướng dẫn mapping resource ↔ table, FHIR-OMOP-on-FHIR working group, Pathling, Bulk Data Export pipeline và pattern triển khai cho VN.

FHIR ↔ OMOP: bridge giữa operational và analytics layer

FHIR là chuẩn vận hành. OMOP là chuẩn phân tích. Cả hai cùng tồn tại trong tổ chức trưởng thành 2026. Bài viết hướng dẫn bridge 2 thế giới: mapping, tooling, pipeline.

1. Vì sao cần cả hai

1. Vì sao cần cả hai

FHIR mạnh real-time, JSON, REST. OMOP mạnh batch SQL, vocabulary chuẩn, network study. Mỗi cái đứng một mặt trận → bridge chứ không thay thế.

2. Mapping resource ↔ table

Cộng đồng FHIR-OMOP-on-FHIR (joint HL7 + OHDSI workgroup) duy trì mapping chính thức.

2.1 Bảng mapping cơ bản

FHIR ResourceOMOP TableNote
PatientPERSONidentifier → person_source_value, gender → gender_concept_id
EncounterVISIT_OCCURRENCEclass → visit_concept_id
Encounter (subVisit)VISIT_DETAIL (CDM 5.4+)hospital ward, dept
ConditionCONDITION_OCCURRENCEcode (SNOMED) → condition_concept_id
MedicationRequest / MedicationStatement / MedicationDispenseDRUG_EXPOSUREcode (RxNorm) → drug_concept_id
MedicationAdministrationDRUG_EXPOSUREdrug_type_concept_id = Inpatient admin
ProcedurePROCEDURE_OCCURRENCEcode → procedure_concept_id
Observation (lab)MEASUREMENTcode (LOINC) + valueQuantity
Observation (vital)MEASUREMENTcode + valueQuantity
Observation (social, family hx)OBSERVATIONcode → observation_concept_id
AllergyIntoleranceOBSERVATIONconcept = "Allergy to"
ImmunizationDRUG_EXPOSURE / PROCEDURE_OCCURRENCEdepends
SpecimenSPECIMENCDM 5.4
DocumentReference / CompositionNOTEtext → note + NOTE_NLP
CoveragePAYER_PLAN_PERIODBHYT, BHYT bổ sung
PractitionerPROVIDER
Organization (provider)CARE_SITE
LocationLOCATION

2.2 Mapping detail Encounter → Visit_Occurrence

2.2 Mapping detail Encounter → Visit_Occurrence

Code:

def encounter_to_visit(enc):
    return {
        'visit_occurrence_id': hash_to_bigint(enc['id']),
        'person_id': lookup_person(enc['subject']['reference']),
        'visit_concept_id': map_class(enc['class']['code']),
        'visit_start_date': enc['period']['start'][:10],
        'visit_start_datetime': enc['period']['start'],
        'visit_end_date': enc['period'].get('end', enc['period']['start'])[:10],
        'visit_type_concept_id': 32817,  # EHR encounter
        'care_site_id': lookup_care_site(enc.get('serviceProvider')),
        'visit_source_value': enc['id']
    }

def map_class(class_code):
    return {
        'IMP': 9201,  # Inpatient
        'AMB': 9202,  # Outpatient
        'EMER': 9203, # ER
        'HH': 581476, # Home health
        'VR': 5083    # Virtual / telehealth
    }.get(class_code, 0)

3. Coding system map FHIR ↔ OMOP

FHIR code system URL → OMOP vocabulary_id:

FHIR System URLOMOP vocabulary_id
http://snomed.info/sctSNOMED
http://hl7.org/fhir/sid/icd-10-cmICD10CM
http://hl7.org/fhir/sid/icd-10ICD10
http://www.nlm.nih.gov/research/umls/rxnormRxNorm
http://loinc.orgLOINC
http://www.ama-assn.org/go/cptCPT4
urn:oid:2.16.840.1.113883.6.96SNOMED (OID)

Vietnam:

FHIR System URL VNOMOP vocabulary
https://terminology.kcb.vn/CodeSystem/icd10vnICD10VN custom
https://terminology.kcb.vn/CodeSystem/danhmucthuocVN_DRUG (custom)

4. Pipeline pattern

4.1 Bulk Export → ETL → CDM

4.1 Bulk Export → ETL → CDM

Lợi ích: standard FHIR, không cần FHIR backend hỗ trợ custom export. Đọc bài FHIR Bulk Data Export & CDS Hooks.

4.2 Real-time CDC pattern

4.2 Real-time CDC pattern

Ưu: FHIR luôn fresh; OMOP nightly aggregate.

5. Pathling — query FHIR như OMOP

Pathling (CSIRO Australia) cho phép query FHIR data analytics-style:

-- Bulk Pathling query
SELECT 
  patient.id, 
  patient.gender,
  count(condition) AS n_conditions
FROM patient
LEFT JOIN condition ON condition.subject = patient
WHERE condition.code.subsumes('SNOMED|73211009')  -- Diabetes
GROUP BY patient.id, patient.gender;

Pathling lưu FHIR ở Parquet, query SparkSQL → tốc độ analytics gần OMOP. Có thể dùng làm bridge tạm thời nếu chưa muốn build OMOP CDM full.

6. FHIR-OMOP-on-FHIR

Working group joint HL7 + OHDSI từ 2020. Output 2026:

  • Implementation Guide chính thức (ig.fhir.org/...)
  • Mapping table maintained
  • HAPI FHIR plugin → query OMOP CDM as FHIR
  • OMOP-on-FHIR server reference (Georgia Tech)

→ Một server có thể serve OMOP data dưới interface FHIR, hoặc convert FHIR → OMOP automatic.

7. OHDSI Sql On FHIR (SOF)

Sql On FHIR (SOF) là project mới (2024-2026) cho phép expose FHIR resource as SQL view. Tương tự Pathling nhưng spec mở:

  • ViewDefinition resource (R4 / R5)
  • Reference implementation: HAPI, Aidbox
  • Output: flat tabular view → load vào OMOP dễ dàng

8. Triển khai cho VN

8.1 Pattern recommended

8.1 Pattern recommended

8.2 Adapter cần build

  • ICD-10 VN → SNOMED (USAGI manual review)
  • Danh mục thuốc BYT → RxNorm
  • Danh mục DVKT → SNOMED procedure
  • Dân tộc 54 → Custom Vocabulary
  • BHYT type → Payer concept (Custom)

Đọc thêm OMOP cho VN — BHYT, HSDT, ICD-10 VN, dân tộc 54.

9. Pitfall mapping

  • ❌ MedicationRequest chưa filled → đừng đưa vào DRUG_EXPOSURE (nhầm với MedicationStatement = patient actually took)
  • ❌ Encounter status cancelled → bỏ qua khỏi VISIT
  • ❌ Observation not-done → không vào MEASUREMENT
  • ❌ FHIR có Subscription notification → KHÔNG đưa vào OMOP (operational only)
  • ❌ Provenance / AuditEvent → không map sang OMOP
  • ❌ Patient.identifier có nhiều → chọn 1 làm person_source_value (CCCD pseudonymized)
  • ❌ Mapping nhiều-1 (vd 3 MedicationAdministration trong 1 ngày) → cần group theo logic clinical

10. Validate bridge

Kiểm tra:

  • Số patient FHIR == số PERSON
  • Tổng Encounter == tổng VISIT_OCCURRENCE
  • Tổng Condition == tổng CONDITION_OCCURRENCE
  • DQD pass trên CDM mới
  • Sample 100 patient: trace forward (FHIR → OMOP) và backward

11. Pattern hỗn hợp

11. Pattern hỗn hợp

Tổ chức bắt đầu nhỏ, scale dần. Không nhất thiết build OMOP từ đầu — có thể dùng Pathling trong giai đoạn 1.

12. Tài liệu thêm

  • HL7 FHIR-to-OMOP Implementation Guide
  • Pathling docs: pathling.csiro.au
  • OMOP-on-FHIR Georgia Tech: github.com/Georgia-Tech-CSE
  • OHDSI Working Group "FHIR and OMOP"
  • SOF (SQL on FHIR) spec
  • VN: profile FHIR và mapping cộng đồng (đang phát triển)

Kết luận

FHIR + OMOP không phải lựa chọn — đó là pattern tiêu chuẩn 2026. Bridge tốt cho phép vận hành real-time và phân tích RWE đa nguồn cùng tổ chức. VN có cơ hội xây stack tích hợp ngay từ đầu, không cần legacy migration.

Bài tiếp: OMOP cho VN — BHYT, HSDT, ICD-10 VN, dân tộc 54.

DUY TRAN
Tác giả

DUY TRAN

Pursuing an AI-first mindset and intelligent system architecture. I build solutions by combining technology, creativity, and the ability to see structure in chaos — the foundation for becoming a Solution Architect.

Bình luận

Bài viết liên quan