## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  message = FALSE,
  warning = FALSE,
  fig.width = 7,
  fig.height = 4.5,
  out.width = "100%"
)

## ----setup--------------------------------------------------------------------
library(ambre)
set.seed(2024)

## ----template-----------------------------------------------------------------
readxl::read_excel(
  system.file("input_1culture_2pop.xlsx", package = "ambre")
) |>
  knitr::kable()

## ----crops--------------------------------------------------------------------
config_ambre$crop[, c("CropName", "CropDescription", "CropHeight")]

## ----populations--------------------------------------------------------------
dplyr::distinct(
  config_ambre$path$description[, c("PopulationID", "PopulationName")]
)

## ----paths--------------------------------------------------------------------
config_ambre$path$description[, c("PathID", "PathDescription", "PopulationName")] |>
  knitr::kable()

## ----barriers-----------------------------------------------------------------
sort(unique(config_ambre$treatment$processes$TreatmentName))

## ----pathogen-----------------------------------------------------------------
library(dplyr)

pathogen <- config_ambre$health %>%
  filter(!if_else(is.na(infection_to_illness) & is.na(dalys_per_case), TRUE, infection_to_illness == dalys_per_case, missing = FALSE))
pathogen$PathogenName


## ----check-complet------------------------------------------------------------
vals <- readxl::read_excel(
  system.file("input_cas_apprentissage_complet.xlsx", package = "ambre")
)$CropName
setdiff(unique(vals), config_ambre$crop$CropName)   # crop names with no match

## ----validate-----------------------------------------------------------------
scenario <- create_scenario(
  system.file("input_1culture_2pop.xlsx", package = "ambre")
)
scenario[, c("CropName", "CropID", "PopulationName", "PopulationID",
             "PathName", "PathID")]

