Drug Era‎ > ‎

DER07: What is the average time between eras for a given ingredient? ex. steroids for RA



Input:
 Parameter  Example  Mandatory  Notes
drug_concept_id 1304643 Yes darbepoetin alfa

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

select avg(t.next_era_start - t.drug_era_end_date) as num_days
from (
select 
                   r.drug_era_end_date        ,
                   lead(r.drug_era_start_date) over(partition by r.person_id, r.drug_concept_id order by r.drug_era_start_date) 
                   as next_era_start
from drug_era r
where r.drug_concept_id = 1304643
) t
where t.next_era_start is not null
Output:
Output field list:
 Field  Description
next_era_start
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.
drug_era_end_date The end date for the drug era constructed from the individual instance of drug exposures. It is the end date of the final continuously recorded instance of utilization of a drug.
drug_era_start_date 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.

Sample output record:
 Field  Description
next_era_start
person_id
drug_concept_id
count
drug_era_end_date
drug_era_start_date
Comments