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

Project-based Workflow #651

Draft
wants to merge 86 commits into
base: new-project-structure
Choose a base branch
from
Draft

Conversation

Felixmil
Copy link
Collaborator

@Felixmil Felixmil commented May 6, 2024

New Workflow Preview

devtools::load_all()
#> ℹ Loading esqlabsR
#> Loading required package: ospsuite
#> 
#> Loading required package: rClr
#> 
#> Loading the dynamic library for Microsoft .NET runtime...
#> Loaded Common Language Runtime version 4.0.30319.42000

# Create a project
p <- testProject()

# Project Overview
p
#> 
#> ── Project Configuration ───────────────────────────────────────────────────────
#>   • Project Configuration:
#>   'inst/extdata/examples/TestProject/ProjectConfiguration.xlsx'
#>   • Model folder: 'inst/extdata/examples/TestProject/Models/Simulations'
#>   • Configurations folder: 'inst/extdata/examples/TestProject/Configurations'
#>   • Model Parameters:
#>   'inst/extdata/examples/TestProject/Configurations/ModelParameters.xlsx'
#>   • Individuals:
#>   'inst/extdata/examples/TestProject/Configurations/Individuals.xlsx'
#>   • Populations:
#>   'inst/extdata/examples/TestProject/Configurations/Populations.xlsx'
#>   • PopulationsCSV:
#>   'inst/extdata/examples/TestProject/Configurations/PopulationsCSV'
#>   • Scenarios:
#>   'inst/extdata/examples/TestProject/Configurations/Scenarios.xlsx'
#>   • Applications:
#>   'inst/extdata/examples/TestProject/Configurations/Applications.xlsx'
#>   • Plots: 'inst/extdata/examples/TestProject/Configurations/Plots.xlsx'
#>   • Data folder: 'inst/extdata/examples/TestProject/Data'
#>   • Data file:
#>   'inst/extdata/examples/TestProject/Data/TestProject_TimeValuesData.xlsx'
#>   • Data importer configuration:
#>   'inst/extdata/examples/TestProject/Data/esqlabs_dataImporter_configuration.xml'
#>   • Compound Properties File:
#>   • Output folder: 'inst/extdata/examples/TestProject/Results'
#> 
#> ── Configurations ──────────────────────────────────────────────────────────────
#>   • Scenarios: 5
#>   • Models: 1
#>   • Model Parameters: 3
#>   • Individuals: 1
#> 
#> ── Scenarios ───────────────────────────────────────────────────────────────────
#>   • ✅ TestScenario
#>   • ✅ TestScenario2
#>   • ✅ PopulationScenario
#>   • ✅ PopulationScenarioFromCSV
#>   • ✅ TestScenario_missingParam
#> 
#> ── Simulation Results ──────────────────────────────────────────────────────────
#> No Simulation Results available.

# Explore configurations
p$configurations
#> 
#> ── Configurations ──────────────────────────────────────────────────────────────
#> • Scenarios:
#>   • TestScenario
#>   • TestScenario2
#>   • PopulationScenario
#>   • PopulationScenarioFromCSV
#>   • TestScenario_missingParam
#> • Models:
#>   • Aciclovir.pkml
#> • Model Parameters:
#>   • Global
#>   • MissingParam
#>   • Aciclovir
#> • Individuals:
#>   • Indiv1
#> • Applications:
#>   • Aciclovir_iv_250mg

p$configurations$scenarios$TestScenario
#> $id
#> [1] "TestScenario"
#> 
#> $individual
#> [1] "Indiv1"
#> 
#> $population
#> [1] NA
#> 
#> $populationFromCSV
#> [1] NA
#> 
#> $modelParameters
#> [1] "Global"
#> 
#> $applications
#> [1] "Aciclovir_iv_250mg"
#> 
#> $time
#> [1] "0, 24, 60"
#> 
#> $timeUnit
#> [1] "h"
#> 
#> $steadyState
#> [1] FALSE
#> 
#> $steadyStateTime
#> [1] NA
#> 
#> $steadyStateTimeUnit
#> [1] NA
#> 
#> $model
#> [1] "Aciclovir.pkml"
#> 
#> $outputPaths
#> [1] NA

# Modify configurations
p$configurations$modelParameters$Global$`EHC continuous fraction`$value
#> [1] 1
p$configurations$modelParameters$Global$`EHC continuous fraction`$value <- 0.5
p$configurations$scenarios$TestScenario$modelParameters <- c("Global", "Aciclovir")

