Drug Exposure‎ > ‎

DEX21: How many people have a diagnosis of a contraindication for the drug they are taking?



Input:
 Parameter  Example  Mandatory  Notes
     

Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue

SELECT count(distinct d.person_id)
from drug_exposure d,
     condition_occurrence c,
     vocabulary.concept_relationship r1,
     vocabulary.concept_relationship r2
where d.person_id = c.person_id
  and d.drug_exposure_start_date >= c.condition_start_date    
  and r1.concept_id_1 = d.drug_concept_id and r1.relationship_id = 129
  and r2.concept_id_1 = r1.concept_id_2 
  and r2.concept_id_2 = c.condition_concept_id and r2.relationship_id = 247
;
Output:
Output field list:
 Field  Description
person_id A system-generated unique identifier for each person.
concept_relationship The date when the instance of the relationship is first recorded.
drug_exposure_start_date The start date for the current instance of drug utilization. Valid entries include a start date of a prescription, the date a prescription was filled, or the date on which a drug administration procedure was recorded.
condition_start_date The date when the instance of the condition is recorded.
concept_id_1 A foreign key to the concept in the concept table associated with the relationship. Relationships are directional, and this field represents the source concept designation.
concept_id_2 A foreign key to the concept in the concept table associated with the relationship. Relationships are directional, and this field represents the destination concept designation.

Sample output record:
 Field  Description
person_id  
concept_relationship  
drug_exposure_start_date  
condition_start_date  
concept_id_1  
concept_id_2  
Comments