FHIR to OMOP FHIR IG 內容摘要/讀書心得 === [FHIR to OMOP FHIR IG](https://build.fhir.org/ig/HL7/fhir-omop-ig/)主要說明如何將醫療資料從FHIR轉換為OMOP CDM,這個標準定義了FHIR Resource與OMOP Table間的映射,目前著重在常見的電子病歷資料。屬於VULCAN的一個加速計畫:[FHIR to OMOP](https://hl7vulcan.org/projects/fhir-to-omop/),目前只有一個版本於2025-07-29公布,算起來是一個非常新的計畫。IG所對應的版本為FHIR 5.0與OMOP CDM v5.4。 主要產出包含兩部分:Logical Models與Structure Maps;將OMOP CDM Table對應到FHIR Logical Model,StructureMaps則是將FHIR Resource映射到所對應的Logical Model。舉例來說,FHIR Patient Resource會對應到OMOP CDM Person。 首先,IG定義Person OMOP Table(Logical Model)如下: ![FHIR2OMOP-1](https://hackmd.io/_uploads/rkZMsxsgbg.png) 如果對照OMOP CDM的架構可以發現,他是將OMOP CDM Person Table直接對應;也就是說,單一Table對應到單一Logical Model,欄位名稱、資料格式等保持不變。因此,重點會是放在如何將FHIR Resource轉換為FHIR Logical Model。 轉換所使用的技術為[FHIR Mapping Language](https://www.devdays.com/wp-content/uploads/2021/12/Lets-Build-FHIR-Mapping-Language-DevDays-2020-Virtual.pdf),可參考[Resource StructureMap](https://www.hl7.org/fhir/R4/structuremap.html) IG的產出為多個StructureMap,再以Patient/Person為例,主要內容如下: ``` /// url = 'http://hl7.org/fhir/uv/omop/StructureMap/PersonMap' /// name = 'PersonMap' /// title = 'Mapping Patient resource to Person OMOP Domain' /// status = 'draft' uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Person" alias PersonTable as target group Person(source src : Patient, target tgt : PersonTable) { src.gender as gender -> tgt.gender_concept_id = gender, tgt.gender_source_value = cast(gender, 'string'); // src.id as id -> tgt.person_id = cast(id, "integer"); src.birthDate as bdSrc -> tgt.birth_datetime = bdSrc, tgt.year_of_birth = (src.birthDate.toString().substring(0, 4)), tgt.month_of_birth = (src.birthDate.toString().substring(5, 2)), tgt.day_of_birth = (src.birthDate.toString().substring(8, 2)); } ``` uses表示資料來源為Patient(FHIR Resource),而轉換的目標是Person(FHIR Logical Model),並針對gender_concept_id、gender_source_value、birth_datetime、year_of_birth、month_of_birth、day_of_birth等欄位根據Patient內容解析後取得相關內容。 如果參考官方內容會發現IG所定義的內容跟實際作業還有一段很遙遠的距離,不過這樣的方向卻是提供了一個我們可以發展的方向,就是結合Logical Model與FHIR Mapping Language兩個技術,我們就可以發展相關的轉換技術,例如可以使用TW Core為Source來發展相關ConceptMap。 醫療資料轉換通常需要處理兩種問題:欄位對應與代碼對應。StructureMap針對的是欄位對應,在FHIR to OMOP FHIR IG中則是對代碼對應,做原則性的規範。 ![FHIR2OMOP-2](https://hackmd.io/_uploads/H168k8ogZe.png) 同時也說明FHIR規範中,與代碼相關的資料型態:code與CodeableConcept如何與OMOP CDM的對應方式,最後則是說明如何從FHIR資料內容對應到OMOP CDM的Concept對應流程。