List of patient counts of specific age and gender for specific medical condition :
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;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | concept_name | Closed fracture of hip | Yes | Concept ID=4230399 |
| 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 |
| Field | Description | | --- | --- | | gender | FEMALE | | age | 16 | | num_patients | 22 |
https://github.com/OHDSI/CommonDataModel/wiki/
num_patients
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.