Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: More verbose/detailed error message when incorrect datasets are fed into process_cut #180

Open
manciniedoardo opened this issue Jul 13, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@manciniedoardo
Copy link

Feature Idea

If I call process_cut like so:

cut_data <- process_cut(
  source_sdtm_data = source_data,
  patient_cut_v = c( "ds"),
  date_cut_m = rbind(
    c("ae", "AESTDTC"),
    c("ec", "ECSTDTC"),
    c("vs", "VSDTC")
  ),
  no_cut_v = c("ta", "td", "te", "ti"),
  dataset_cut = dcut,
  cut_var = DCUTDTM,
  special_dm = TRUE
)

but source_data doesn't contain exactly the domains "ae", "ec","vs","ds","ta", "td", "te", "ti" that are specified within my call, I get the following error:

Error: Inconsistency between input SDTMv datasets and the SDTMv datasets
listed under each cut approach. Please check for the two likely issues below... 

1) There are input SDTMv datasets where no cut method has been defined.
2) A cut method has been defined for a SDTMv dataset that does not exist in the
source SDTMv data.

when really I'd want the function to tell me which datasets are mismatching.

Relevant Input

No response

Relevant Output

No response

Reproducible Example/Pseudo Code

No response

@manciniedoardo manciniedoardo added the enhancement New feature or request label Jul 13, 2023
@reesnj
Copy link
Collaborator

reesnj commented Mar 6, 2024

Proposed Solution:

  • Create a new vector which appends together patient_cut_v, no_cut_v and column 1 of date_cut_m. Let's call this cut_inputs for future reference.
  • If special_dm = TRUE, append "dm" to cut_inputs for below checks.
  • Extract the names of each SDTMv dataframe from source_sdtm_data and store as a vector.
  • Loop through each dataframe of source_sdtm_data and check that each dataframe name only appears once. If fails, error message would say "Error: dataframe name appears more than once in source_sdtm_data."
  • Loop through each dataframe of source_sdtm_data and check that each dataframe appears in cut_inputs. If fails, error message would say "Error: dataframe name appears in source_sdtm_data but no cut method has been assigned."
  • Loop through each dataframe of cut_inputs and check that each dataframe name only appears once. If fails, error message would say "Error: Multiple cut types have been assigned for dataframe name."
  • Loop through each dataframe of cut_inputs and check that each dataframe appears in source_sdtm_data. If fails, error message would say "Error: Cut types have been assigned for dataframe name which does not exist in source_sdtm_data."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

2 participants