Drug Exposure‎ > ‎

DEX07: Maximum number of drug exposure events per person over some time period

This query is to determine the maximum number of drug exposures that is recorded for a patient during a certain time period. If the time period is omitted, the entire time span of the database is considered. Instead of maximum, the query can be easily changed to obtained the average or the median number of drug records for all patients. See vocabulary queries for obtaining valid drug_concept_id values.

Input:
 Parameter  Example  Mandatory  Notes
date from
01-Jan-2008 Yes

date to31-Dec-2008Yes 

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

SELECT MAX ( exposures ) as exposures_count
  FROM -- person, drug exposures over a year
     ( SELECT person_id, COUNT(*) as exposures
         FROM drug_exposure
        WHERE drug_exposure_start_date BETWEEN '01-Jan-2008' AND '31-Dec-2008'
        GROUP BY person_id
     );


Output:
Output field list:
 Field  Description
exposures_count
The number of drug exposure records for the patient with the maximum number of such records.

Sample output record:
 Field  Description
exposures_count
1137
Comments