CO23: Distribution of condition occurrence start dates, stratified by condition

This query is used to summary statistics of the condition start dates (condition_start_date) across all condition occurrence records, stratified by condition (condition_concept_id): the mean, the standard deviation, the minimum, the 25th percentile, the median, the 75th percentile, the maximum and the number of missing values. The input to the query is a value (or a comma-separated list of values) of a condition_concept_id. If the input is ommitted, all possible values are summarized.

Input:
 Parameter  Example  Mandatory  Notes
condition_concept_id  293379 No Diabetic Nephropathy

Sample query run:
The following is a sample run of the query to run a search for specific condition concept ID. The input parameters are highlighted in blue.

        -- Per date
select condition_concept_id, concept_name, condition_start_date, count(*)
from mslr_cdm4.condition_occurrence, vocabulary.concept
where condition_occurrence.condition_concept_id=concept.concept_id
and condition_concept_id in (293379)
group by condition_concept_id, concept_name, condition_start_date
order by condition_start_date;
      --Per month
select condition_concept_id, concept_name,condition_month, count_occur from (
select condition_concept_id, concept_name, to_char(date_trunc('month',condition_start_date),'MM-YYYY') as condition_month, date_trunc('month',condition_start_date) as m1, count(*) count_occur
from mslr_cdm4.condition_occurrence, vocabulary.concept
where condition_occurrence.condition_concept_id=concept.concept_id and condition_concept_id in (293379)
group by condition_concept_id, concept_name, condition_month, m1
order by m1);

Output:
Output field list:
 Field  Description
???????? ????????????????
????????????????

Sample output record:
 Field  Value
???????? ????????
????????????????
Comments