Skip to content

Commit

Permalink
Added prelim drug exposure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Klann (Partners) committed May 10, 2017
1 parent 9422ff4 commit 2cdfbb5
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dev/add_omop_codes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ insert into i2o_mapping(omop_sourcecode,concept_id,domain_id)
select omop_sourcecode, c2.concept_id,c2.domain_id
from pcornet_proc d inner join concept c1 on c1.concept_id=d.OMOP_SOURCECODE
inner join concept_relationship cr ON c1.concept_id = cr.concept_id_1 and cr.relationship_id = 'Maps to'
inner join conceptc2 ON c2.concept_id =cr.concept_id_2
inner join concept c2 ON c2.concept_id =cr.concept_id_2
and c2.standard_concept ='S'
and c2.invalid_reason is null
and c2.domain_id='Procedure'
Expand Down Expand Up @@ -107,8 +107,27 @@ on concept_code=p.i_loinc
where
c.domain_id='Measurement'

-- Add source code for drug expose
update p set omop_sourcecode=concept_id
from pcornet_med p inner join concept as c
on concept_code=pcori_cui
where
c.domain_id='Drug'

-- New way: Add to mapping table for Drug
insert into i2o_mapping(omop_sourcecode,concept_id,domain_id)
select omop_sourcecode, c2.concept_id,c2.domain_id
from pcornet_med d inner join concept c1 on c1.concept_id=d.OMOP_SOURCECODE
inner join concept_relationship cr ON c1.concept_id = cr.concept_id_1 and cr.relationship_id = 'Maps to'
inner join concept c2 ON c2.concept_id =cr.concept_id_2
and c2.standard_concept ='S'
and c2.invalid_reason is null
and c2.domain_id='Drug'

--- WORKSPACE -----
select * from i2o_mapping where domain_id='Drug'


--- WORKSPACE ------
select c.concept_name,c2.concept_name
from concept as c
inner join concept_relationship r on c.concept_id =r.concept_id_1
Expand Down

0 comments on commit 2cdfbb5

Please # to comment.