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

Encapsulate settings for default argument values and overrides based on CMA #63

Open
Masswear opened this issue Jan 29, 2019 · 1 comment

Comments

@Masswear
Copy link
Collaborator

For CMA_per_episode and CMA_sliding_windows (and most likely CMA_polypharmacy), the code for CMA-specific arguments is duplicated. This makes maintenance harder and can be a risk if new CMAs with specific default arguments are added.

A generic function that returns a list of arguments based on CMA , e.g.

# function that generates CMA-specific arguments
default.arguments <- function(CMA.to.apply){
if( CMA.to.apply %in% c("CMA1", "CMA2", "CMA3", "CMA4") )
  { default.arguments <- list(carry.only.for.same.medication = FALSE, ...) } 
...
return(default.arguments)
}

# generate CMA-specific arguments
params <- default.arguments(CMA.to.apply)

# call CMA.to.apply with the CMA-specific arguments
CMA <- do.call(CMA.to.apply, c(list(data = DATA), params))
@ddediu ddediu self-assigned this Feb 3, 2019
@ddediu
Copy link
Owner

ddediu commented Feb 3, 2019

good idea: will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants