GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

#31 cihi frailty score #54

Closed gemini-wenb closed 8 months ago

gemini-wenb commented 9 months ago

Closes #31

This is a new function calculates the CIHI frailty scores using diagnoses codes.

Important note for review:

  1. A new mapping data file mapping_cihi_hfrs_icd is saved to the /data folder. To test this function, reviewer will need to re-install the package from branch (pak::pkg_install("GEMINI-Medicine/Rgemini@31_cihi_frailty_score")) to allow function to load the mapping file. This file maps 595 ICD-10-CA codes to 36 frailty categories, and it was manually converted to .rda format from the original PDF file of Table A1 in CIHI HFRS. Consistency between mapping_cihi_hfrs_icd and the original file could be reviewed.

  2. Score calculation adheres to CIHI definition with a few adaptations for GEMINI data. The function documentation describes these adaptations. It'd be beneficial to review function documentation first for understanding of logics in the function.

  3. Function checks qualifications for frailty calculation. Encounters not qualified are dropped from returned table. Warnings messages are returned detailing size of the removal for user's information.

  4. Unit tests are added to this new function. The dummy_diag() function in dummy_data.R to generate test cases.

  5. This PR includes a minor edit to the coerce_to_datatable() function in utils.R. A line separator is added to its warning message for cleaner display of multiple warning messages.