inst/QueryLibrary/Aggregate/general/G11.md

G11: Find children for a given concept

Description

This query lists all standard vocabulary concepts that are child concepts of a given concept entered as input. The query accepts a concept ID as the input and returns all concepts that are its immediate child concepts.

The query returns only the immediate child concepts that are directly linked to the input concept and not all descendants.

Query

SELECT
  d.concept_id       AS child_concept_id,
  d.concept_name     AS child_concept_name,
  d.concept_code     AS child_concept_code,
  d.concept_class_id AS child_concept_class_id,
  d.vocabulary_id    AS child_concept_vocab_id
FROM @vocab.concept_ancestor AS ca
  JOIN @vocab.concept AS d ON ca.descendant_concept_id = d.concept_id
WHERE
  ca.min_levels_of_separation = 1 AND
  ca.ancestor_concept_id = $1 AND
  d.invalid_reason IS NULL
;

Input

| Parameter | Example | Mandatory | Notes | | ---------- | ------- | --------- | --------------------------- | | Concept ID | 192671 | Yes | Gastrointestinal hemorrhage |

Output

| Field | Description | | ---------------------- | ------------------------------------------------------ | | Child_Concept_ID | Concept ID of child concept entered as input | | Child_Concept_Name | Name of child concept entered as input | | Child_Concept_Code | Concept Code of child concept entered as input | | Child_Concept_Class | Concept Class of child concept entered as input | | Child_Concept_Vocab_ID | ID of the vocabulary the child concept is derived from |

Example output record

| Field | Value | | ----------------------- | --------------------------------- | | Child_Concept_ID | 4291649 | | Child_Concept_Name | Upper gastrointestinal hemorrhage | | Child_Concept_Code | 37372002 | | Child_Concept_Class | Clinical finding | | Child_Concept_Vocab_ID | SNOMED |

Documentation

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



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