# Explore scenarios
p$scenarios$TestScenario$configuration$modelParameters
#> $Global
#> $Global$`EHC continuous fraction`
#> $containerPath
#> [1] "Organism|Liver"
#> 
#> $parameterName
#> [1] "EHC continuous fraction"
#> 
#> $value
#> [1] 0.5
#> 
#> $units
#> [1] ""
#> 
#> 
#> 
#> $Aciclovir
#> $Aciclovir$Lipophilicity
#> $containerPath
#> [1] "Aciclovir"
#> 
#> $parameterName
#> [1] "Lipophilicity"
#> 
#> $value
#> [1] -0.1
#> 
#> $units
#> [1] "Log Units"

# Select which scenarios to run (all active by default)
p$selectScenarios("TestScenario")


# Check the scenarios status
p$scenarios
#> $TestScenario
#> • Status: ✅ active
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>     • Aciclovir
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $TestScenario2
#> • Status: ⏸ inactive
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $PopulationScenario
#> • Status: ⏸ inactive
#> • Type: population
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $PopulationScenarioFromCSV
#> • Status: ⏸ inactive
#> • Type: population
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>     • Global
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg
#> 
#> $TestScenario_missingParam
#> • Status: ⏸ inactive
#> • Type: individual
#> • simulateSteadyTime:
#> • Configurations:
#>   • Model: Aciclovir.pkml
#>   • Model Parameters:
#>   • Individual: Indiv1
#>   • Applications:
#>     • Aciclovir_iv_250mg

# Run the scenarios
p$runScenarios()
#> Loading Scenarios ■■■■■■■ 20% | ETA: 20s
## This will load and run the scenarios but this can be done in two separated manual steps
# p$loadScenarios()
# modify scenarios
# p$runScenarios()

# Access simulation results
p$simulationResults
#> $TestScenario
#> SimulationResults: 
#>    Number of individuals: 1

Created on 2024-05-06 with reprex v2.1.0

…n without inducing breaking changes

+ usethis::use_package("lifecycle")
+ update tests accordingly
+ add test for deprecation
+ devtools::document()
+ remove names of internal collaborators
…msFile-to-modelParamsFile

# Conflicts:
#	NEWS.md
#	R/project-configuration.R
#	inst/extdata/examples/TestProject/Configurations/Populations.xlsx
#	inst/extdata/examples/TestProject/ProjectConfiguration.xlsx
#	tests/testthat/test-utilities-population.R
+ use projectConfiguration$populationsCSV to locate population CSV files to read
+ add test to make sure all test scenarios can be properly created
…msFile-to-modelParamsFile

# Conflicts:
#	NEWS.md
…nfigurations, scenarios, simulationResults)

+ tests
@Felixmil Felixmil changed the title Implement project Initial implementation of project base workflow May 15, 2024
# Conflicts:
#	R/project-configuration.R
#	R/scenario.R
#	R/utilities-project-configuration.R
#	inst/extdata/examples/TestProject/ProjectConfiguration.xlsx
#	man/ExportConfiguration.Rd
#	man/ProjectConfiguration.Rd
#	tests/testthat/helpers.R
#	tests/testthat/test-utilities-population.R
#	tests/testthat/test-utilities-project-configuration.R
#	tests/testthat/test-utilities-scenarios.R
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 65.24199% with 553 lines in your changes missing coverage. Please review.

Project coverage is 71.21%. Comparing base (cab0796) to head (e267a54).
Report is 3 commits behind head on new-project-structure.

Files with missing lines Patch % Lines
R/scenarios.R 61.60% 129 Missing ⚠️
R/population.R 34.01% 97 Missing ⚠️
R/scenario-configuration-legacy.R 39.37% 77 Missing ⚠️
R/configuration.R 77.56% 59 Missing ⚠️
R/individual.R 67.91% 43 Missing ⚠️
R/project.R 74.39% 42 Missing ⚠️
R/SimulationParameter.R 76.52% 27 Missing ⚠️
R/simulation-time.R 73.23% 19 Missing ⚠️
R/project-configuration.R 32.00% 17 Missing ⚠️
R/scenario-configuration.R 87.59% 16 Missing ⚠️
... and 4 more
Additional details and impacted files
@@                    Coverage Diff                     @@
##           new-project-structure     #651       +/-   ##
==========================================================
- Coverage                  87.84%   71.21%   -16.63%     
==========================================================
  Files                         29       34        +5     
  Lines                       2829     4211     +1382     
==========================================================
+ Hits                        2485     2999      +514     
- Misses                       344     1212      +868     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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