Skip to contents

The find_children function is used to quickly find all the child codes of a parent code so a user does not need to type all child codes out manually. The TriNetX standardized_terminology table contains all definitions of parent and child code relationships.

Usage

find_children(
  database,
  code_list,
  only_children = FALSE,
  added = FALSE,
  code_desc = FALSE
)

Arguments

database

database name to use

code_list

user defined table with 3 mandatory columns:

  • feature - the feature the exact code will roll up to and name of the column in the output dataframe (letters, numbers, underscores only, no spaces, not case sensitive)

  • code - parent or child code

  • code_system - ICD-10-CM, RxNorm, etc

    • code_system rules:

      • patient: returns self (use month_year_death as the code value)

      • ICD-10-CM: returns children from ICD-10-CM and ICD-9-CM

      • ICD-9-CM: can only be a child, so returns itself

      • ICD-10-PCS: returns children from ICD-10-PCS and ICD-9-CM

      • CPT: returns children from CPT

      • HCPCS: returns children from HCPCS

      • SNOMEDCT_US: returns children from SNOMED

      • RxNorm: can only be a child, so returns self

      • VA: returns RxNorm children

      • ATC: returns RxNorm children

      • TNX: returns children of TNX rollups

      • LOINC: returns itself, parents are not supported (except for TNX labs)

      • Encounter Type: returns itself

  • optional columns

    • qualifier_num - the find_children function will populate the value within qualifier_num to all the children of that code

    • qualifier_text - the find_children function will populate the value within qualifier_text to all the children of that code

only_children

(optional argument)

  • if TRUE, returns only discovered child codes

  • if FALSE, returns all codes, including original input

  • FALSE by default

added

(optional argument)

  • if TRUE, the function returns an additional column named 'added' that is 0 if the code was present in the input and 1 if the code was not present in the input after find_children was run

  • if FALSE, does nothing

  • FALSE by default

code_desc

(optional argument)

  • if TRUE, the function returns an additional column named 'code_description' that populates the code_description value from the standardized_terminology table

  • if FALSE, does nothing

  • FALSE by default

Value

  • a code list table with all children, same structure as the code_list input table, but with all the children that relate to the code

  • populates the feature value to the children code rows

Details

get_children = find_children(database='covid_db', code_list=code_list, only_children=FALSE, added=TRUE)