ccf-tfehlmann / ibdplexus

This package helps wrangle the clinical data in IBD Plexus. IBD Plexus is a data exchange platform designed to accelerate research toward finding cures for Inflammatory Bowel Disease (IBD). To learn more please see https://www.crohnscolitisfoundation.org/research/current-research-initiatives/ibd-plexus.
12 stars 3 forks source link

ADMISSION_STATUS/ADMISSION_TYPE Required for sparc functions #5

Closed vzg100 closed 1 year ago

vzg100 commented 1 year ago

Hey I just wanted to say thanks for making the package, it makes the data a lot easier to process.

If ADMISSION_STATUS or ADMISSION_TYPE are not present in the sparc_summary.xlsx file you can't use the sparc_medication/sparc_scores/etc... functions. Maybe I'm blind but I don't see them in the SPARC_Summary_userguide_updated_102221.pdf file as well.

Is there a work around to this?

ccf-tfehlmann commented 1 year ago

I'm glad you are finding the package useful. the sparc_summary.xlsx file is the output of the sparc_summary function and will not work as the input for the sparc_medication or sparc_scores function - you will need the raw text files and load them into R using load_data().

vzg100 commented 1 year ago

Thank you for taking the time to responds, hopefully I'm just making a dumb mistake but I'm running the following commands:

library("tidyverse")

data <- load_data(datadir = "Path/to/SPARC/", cohort = "SPARC", domains = "ALL", data_type = "BOTH")
e_sum <- sparc_summary(
  data = data,
  index_info = "ENROLLMENT",
  filename = "SPARC_SUMMARY_ENROLLMENT.xlsx",
index_range = "60"
)`

Returns the following error: 
`Error in `left_join()`:
! Join columns in `x` must be present in the data.
✖ Problem with `ADMISSION_TYPE`.

The Path/to/SPARC/ points to a directory containing all my .txt files but I don't see ADMISSION_TYPE in any of them. Is that a column that should be requested for or is it assumed all data will have it?

ccf-tfehlmann commented 1 year ago

What is the date of your data extract?

vzg100 commented 1 year ago

I believe it was in 11/2022

ccf-tfehlmann commented 1 year ago

Sorry for all the back and forth but can you send me the first chunk of numbers in the text file name? Then I can track down the exact data you are using and recreate the issue on my end.

vzg100 commented 1 year ago

The first number is 20987 for one of the data pulls.

ccf-tfehlmann commented 1 year ago

I am not getting the same error but I have recently made some updates to the ibdplexus package that may help. Can you try reinstalling and running again?

vzg100 commented 1 year ago

Thank you for taking the time to try and reproduce the issue! Hopefully I'm just doing slightly wrong.

I've tried rerunning devtools::install_github("ccf-tfehlmann/ibdplexus") and restarting Rstudio but I'm still encountering the same error message when running

e_sum <- sparc_summary(
  data = data,
  index_info = "ENROLLMENT",
  filename = "SPARC_SUMMARY_ENROLLMENT.xlsx",
index_range = "60"
)

Given the point you raised about the date of the pull, would I need to repull a newer version of the data?

ccf-tfehlmann commented 1 year ago

If you do not see the column name admission type in the encounter or prescriptions table then yes please pull a newer version of the data.