Drug Era‎ > ‎

DER03: What is the number of distinct ingredients per patient?

Two versions:
 1) number of distinct ingredients per given patient;
 2) average number of distinct ingredients for all patients.

Input:
 Parameter  Example  Mandatory  Notes
person_id 101 Yes

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

--1) 
SELECT count(distinct r.drug_concept_id)
FROM drug_era r 
WHERE r.person_id = 101--&person_id;
--2) 
SELECT avg(cnt) from 
(select count(distinct r.drug_concept_id) cnt, r.person_id
FROM drug_era r 
GROUP BY r.person_id )
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.

Sample output record:
 Field  Description
drug_era_id
person_id
drug_concept_id
count
Comments