Calculate among the people who take a drug from a given class, how many take another given drug class at the same time.
The following is a sample run of the query. The input parameters are highlighted in blue S
WITH statins AS (
SELECT descendant_concept_id AS concept_id
FROM @vocab.concept_ancestor
WHERE ancestor_concept_id = 1539403
), diuretics AS (
SELECT descendant_concept_id AS concept_id
FROM @vocab.concept_ancestor
WHERE ancestor_concept_id = 974166
)
SELECT COUNT(DISTINCT de1.person_id) AS num_users,
COUNT(DISTINCT de2.person_id) AS also_bp
FROM @cdm.drug_exposure de1
JOIN statins s
ON de1.drug_concept_id = s.concept_id
JOIN @cdm.drug_exposure de2
ON de1.person_id = de2.person_id
LEFT JOIN diuretics d
ON de2.drug_concept_id = d.concept_id
AND de2.drug_exposure_start_date < de1.drug_exposure_end_date
AND de2.drug_exposure_end_date > de1.drug_exposure_start_date;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | ancestor_concept_id | 1539403 | Yes | Statins | | ancestor_concept_id | 974166 | Yes | Diuretics |
| Field | Description | | --- | --- | | num_users | The number of users of statins. | | also_bp | The number of users that also use diuretics. |
| Field | Description | | --- | --- | | num_users | 5484 | | also_bp | 1577 |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.