OHDSI Home | Forums | Wiki | Github

How can I do a full mapping from MIMIC II to OMOP CDM

I am currently using https://github.com/shamsbayzid/mimic-cdm as a base for performing a full mapping from the MIMIC II database to the OMOP CDM. Is there any good way to either automate or make the process easier for finding source concept ids and the standard concepts that they map to?

e.g. In the condition_occurence table I want to transform the 0 concepts that are used as place holders currently into their actual ids in the condition_source_concept_id and condition_concept_id

I am currently using the concept table to reverse look up the ids that correspond to the source values and then utilizing the concept_relationship table to find if these ids have any “Maps to” relationships associated to them with a concept_id_2 of a standard concept.

OR has this already been done by anyone?

Also what would be some example queries for the OMOP mapped data for example: Find me all patients that have taken the drug Warfarin in the past 20 days

See a related issue here

ad one of your question:
in CDM repo (code excerpts) (
https://github.com/OHDSI/CommonDataModel/tree/master/CodeExcerpts ) we hope to some day post the code that does this in phases.

Here was our scheme

phase 0
make source’s source values fit into X_source_value columns in OMOP CDM

phase 1 (using athena (concept table)
assume source values are nice - infer correct concept_id into X_source_concept_id

phase 2 (using athena again (concept relationships)
assume simple mapping, infer correct X_concept_id fields from X_source_concept_id

And a little code snippet (not perfect) but just note the two joins to the concept table.

insert into [OHDSI].[dbo].[condition_occurrence]
(condition_occurrence_id,person_id, condition_concept_id,  condition_start_date,condition_type_concept_id,provider_id, condition_source_value,condition_source_concept_id 
)
SELECT  --top 1000 
-- person_id, s.*,isnull(cr.concept_id_2,0)
condition_occurrence_id,person_id
,isnull(cr.concept_id_2,0) as condition_concept_id
,condition_start_date
,0 as condition_type_concept_id
,provider_id,condition_source_value,condition_source_concept_id
from --table below is phase 1, map icd9 into source value  (and phase 0 rename fields per OMOP)
(select
    patient_id as condition_occurrence_id,
    [PATIENT_ID] as person_id,
    isnull(c.CONCEPT_ID,0) as condition_source_concept_id
          ,[SERVICE_DATE] as condition_start_date               
    --      ,[DIAGNOSIS_CODE] as condition_source_value
          ,DIAGNOSIS_CODE as condition_source_value
          ,[PHYSICIAN_ID] as provider_id
    	--  , 0 as condition_type_concept_id
      FROM DC_DX_TBL
      left join concept c on DIAGNOSIS_CODE = c.concept_code
) s
left join concept_relationship cr on s.condition_source_concept_id = cr.concept_id_1
                --AND cr.invalid_reason IS NULL
                AND cr.relationship_id = 'Maps To'
;
t