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

76 datetime inputs #132

Closed loffleraSMH closed 3 months ago

loffleraSMH commented 4 months ago

Closes #76

Main changes

For a few functions, I made some additional changes:

Here is an example for how to test the code for length_of_stay():

ipadmdad <- dbGetQuery(db, "select * from admdad LIMIT 100") %>% data.table() 

# pre-process date-times prior to running length_of_stay (would break old version but should work with new version)
ipadmdad[, discharge_date_time := ymd_hm(discharge_date_time)]
ipadmdad[, admission_date_time := ymd_hm(admission_date_time)]
# introduce some missing date-times (should be shown in warning message when calling new version of length_of_stay
ipadmdad[1:10, discharge_date_time := NA]

# source relevant functions
source('H:/GitHub/Rgemini/R/length_of_stay.R')
source('H:/GitHub/Rgemini/R/utils.R')

los <- length_of_stay(ipadmdad)
loffleraSMH commented 4 months ago

Thanks so much for the review and the helpful feedback @guoyi-smh! I fixed the bug and implemented your other suggestions. Let me know if there are any other changes you'd like me to make.

guoyi-smh commented 3 months ago

Hi @loffleraSMH , all the updates look good. I have resolved all the comments. Please feel free to go ahead and merge the branch.