Drug Exposure‎ > ‎

DEX29: Distribution of number of distinct drugs persons take

This query is used to provide summary statistics for the number of number of different distinct drugs (drug_concept_id) of all exposed persons: the mean, the standard deviation, the minimum, the 25th percentile, the median, the 75th percentile, the maximum and the number of missing values. No input is required for this query.

Input:
<None>

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

-- Oracle
SELECT 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 count(distinct t.drug_concept_id)  AS stat_value
      FROM drug_exposure t 
      where nvl(t.drug_concept_id, 0) > 0
      group by t.person_id
    ) tt 
;
Output:
Output field list:
 Field  Description
drug_concept_id A foreign key that refers to a standard concept identifier in the vocabulary for the drug concept.
person_id A foreign key identifier to the person who is subjected to the drug. The demographic details of that person are stored in the person table.
percentile_25  
median_value  
percential_75  

Sample output record:
 Field  Description
drug_concept_id  
person_id  
percentile_25  
median_value  
percentile_75  
Comments