inst/QueryLibrary/Aggregate/condition_era/CE09.md

CE09: Counts of condition record

Description

This query is used to count conditions (condition_concept_id) across all condition era records. 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.

Query

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(*) AS records_count
  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 records_count DESC;

Input

| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | list of condition_concept_id | 320128, 201826, 432867, 4051466 | No | |

Output

| 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. | | count | |

Documentation

https://github.com/OHDSI/CommonDataModel/wiki/



sib-swiss/dsQueryLibraryServer documentation built on Feb. 13, 2025, 8:07 p.m.