Learn R Programming

LABTNSCPSS (version 1.0.2)

chronic_pathologies: Carry-forward chronic ICD codes and build updated episode-level ICD history

Description

This function assigns chronic categories to ICD codes, propagates chronic conditions forward in time (category 2 indefinitely; category 1 within 1 year), adds basal codes, and writes an updated episode file with `updated_icd_codes`.

Usage

chronic_pathologies(
  file_path_main,
  updated_path = NULL,
  coding_system = c("ICD-10-CA", "ICD-10-CM", "ICD-11")
)

Value

The output path (`updated_path`).

Arguments

file_path_main

Path to cleaned episode-level CSV (must include patient_id, episode_id, start_date, ICD).

updated_path

Output CSV path. If NULL, a temp file is created.

coding_system

One of "ICD-10-CA", "ICD-10-CM", "ICD-11".