CE11: Distribution of condition era end dates

This query is used to to provide summary statistics for condition era end dates (condition_era_end_date) across all condition era records: 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.


Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue
SELECT condition_concept_id
     , to_date( min( to_char( condition_era_end_date, 'J' ) ), 'J')
     , to_date( max( to_char( condition_era_end_date, 'J' ) ), 'J' )
     , to_date( round( avg( to_char( condition_era_end_date, 'J' ) ) ), 'J' )
     , round( stdDev( to_char( condition_era_end_date, 'J' ) ) ) AS std_dev_days
     , PERCENTILE_DISC(0.25) WITHIN GROUP( ORDER BY condition_era_end_date ) 
                                     AS percentile_25
     , PERCENTILE_DISC(0.5)  WITHIN GROUP (ORDER BY condition_era_end_date )
                                     AS median
     , PERCENTILE_DISC(0.75) WITHIN GROUP (ORDER BY condition_era_end_date )
                                     AS percential_75
  FROM condition_era
 WHERE condition_concept_id IN( 254761, 257011, 320128, 432867, 25297 )
 GROUP BY condition_concept_id;

Output field list:
 Field  Description
concept_name An unambiguous, meaningful and descriptive name for the concept
condition_concept_id A foreign key that refers to a standard condition concept identifier in the vocabulary.
condition_era_end_date The end date for the condition era constructed from the individual instances of condition occurrences. It is the end date of the final continuously recorded instance of the condition.
person_id A system-generated unique identifier for each person.

Sample output record:
 Field  Description