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

Adds function to calculate Elixhauser comorbidity index #48

Closed vaakesan-SMH closed 8 months ago

vaakesan-SMH commented 9 months ago

Closes #4.

This requires some refactoring of the comorbidity calculations so that each of charlson and elixhauser are simple wrappers. Otherwise, documentation is shared as much as possible.

Small edit to the .Rproj file to force redocumentation on package build.

vaakesan-SMH commented 8 months ago

One question I am curious: when an encounter is present in the ipdiag or erdiag table, but by the HMSR definition does not have any diagnosis_at_admission, in current version the encounter is excluded from the output when at_admission = TRUE, which would make them the same as those without any diagnosis data. Is this the desired results or should they be included and get 0 for their comorbidity index?

That's a good point about the difference between NA and 0. I agree with you that these admissions should probably be 0. I've pushed a commit to fix this. Could you please re-review?

vaakesan-SMH commented 8 months ago

If we decide to output 0 on index at admission for cases with diagnosis data but no diagnosis_at_admission, to be consistent when raw_comorbidities = T the raw comorbidities should include these patients and output 0 for them as well?

That is a good point, I will make this fix.

vaakesan-SMH commented 8 months ago

If we decide to output 0 on index at admission for cases with diagnosis data but no diagnosis_at_admission, to be consistent when raw_comorbidities = T the raw comorbidities should include these patients and output 0 for them as well?

@guoyi-smh, I've made the change to output 0 for raw comorbidities when no diagnoses at admission are present. Please review and let me know what you think.