CO23: Distribution of condition occurrence month/year, stratified by condition

This query is used to summary statistics of the condition month/year start dates across all condition occurrence records, stratified by condition (condition_concept_id).  The input to the query is a value  of a condition_concept_id.

Input:
 Parameter  Example  Mandatory  Notes
condition_concept_id 192279 Yes Condition concept identifier for 'Diabetic Nephropathy'

Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue
SELECT condition_concept_id, 
       concept_name,
       condition_month_year, 
       count_occur AS occurrences_count
FROM (
SELECT condition_concept_id, 
       concept_name, 
       to_char(date_trunc('month',condition_start_date),'MM-YYYY') AS condition_month_year,
       date_trunc('month',condition_start_date) AS m1, 
       count(*) AS count_occur
FROM condition_occurrence, vocabulary.concept
WHERE condition_occurrence.condition_concept_id=concept.concept_id
AND condition_concept_id = 192279
GROUP BY condition_concept_id, concept_name, condition_month_year, m1
ORDER BY m1)
Output:
Output field list:
 Field  Description
condition_concept_id Concept identifier for condition
condition_name Meaningful and descriptive name for the concept.
condition_month_year The month/year when the instance of the condition is recorded.
occurrences_count  Number of condition occurrences

Sample output record:
 Field  Description
condition_concept_id  192279
condition_name  Diabetic nephropathy
condition_month_year  05-2004
occurrences_count  348
Comments