inst/QueryLibrary/Aggregate/condition_era/CE06.md

CE06: Conditions most likely to result in death

Description

| Most prevalent conditions within a number of days of death

Query

The following is a sample run of the query. The input parameters are highlighted in blue

SELECT concept_name, COUNT(*)::integer as conditions_count
FROM  (
SELECT d.person_id, c.concept_name
  FROM @cdm.death d
  JOIN @cdm.condition_era ce
    ON ce.person_id = d.person_id
   AND (d.death_date - ce.condition_era_end_date) <= COALESCE(CAST(NULLIF($1, '') AS numeric), 30)
  JOIN @vocab.concept c
    ON c.concept_id = ce.condition_concept_id
       ) TMP
GROUP BY concept_name
ORDER BY conditions_count DESC;

Input

| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | Number of days since condition era end | 30 | No | |

Output

| Field | Description | | --- | --- | | concept_name | An unambiguous, meaningful and descriptive name for the concept | | count | | | condition_concept_id | A foreign key that refers to a standard condition concept identifier in the vocabulary. |

Documentation

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



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