CE12: Distribution of condition era start dates

This query is used to to provide summary statistics for condition era start dates (condition_era_start_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_start_date, 'J' ) ), 'J')
     , to_date( max( to_char( condition_era_start_date, 'J' ) ), 'J' )
     , to_date( round( avg( to_char( condition_era_start_date, 'J' ) ) ), 'J' )
     , round( stdDev( to_char( condition_era_start_date, 'J' ) ) ) AS std_dev_days
     , PERCENTILE_DISC(0.25) WITHIN GROUP( ORDER BY condition_era_start_date ) 
                                     AS percentile_25
     , PERCENTILE_DISC(0.5)  WITHIN GROUP (ORDER BY condition_era_start_date )
                                     AS median
     , PERCENTILE_DISC(0.75) WITHIN GROUP (ORDER BY condition_era_start_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_start_date The start date for the condition era constructed from the individual instances of condition occurrences. It is the start date of the very first chronologically recorded instance of the condition.

Sample output record:
 Field  Description