Drug Era‎ > ‎

DER06: For a given class, what proportion of patients take each treatment in the class?



Input:
 Parameter  Example  Mandatory  Notes
ancestor_concept_id 4324992 Yes Antithrombins

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

select tt.concept_id, tt.concept_name, 100*(tt.cntPersons*1.0/tt.total*1.0) as proportion_count from (
select c.concept_id, c.concept_name, t.cntPersons, sum(cntPersons) over() as total 
from vocabulary.concept c, 
(select r.drug_concept_id, count(distinct r.person_id) as cntPersons 
        FROM vocabulary.concept_ancestor ca,
             drug_era r
        WHERE ca.ancestor_concept_id = 4324992
          AND r.drug_concept_id = ca.descendant_concept_id
        group by r.drug_concept_id
) t
where t.drug_concept_id = c.concept_id
) tt
;
Output:
Output field list:
 Field  Description
drug_era_id A system-generated unique identifier for each drug era.
person_id A foreign key identifier to the person who is subjected to the drug during the drug era. The demographic details of that person are stored in the person table.
drug_concept_id A foreign key that refers to a standard concept identifier in the vocabulary for the drug concept.
count The number of individual drug exposure occurrences used to construct the drug era.
descendant_concept_id A foreign key to the concept code in the concept table for the lower-level concept that forms the descendant in the relationship.
ancestor_concept_id A foreign key to the concept code in the concept table for the higher-level concept that forms the ancestor in the relationship.

Sample output record:
 Field  Description
drug_era_id
person_id
drug_concept_id
count
descendant_concept_id
ancestor_concept_id
Comments