Open AKostiv8 opened 2 weeks ago
This is going in the right direction ! I think it would be better to provide feedback directly when a value is modified, for example:
p$configurations$scenarios$TestScenario$individual <- "Non-declared individual"
# ! Scenario: TestScenario - The individual 'Non-declared individual' does not exist in the individuals configuration for scenario 'TestScenario'
Nice to be able to list all ongoing problems on the projects with p$validate()
but I think status
would be a better name for users. So I would define a status
active field that returns what validate()
print.
Also, I feel like Scenario
validation should happen within each ScenarioConfiguration
object and thus defined in ScenariosConfiguration.R
. As Scenarios
object have the whole project
passed during their initialization, you can still compare with other configurations
.
To summarise, here are new requirements:
validate()
is ran whenever configurations
is alteredp$status
print a nice list of the ongoing problems of the project (warning and errors)
devtools::load_all()
#ℹ Loading esqlabsR
# Create a project
p <- testProject()
# Modify to existing one individual
p$configurations$scenarios$TestScenario$individual <- "Indiv1"
# ✔ No warnings found.
# Modify to non-existing one individual
p$configurations$scenarios$TestScenario$individual <- "Indiv3"
# ℹ Warnings:
# ! Scenario: TestScenario - The individual 'Indiv3' does not exist in the individuals configuration.
# Add non-existing one model
p$configurations$scenarios$TestScenario$model <- "Blabla.pkml"
# ℹ Warnings:
# ! Scenario: TestScenario - The individual 'Indiv3' does not exist in the individuals configuration.
# ! Scenario: TestScenario - The model 'Blabla.pkml' does not exist in the models configuration.
p$configurations$scenarios$TestScenario2$model <- "Blabla.pkml"
# ℹ Warnings:
# ! Scenario: TestScenario - The individual 'Indiv3' does not exist in the individuals configuration.
# ! Scenario: TestScenario - The model 'Blabla.pkml' does not exist in the models configuration.
# ! Scenario: TestScenario2 - The model 'Blabla.pkml' does not exist in the models configuration.
# Replace Indiv3 with Indiv1
p$configurations$scenarios$TestScenario$individual <- "Indiv1"
# ℹ Warnings:
# ! Scenario: TestScenario - The model 'Blabla.pkml' does not exist in the models configuration.
# ! Scenario: TestScenario2 - The model 'Blabla.pkml' does not exist in the models configuration.
# Check configuration status
p$status()
# ℹ Warnings:
# ! Scenario: TestScenario - The model 'Blabla.pkml' does not exist in the models configuration.
# ! Scenario: TestScenario2 - The model 'Blabla.pkml' does not exist in the models configuration.
# Get validation object with the warnings
p$get_warning_manager()$warnings
# $TestScenario
# $TestScenario$MODEL_NOT_FOUND
# [1] "The model 'Blabla.pkml' does not exist in the models configuration."
# $TestScenario2
# $TestScenario2$MODEL_NOT_FOUND
# [1] "The model 'Blabla.pkml' does not exist in the models configuration."