The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
initStudy() is the starting point for building a study
project with the OMOP Common Data Model (CDM) using the
OmopStudyBuilder package.
It generates a fully structured project folder containing:
This allows you to immediately focus on writing study-specific code instead of manually assembling the surrounding infrastructure.
In this vignette you will learn how to:
initStudy()The simplest way to use initStudy() is to provide a
directory path. If the directory:
To avoid modifying your real project directories, this vignette uses a temporary folder.
# Create a temporary root for this vignette
study_root <- file.path(tempdir(), "SampleStudy")
initStudy(study_root)
# Show top-level contents created by initStudy()
list.files(study_root)
#> [1] "INSTRUCTIONS.md" "README.md" "diagnosticsCode" "diagnosticsShiny"
#> [5] "studyCode" "studyShiny"You should see something like:
diagnosticsCode/ – diagnostic scripts and helpersdiagnosticsShiny/ – skeleton diagnostics Shiny appstudyCode/ – scripts for running the main analysesstudyShiny/ – skeleton reporting Shiny appREADME.md – overview of the study projectTo inspect the full structure:
list.files(study_root, recursive = TRUE)
#> [1] "INSTRUCTIONS.md"
#> [2] "README.md"
#> [3] "diagnosticsCode/README.md"
#> [4] "diagnosticsCode/codeToRun.R"
#> [5] "diagnosticsCode/cohorts/instantiateCohorts.R"
#> [6] "diagnosticsCode/diagnosticsCode.Rproj"
#> [7] "diagnosticsCode/results/README.md"
#> [8] "diagnosticsCode/runStudy.R"
#> [9] "diagnosticsShiny/README.md"
#> [10] "diagnosticsShiny/diagnosticsShiny.Rproj"
#> [11] "studyCode/README.md"
#> [12] "studyCode/analyses/cohortCharacteristics.R"
#> [13] "studyCode/analyses/cohortSurvival.R"
#> [14] "studyCode/analyses/drugUtilisation.R"
#> [15] "studyCode/analyses/incidencePrevalence.R"
#> [16] "studyCode/codeToRun.R"
#> [17] "studyCode/codelist/codelistCreation.R"
#> [18] "studyCode/cohorts/instantiateCohorts.R"
#> [19] "studyCode/results/README.md"
#> [20] "studyCode/runStudy.R"
#> [21] "studyCode/studyCode.Rproj"
#> [22] "studyShiny/README.md"
#> [23] "studyShiny/studyShiny.Rproj"You can control which parts of the template are created with the
diagnostics and study arguments.
initStudy()After generating the project structure, you will mainly work with these folders and files:
studyCode/
studyCode.Rproj: open this in RStudio to work on the
main analysis code. It sets the working directory so all relative paths
behave correctly.codeToRun.R: where you add database connection details,
schemas, and global settingscohorts/instantiateCohorts.R: defines the study cohorts
using your codelists and cohort-building functions. You customise this
to match your phenotype definitions.runStudy.R: orchestrates the analysis steps (cohort
creation, summaries, analyses, export).diagnosticsCode/
diagnosticsCode.Rproj: open this project to work on
diagnostics. It keeps diagnostics code separate from the main analysis
project.codeToRun.R: similar to the study version, but
dedicated to diagnostics. You set connection details and schemas used
for running phenotype diagnostics.cohorts/instantiateCohorts.R: defines cohorts for
diagnostic checking, often mirroring or simplifying the main study
cohorts.runStudy.R: runs the PhenotypeDiagnostics workflow and
exports diagnostic results. You might tweak options, but the overall
flow is usually left intact.studyShiny/
diagnosticsShiny/
Once your study code is ready, OmopStudyBuilder provides
functions to package it into a Docker image and distribute it to data
partners.
# Build a Docker image containing your study code
dockeriseStudy(
image_name = "omop-study-study-code",
path = file.path(study_root, "studyCode")
)
#> Building Docker image: omop-study-study-code
#> This may take some minutes on first build...
#> ✔ Image built successfully: omop-study-study-codeThe image contains: - Your exact R version - All package dependencies (from renv.lock) - Your study code - Database drivers and system dependencies
Push to Docker Hub for easy sharing with connected partners:
pushDockerImage(
image_name = "omop-study-study-code",
repo = "yourusername/myomopstudy"
)
#> ✔ Image pushed to Docker Hub!Data partners can then pull and run the image.
They can then run either an interactive RStudio Server session, or run the study in automated mode.
RStudio Server runs the Docker image and opens a browser to the RStudio Server URL:
# Requires image built with dockeriseStudy(useRStudio = TRUE)
runRStudio(
image_name = "omop-study-study-code",
results_path = "./results"
)Partners edit credentials in codeToRun.R and run the
study interactively.
Automated execution (for programmatic workflows):
runStudy(
image_name = "omop-study-study-code",
results_path = "./results",
data_path = "path/to/data"
)To stop any running OmopStudyBuilder containers, use:
For more operational details, see the README files generated into
your study folders (for example studyCode/README.md and
diagnosticsCode/README.md).
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.