This query is used to count all genders (gender concept_id), stratified by drug (drug_concept_id). The input to the query is a value (or a comma-separated list of values) of a drug_concept_id. If the input is ommitted, all existing value combinations are summarized.
WITH parms as (select cid as cid from unnest(regexp_split_to_array( nullif($1::text, '')::text, '\s*,\s*')) as cid)
SELECT p.gender_concept_id, count(1)::integer AS stat_value, t.drug_concept_id
FROM @cdm.drug_era t, @cdm.person p
WHERE ((select count(1) from parms) = 0 or t.drug_concept_id IN (select cid::integer from parms))
AND p.person_id = t.person_id
GROUP BY t.drug_concept_id, p.gender_concept_id
ORDER BY t.drug_concept_id, p.gender_concept_id;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | list of drug_concept_id | 1300978, 1304643, 1549080 | Yes | |
| Field | Description | | --- | --- | | gender_concept_id | | | stat_valu | | | drug_concept_id | |
| Field | Description | | --- | --- | | gender_concept_id | 8507 | | stat_value | 60 | | drug_concept_id | 1300978 |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.