Skip to content

studyGenerics::insertStructure() #34

Description

@cebarboza

@laacri @ariannaa7

  • I chained the issues, so all subfunctions will complete this requirement

A function studyGenerics::insertStructure() that will first add required files to the project in one go.

Also you may grasp an idea of the contents of an actual off-the-shelf study.

I am thinking we can divide this in more simple functions:

studyGenerics::installPackages()

  • This function takes a list argument that defaults to all "darwin", "phenotypeR", "drug_exposure_diagnostics", "darwinShinyModles" and will try to install all requirements for those in the renv.
install.packages("omopgenerics")
usethis::use_package("omopgenerics")

studyGenerics::insertDocs():

usethis::use_news_md()
usethis::use_apl2_license()
usethis::use_readme_rmd()

studyGenerics::insertTests():

  • takes the 'objectives' parameter and insertes a test file for every file.
usethis::use_testthat()
usethis::use_test("objective1")
(...)

studyGenerics::insertStudyFiles():

R/runDiagnostics.R
R/runStudy.R
R/createCohorts.R
R/objective1.R
R/mergeResults.R
(...)
dir.create(inst/cohorts)
dir.create(inst/concept_sets)
dir.create(extras)
extras/CodeToRun.R
extras/pullFromATLAS.R

CONTENTS:

runStudy.R:

#' Documentation
runStudy() {
   createLogger()*
   assertCdmName()
   takeCdmSnapShot()*
   createResultsDir()
   createCohorts()**
   exportAttrition()*
   if (obj_1) {
      runObjective1()
      exportResult()
   }
   (...)
   zipStudyResults
}

runDiagnostics.R:

#' Documentation
runDiagnostics() {
   createLogger()*
   assertCdmName()
   takeCdmSnapShot()*
   createResultsDir()
   createCohorts()**
   if (diagnostics) {
      phenotypeR::Diagnostics()
      exportResult()
   }
   if (drug_exposure_diagnostics) {
      drugExposureDiagnostics::check()
      exportResult()
   }
   (...)
   zipStudyResults
}

* To be created
** From a study package such as onconet

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions