This is a new function calculates the CIHI frailty scores using diagnoses codes.
Important note for review:
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.
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.
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.
Unit tests are added to this new function. The dummy_diag() function in dummy_data.R to generate test cases.
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.
Closes #31
This is a new function calculates the CIHI frailty scores using diagnoses codes.
Important note for review:
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 betweenmapping_cihi_hfrs_icd
and the original file could be reviewed.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.
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.
Unit tests are added to this new function. The
dummy_diag()
function indummy_data.R
to generate test cases.This PR includes a minor edit to the
coerce_to_datatable()
function inutils.R
. A line separator is added to its warning message for cleaner display of multiple warning messages.