Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OutilEnR_EtatdesLieux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DREAL Grand Est
SCDD
OutilsEnR
OutilEnR_EtatdesLieux
Commits
9683e59e
Commit
9683e59e
authored
1 year ago
by
guillaume.jeffroy
Browse files
Options
Downloads
Patches
Plain Diff
Amelioration du process de mise à jour
parent
dd8354bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-raw/run_pipe.R
+40
-13
40 additions, 13 deletions
data-raw/run_pipe.R
dev/03_deploy.R
+4
-23
4 additions, 23 deletions
dev/03_deploy.R
with
44 additions
and
36 deletions
data-raw/run_pipe.R
+
40
−
13
View file @
9683e59e
# ---- PARAMETRES A REGLER ----
start_time
<-
Sys.time
()
cat
(
paste0
(
"Debut de la mise à jour : "
,
start_time
))
# ---- PARAMETRES A REGLER ----
# MILLESIME et PREMIERE ANNEE
# Changer le millesime (mil) à l'année N-1 avant de lancer le pipeline
# Si vous souhaitez mettre à jour les fonds de carte, regler mettre_a_jour_fond_de_carte <- TRUE, sinon FALSE
...
...
@@ -16,18 +18,17 @@ nettoyer_workspace <- TRUE
# Mettez à jour les URL pour télécharger les données avec les URL vers la version de l'année N-1
# NB: Les registres ODRE sont automatiquement mise à jour avec via le millesime renseigné plus haut (mil)
# url_ign_iris <- "https://wxs.ign.fr/1yhlj2ehpqf3q6dt6a2y7b64/telechargement/inspire/CONTOURS-IRIS-PACK_2022-01$CONTOURS-IRIS_2-1__SHP__FRA_2022-01-01/file/CONTOURS-IRIS_2-1__SHP__FRA_2022-01-01.7z"
# url_ign_admin <- "https://wxs.ign.fr/x02uy2aiwjo9bm8ce5plwqmr/telechargement/prepackage/ADMINEXPRESS_SHP_TERRITOIRES_PACK_2022-12-20$ADMIN-EXPRESS_3-1__SHP_LAMB93_FXX_2022-12-20/file/ADMIN-EXPRESS_3-1__SHP_LAMB93_FXX_2022-12-20.7z"
# url_insee <- "https://www.insee.fr/fr/statistiques/fichier/2017499/reference_IRIS_geo2022.zip"
# url_SDES_eolien <- "https://www.statistiques.developpement-durable.gouv.fr/sites/default/files/2023-02/2022_t4_tb_dpt_installations_eoliennes.xlsx"
# url_SDES_pv <- "https://www.statistiques.developpement-durable.gouv.fr/sites/default/files/2023-02/2022_t4_tb_dpt_installations_solaires_photovoltaiques.xlsx"
url_ign_iris
<-
"https://wxs.ign.fr/1yhlj2ehpqf3q6dt6a2y7b64/telechargement/inspire/CONTOURS-IRIS-PACK_2023-01$CONTOURS-IRIS_3-0__SHP__FRA_2023-01-01/file/CONTOURS-IRIS_3-0__SHP__FRA_2023-01-01.7z"
url_ign_admin
<-
"https://wxs.ign.fr/x02uy2aiwjo9bm8ce5plwqmr/telechargement/prepackage/ADMINEXPRESS_SHP_WGS84G_PACK_2023-12-19$ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2023-12-19/file/ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2023-12-19.7z"
url_insee
<-
"https://www.insee.fr/fr/statistiques/fichier/2017499/reference_IRIS_geo2023.zip"
url_SDES_eolien
<-
"https://www.statistiques.developpement-durable.gouv.fr/media/7141/download?inline"
url_SDES_pv
<-
"https://www.statistiques.developpement-durable.gouv.fr/media/7140/download?inline"
url_ign_iris
<-
"https://wxs.ign.fr/1yhlj2ehpqf3q6dt6a2y7b64/telechargement/inspire/CONTOURS-IRIS-PACK_2022-01$CONTOURS-IRIS_2-1__SHP__FRA_2022-01-01/file/CONTOURS-IRIS_2-1__SHP__FRA_2022-01-01.7z"
url_ign_admin
<-
"https://wxs.ign.fr/x02uy2aiwjo9bm8ce5plwqmr/telechargement/prepackage/ADMINEXPRESS_SHP_TERRITOIRES_PACK_2022-12-20$ADMIN-EXPRESS_3-1__SHP_LAMB93_FXX_2022-12-20/file/ADMIN-EXPRESS_3-1__SHP_LAMB93_FXX_2022-12-20.7z"
url_insee
<-
"https://www.insee.fr/fr/statistiques/fichier/2017499/reference_IRIS_geo2022.zip"
url_SDES_eolien
<-
"https://www.statistiques.developpement-durable.gouv.fr/sites/default/files/2023-02/2022_t4_tb_dpt_installations_eoliennes.xlsx"
url_SDES_pv
<-
"https://www.statistiques.developpement-durable.gouv.fr/sites/default/files/2023-02/2022_t4_tb_dpt_installations_solaires_photovoltaiques.xlsx"
# url_ign_iris <- "https://wxs.ign.fr/1yhlj2ehpqf3q6dt6a2y7b64/telechargement/inspire/CONTOURS-IRIS-PACK_2023-01$CONTOURS-IRIS_3-0__SHP__FRA_2023-01-01/file/CONTOURS-IRIS_3-0__SHP__FRA_2023-01-01.7z"
# url_ign_admin <- "https://wxs.ign.fr/x02uy2aiwjo9bm8ce5plwqmr/telechargement/prepackage/ADMINEXPRESS_SHP_WGS84G_PACK_2023-12-19$ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2023-12-19/file/ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2023-12-19.7z"
# url_insee <- "https://www.insee.fr/fr/statistiques/fichier/2017499/reference_IRIS_geo2023.zip"
# url_SDES_eolien <- "https://www.statistiques.developpement-durable.gouv.fr/media/7141/download?inline"
# url_SDES_pv <- "https://www.statistiques.developpement-durable.gouv.fr/media/7140/download?inline"
# ---- FIN DES PARAMETRES A REGLER ----
# ---- NE PAS MODIFIER APRES CETTE LIGNE ----
...
...
@@ -61,6 +62,17 @@ check_download_size <- function(url, fichier){
return
(
download_ok
)
}
# Verification de la verion de R et de Rtools
if
(
getRversion
()
==
"4.2.2"
){
cat
(
"Version actuelle de R : 4.2.2 \n"
)
cat
(
paste0
(
"Path actuel de RTools : "
,
pkgbuild
::
rtools_path
(),
"\n"
))
warning
(
paste0
(
"Version recommandée de Rtools : "
,
pkgbuild
::
rtools_needed
(),
"\n"
))
}
else
{
warning
(
"Le pipeline a été developpé avec R 4.2.2 et Rtools 4.2. Il est recommandé d'utiliser ces versions."
)
}
# Creation des dossiers pour stocker les données brutes
if
(
versionning
){
version
<-
paste0
(
stringr
::
str_replace
(
stringr
::
str_replace_all
(
Sys.time
(),
"-|:"
,
rep
=
""
),
" "
,
rep
=
"_"
))
...
...
@@ -174,7 +186,20 @@ usethis::use_data(version, overwrite = TRUE)
success_msg
(
"Sauvegarde de la version de la mise à jour reussie !"
)
success_msg
(
"Mise à jour terminée !"
)
# Fin de la mise à jour
end_time
<-
Sys.time
()
success_msg
(
"Mise à jour terminée avec succès !"
)
print
(
paste0
(
"Fin de la mise à jour : "
,
end_time
))
print
(
paste0
(
"Temps total de la mise à jour : "
,
round
(
difftime
(
end_time
,
start_time
,
units
=
"secs"
),
digits
=
2
),
" s"
))
print
(
paste0
(
"Toutes les données (brutes et raffinées) de la mise à jour sont stockés dans : "
,
dossier
))
cat
(
paste0
(
"Les données raffinées ont été copiées dans le dossier ./data/
Elles sont prêtes au deploiement, mais également visible si vous lancez l'application en local."
))
# Nettoyage du workspace
if
(
nettoyer_workspace
){
rm
(
list
=
ls
())
...
...
@@ -183,3 +208,5 @@ if(nettoyer_workspace){
This diff is collapsed.
Click to expand it.
dev/03_deploy.R
+
4
−
23
View file @
9683e59e
...
...
@@ -16,33 +16,13 @@
# ## Run checks ----
# ## Check the package before sending to prod
# devtools::check()
# rhub::check_for_cran()
#
# # Deploy
#
# ## Local, CRAN or Package Manager ----
# ## This will build a tar.gz that can be installed locally,
# ## sent to CRAN, or to a package manager
# devtools::build()
#
# ## RStudio ----
# ## If you want to deploy on RStudio related platforms
# golem::add_rstudioconnect_file()
# golem::add_shinyappsio_file()
# golem::add_shinyserver_file()
#
# ## Docker ----
# ## If you want to deploy via a generic Dockerfile
# golem::add_dockerfile_with_renv()
#
# ## If you want to deploy to ShinyProxy
# golem::add_dockerfile_with_renv_shinyproxy()
# ---- PARAMETRES ----
# Faire tourner dans la console R studio suivant la cible :
# Pour la prod -> system("Rscript ./dev/03_deploy.R preprod")
# Pour la preprod ->system("Rscript ./dev/03_deploy.R prod")
# Pour la preprod ->system("Rscript ./dev/03_deploy.R prprod")
# Pour la prod -> system("Rscript ./dev/03_deploy.R prod")
# Récuperer les arguments passer en ligne de commande (prod ou preprod)
args
=
commandArgs
(
trailingOnly
=
T
)
...
...
@@ -86,6 +66,7 @@ scripts <- c("R/",
"app.R"
)
# ---- Déploiement vers ShinyApps.io ----
rsconnect
::
deployApp
(
account
=
'ssm-ecologie'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment