Skip to content
Snippets Groups Projects

Resolve "Mise à jour 2023 des sources liées à EnR de réseaux"

5 files
+ 15
12
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 8
5
@@ -44,10 +44,11 @@ poster_documenter_ind <- function(df = indicateur_bimotor_menages, nom_table_sgb
googlesheets4::gs4_deauth()
## chargement du référentiel indicateurs google sheet
metadata_indicateur <- googlesheets4::read_sheet("https://docs.google.com/spreadsheets/d/1n-dhtrJM3JwFVz5WSEGOQzQ8A0G7VT_VcxDe5gh6zSo/edit#gid=60292277",
sheet = "indicateurs") %>%
metadata_indicateur0 <- googlesheets4::read_sheet("https://docs.google.com/spreadsheets/d/1n-dhtrJM3JwFVz5WSEGOQzQ8A0G7VT_VcxDe5gh6zSo/edit#gid=60292277",
sheet = "indicateurs")
metadata_indicateur <- metadata_indicateur0 %>%
# on ne garde que les variables concernées par le présent script de chargement
dplyr::filter(source == nom_script_sce) %>%
dplyr::filter(source == nom_script_sce) %>%
# on ajoute l'unité dans le libellé de la variable
dplyr::mutate(libelle_variable = paste0(libelle_variable, " (unit\u00e9 : ", unite, ")")) %>%
dplyr::select(variable, libelle_variable) %>%
@@ -64,6 +65,7 @@ poster_documenter_ind <- function(df = indicateur_bimotor_menages, nom_table_sgb
## Vérification que la documentation des indicateurs est complète
var_mq <- dplyr::setdiff(var, metadata_indicateur$variable) %>% paste(collapse = "\n")
var_en_trop <- dplyr::setdiff(metadata_indicateur$variable, c("date", "typezone", "TypeZone", "CodeZone", "codezone", "Zone", "zone", var)) %>% paste(collapse = "\n")
attempt::stop_if_not(all(var %in% metadata_indicateur$variable),
msg = glue::glue("La table df contient des variables non document\u00e9es dans le r\u00e9f\u00e9rentiel google sheet : \n{var_mq}\n"))
@@ -81,8 +83,9 @@ poster_documenter_ind <- function(df = indicateur_bimotor_menages, nom_table_sgb
stringr::str_replace("indicateur_", "") %>%
stringr::str_replace("_cogiter|_cog$", "")
metadata_source <- googlesheets4::read_sheet("https://docs.google.com/spreadsheets/d/1n-dhtrJM3JwFVz5WSEGOQzQ8A0G7VT_VcxDe5gh6zSo/edit#gid=60292277",
sheet = "sources") %>%
metadata_source0 <- googlesheets4::read_sheet("https://docs.google.com/spreadsheets/d/1n-dhtrJM3JwFVz5WSEGOQzQ8A0G7VT_VcxDe5gh6zSo/edit#gid=60292277",
sheet = "sources")
metadata_source <- metadata_source0 %>%
dplyr::filter(source == nom_sce) %>%
dplyr::mutate(com_table = paste0(source_lib, " - ", producteur, ".\n", descriptif_sources)) %>%
dplyr::pull(com_table) %>%
Loading