Drug Era‎ > ‎

DER24: Distribution of drug exposure counts, stratified by drug type

This query is used to provide summary statistics for drug exposure counts (drug_exposure_count) across all drug era records, stratified by drug type (drug_type_concept_id): the mean, the standard deviation, the minimum, the 25th percentile, the median, the 75th percentile, the maximum and the number of missing values as well as the total count. The input to the query is a value (or a comma-separated list of values) of a drug_type_concept_id . If the input is omitted, all possible values are summarized.

Input:
 Parameter  Example  Mandatory  Notes
drug_type_concept_id 38000182 Yes

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

-- Oracle
SELECT    tt.drug_type_concept_id
                 , count(1) as total_Cnt
                 , min(tt.stat_value) AS min_value
                 , max(tt.stat_value) AS max_value
                 , avg(tt.stat_value) AS avg_value
                 , (round(stdDev(tt.stat_value)) ) AS stdDev_value
                 , PERCENTILE_DISC(0.25) WITHIN GROUP( ORDER BY tt.stat_value ) 
                 AS percentile_25
                 , PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY tt.stat_value )
                 AS median_value
                 , PERCENTILE_DISC(0.75) WITHIN GROUP (ORDER BY tt.stat_value )
                 AS percential_75
FROM
                 ( SELECT 
                 t.drug_exposure_count as stat_value,
                 t.drug_type_concept_id
FROM       drug_era t
                 where t.drug_type_concept_id = 3800018238000182) tt 
GROUP BY tt.drug_type_concept_id 
ORDER BY tt.drug_type_concept_id 
;
Output:
Output field list:
 Field  Description
drug_type_concept_id A foreign key to the predefined concept identifier in the vocabulary reflecting the parameters used to construct the drug era.
drug_exposure_count The number of individual drug exposure occurrences used to construct the drug era.
avg_value The start date for the drug era constructed from the individual instances of drug exposures. It is the start date of the very first chronologically recorded instance of utilization of a drug.
percentile_25     
median_value     
percentile_75     

Sample output record:
 Field  Description
drug_type_concept_id
drug_exposure_count
avg_value
percentile_25     
median_value     
percentile_75     
Comments