This query is used to count the persons with any number of eras of a certain condition (condition_concept_id). The input to the query is a value (or a comma-separated list of values) of a condition_concept_id. If the input is omitted, all possible values are summarized.
WITH parms as (select cid::integer as cid from unnest(regexp_split_to_array( nullif($1::text, '')::text, '\s*,\s*')) as cid)
SELECT ce.condition_concept_id, c.concept_name, COUNT(DISTINCT person_id)::integer AS num_people
FROM @cdm.condition_era ce
JOIN @vocab.concept c
ON c.concept_id = ce.condition_concept_id
WHERE ((select count(1) from parms) = 0 or ce.condition_concept_id in (select cid from parms) )
GROUP BY ce.condition_concept_id, c.concept_name
ORDER BY num_people DESC;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | list of condition_concept_id | 320128, 201826, 432867, 4051466 | No | |
| Field | Description | | --- | --- | | concept_name | An unambiguous, meaningful and descriptive name for the concept | | condition_concept_id | A foreign key that refers to a standard condition concept identifier in the vocabulary. | | num_people | |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.