List of patient counts of specific age and gender for specific medical condition
The following is a sample run of the query. The input parameters are highlighted in blue
WITH hip_fracture AS (
SELECT DISTINCT ca.descendant_concept_id
FROM @vocab.concept c
JOIN @vocab.concept_ancestor ca
ON ca.ancestor_concept_id = c.concept_id
WHERE c.concept_code = '359817006'
)
SELECT gender,
age,
COUNT(*) AS num_patients
FROM (
SELECT DISTINCT p.person_id,
c.concept_name AS gender,
YEAR(ce.condition_era_start_date) - p.year_of_birth AS age
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
ORDER BY 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 | The year of birth of the person. For data sources with date of birth, the year is extracted. For data sources where the year of birth is not available, the approximate year of birth is derived based on any age group categorization available. | | 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/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.