inst/QueryLibrary/Aggregate/condition_era/CE02.md

CE02: Age/gender of patients with condition

Description

List of patient counts of specific age and gender for specific medical condition :

Query

WITH hip_fracture AS (
SELECT DISTINCT ca.descendant_concept_id, c.concept_name as condition
  FROM @vocab.concept c
  JOIN @vocab.concept_ancestor ca
    ON ca.ancestor_concept_id = c.concept_id
 WHERE c.concept_name LIKE concat('%', lower($1::text), '%')
)
SELECT gender,
       age,
       condition,
       COUNT(*)::integer AS num_patients
  FROM (
SELECT DISTINCT p.person_id,
                c.concept_name  AS gender,
                DATE_PART('year',ce.condition_era_start_date) - p.year_of_birth AS age,
                condition
  FROM @cdm.condition_era ce
  JOIN hip_fracture hf  
    ON hf.descendant_concept_id = ce.condition_concept_id
  JOIN @cdm.person p
    ON p.person_id = ce.person_id
  JOIN @vocab.concept c
    ON c.concept_id = p.gender_concept_id
       ) TMP
 GROUP BY gender, age, condition
 ORDER BY condition, gender, age;

Input

| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | concept_name | Closed fracture of hip | Yes | Concept ID=4230399 |

Output

| Field | Description | | --- | --- | | gender | Patients gender, i.e. MALE, FEMALE | | age | Age group | | num_patients | Number of patients for specific gender and age and selected condition |

Example output record

| Field | Description | | --- | --- | | gender | FEMALE | | age | 16 | | num_patients | 22 |

Documentation

https://github.com/OHDSI/CommonDataModel/wiki/

Sensitive fields

num_patients



sib-swiss/dsQueryLibraryServer documentation built on Feb. 13, 2025, 8:07 p.m.