metrumresearchgroup / bbr

R interface for model and project management
https://metrumresearchgroup.github.io/bbr/
Other
23 stars 2 forks source link

Add extra logic to filter .ctl and .mod file extensions #510

Closed rymarinelli closed 2 years ago

rymarinelli commented 2 years ago

Closes #486

rymarinelli commented 2 years ago

I tried to add some additional handling in new_model for arbitrary file extensions. But find_nonmem_model_file_path already throws an error. Including similar logic made tests concerning fail paths fail when using periods. For instance, bar.foo.ctl would wrongly fail with this logic. I decided to exclude it, since there was already handling

#If there is a file extension that is not .ctl or .mod
  if((stringr::str_detect(.path_extension, "\\.\\w+") == TRUE) && (stringr::str_detect(.path, "\\.ctl|\\.mod") == FALSE))
  {
    #stop('File extension is not supported')
  }
rymarinelli commented 2 years ago
Stories:
  MGMT-S017:
  name: Passing model file extensions
  description: As a user, I want to be able to pass '.ctl' and '.mod' file extensions when making a new model.
  ProductRisk: Low
  requirements:
  - CLM-R005
  - CLM-R006
Requirements:
  CLM-R005:
   description: accept '.ctl' file extension when calling new_model
   tests:
  - BBR-CLM-005
 CLM-R006:
   description: accept '.mod' file extension when calling new_model
   tests:
   - BBR-CLM-006
rymarinelli commented 2 years ago

@kyleam Thanks for the feedback. I refactored using the functions suggested and removed changes to the get_path_from_object. I would like to keep the extra test in there for .ctl and .mod I think it links more neatly for the stories/requirements.