Skip to content

Commit

Permalink
Merge branch 'preprod' into version-suisse-geneve
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemog committed Dec 18, 2023
2 parents e0960ad + 39f567b commit e3c5d0e
Show file tree
Hide file tree
Showing 34 changed files with 1,765 additions and 1,378 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/publish-wiki.yaml

This file was deleted.

28 changes: 23 additions & 5 deletions .github/workflows/upload-compilation-result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
compilation-result: ${{ steps.compilation.outputs.result }}
check-translation-result: ${{ steps.check-translation.outputs.result }}
check-personas-result: ${{ steps.check-personas.outputs.result }}
test-personas-result: ${{ steps.test-personas.outputs.result }}
test-personas-nightly-result: ${{ steps.test-personas-nightly.outputs.result }}
test-personas-latest-result: ${{ steps.test-personas-latest.outputs.result }}
test-optim-result: ${{ steps.test-optim.outputs.result }}
test-url: ${{ steps.set-test-url.outputs.fr }}
steps:
Expand Down Expand Up @@ -54,11 +55,20 @@ jobs:
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: test-personas
- id: test-personas-latest
name: Test the personas bilans against production
run: |
yarn test:personas --markdown > test-personas.res
body="$(cat test-personas.res | tail --lines=+3 | head --lines=-1)"
yarn test:personas --markdown -v latest > test-personas-latest.res
body="$(cat test-personas-latest.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: test-personas-nightly
name: Test the personas bilans against develop
run: |
yarn test:personas --markdown -v nightly > test-personas-nightly.res
body="$(cat test-personas-nightly.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
Expand Down Expand Up @@ -112,7 +122,15 @@ jobs:
### :couple: Personas changes
${{ needs.compile.outputs.test-personas-result }}
#### Test personas bilans against [production](https://nosgestesclimat-api.osc-fr1.scalingo.io/latest/fr/FR/rules)
${{ needs.compile.outputs.test-personas-latest-result }}
#### Test personas bilans against [preprod](https://nosgestesclimat-api.osc-fr1.scalingo.io/nightly/fr/FR/rules)
${{ needs.compile.outputs.test-personas-nightly-result }}
#### Test the model [optimisation](https://publicodes.github.io/tools/modules/optims.html)
${{ needs.compile.outputs.test-optim-result }}
Expand Down
7 changes: 7 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* This script is only used to generate the model.json file packaged in the npm package.
*
* For complete compilation, see the ./scripts/rulesToJSON.mjs script
*
* TODO: this script should be abstracted into a standalone bin in @publicodes/tools
*/
import { writeFileSync } from 'fs'
import { getModelFromSource } from '@publicodes/tools/compilation'
import { disabledLogger } from '@publicodes/tools'
Expand Down
37 changes: 32 additions & 5 deletions data/actions/transport.publicodes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
transport . arrêter l'avion:
icônes: 🛬🧳
applicable si:
toutes ces conditions:
- est défini: avion . usager
- avion . usager
action:
dépasse:
- transport . arrêter l'avion court
Expand Down Expand Up @@ -36,6 +40,10 @@ transport . arrêter l'avion:
transport . arrêter l'avion court:
titre: Privilégier le train au lieu de l'avion
icônes: 🛬🚆
applicable si:
toutes ces conditions:
- est défini: avion . usager
- avion . usager
formule: transport . avion . court courrier + compensation train
# Mettre histogramme GES qui compare les trajets train vs avion.
description: |
Expand Down Expand Up @@ -65,6 +73,10 @@ transport . arrêter l'avion court . ratio distance supplémentaire train:
transport . prendre moins l'avion:
titre: Prendre deux fois moins l'avion
icônes: 📉🛬
applicable si:
toutes ces conditions:
- est défini: avion . usager
- avion . usager
action:
dépasse:
- transport . arrêter l'avion court
Expand Down Expand Up @@ -99,7 +111,10 @@ transport . prendre moins l'avion:
transport . éco-conduite:
titre: Adopter une éco-conduite
applicable si: voiture . utilisateur régulier
applicable si:
toutes ces conditions:
- est défini: voiture . utilisateur régulier
- voiture . utilisateur régulier
icônes: 🚗☮
formule: transport . voiture . empreinte calculée - transport . éco-conduite . recalcul
description: |
Expand Down Expand Up @@ -131,7 +146,10 @@ transport . éco-conduite . usage réduit:

transport . covoiturage:
titre: Privilégier le covoiturage
applicable si: voiture . utilisateur régulier
applicable si:
toutes ces conditions:
- est défini: voiture . utilisateur régulier
- voiture . utilisateur régulier
action:
dépasse:
- transport . boulot . covoiturage
Expand Down Expand Up @@ -373,7 +391,10 @@ transport . voiture 5km:
titre: Se passer de voiture pour moins de 5 km
icônes: 🚗🚲
formule: transport . voiture . empreinte calculée - transport . voiture 5km . recalcul
applicable si: voiture . utilisateur régulier
applicable si:
toutes ces conditions:
- est défini: voiture . utilisateur régulier
- voiture . utilisateur régulier
non applicable si: voiture . km < seuil d'activation 5km
note: |
On fait l'hypothèse qu'une personne qui n'est pas propriétaire de voiture se passe *déjà* d'une voiture pour de courts trajets.
Expand Down Expand Up @@ -506,7 +527,10 @@ transport . scooter électrique . recalcul:
transport . voiture électrique:
titre: Rouler en voiture électrique
icônes: 🔌🚗
applicable si: voiture . utilisateur régulier
applicable si:
toutes ces conditions:
- est défini: voiture . utilisateur régulier
- voiture . utilisateur régulier
non applicable si: transport . voiture . motorisation = 'électrique'
formule: transport . voiture . empreinte calculée - transport . voiture électrique . recalcul
description: |
Expand Down Expand Up @@ -549,7 +573,10 @@ transport . voiture électrique . recalcul:
transport . voiture . limitation autoroute:
titre: Passer de 130 à 110km/h
icônes: 🚗🛣️
applicable si: voiture . utilisateur régulier
applicable si:
toutes ces conditions:
- est défini: voiture . utilisateur régulier
- voiture . utilisateur régulier
formule: réduction * empreinte autoroute
description: |
La convention citoyenne pour le climat a proposé en 2020 une réduction de la limitation de vitesse sur les autoroutes de 130km/h à 110km/h.
Expand Down
37 changes: 35 additions & 2 deletions data/alimentation/boisson.publicodes
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,33 @@ alimentation . boisson . chaude:
- café . nombre
- thé . nombre
- chocolat chaud . nombre
- chicorée . nombre
suggestions:
pas de boisson chaude:
café . nombre: 0
thé . nombre: 0
chocolat chaud . nombre: 0
chicorée . nombre: 0
un café par jour:
café . nombre: 7
thé . nombre: 0
chocolat chaud . nombre: 0
chicorée . nombre: 0
beaucoup de café:
café . nombre: 28
thé . nombre: 0
chocolat chaud . nombre: 0
chicorée . nombre: 0
un café et un thé par jour:
café . nombre: 7
thé . nombre: 7
chocolat chaud . nombre: 0
chicorée . nombre: 0
un chocolat chaud le matin:
café . nombre: 0
thé . nombre: 0
chocolat chaud . nombre: 7
chicorée . nombre: 0
question: Quelle est votre consommation de boissons chaudes pour une semaine type (nombre de tasses par semaine) ?
icônes: ☕️🫖
description: |
Expand All @@ -51,6 +57,7 @@ alimentation . boisson . chaude . par semaine:
- café
- thé
- chocolat chaud
- chicorée
unité: kgCO2e/semaine

alimentation . boisson . chaude . café:
Expand All @@ -71,6 +78,12 @@ alimentation . boisson . chaude . chocolat chaud:
formule: tasse de chocolat chaud * nombre
unité: kgCO2e/semaine

alimentation . boisson . chaude . chicorée:
titre: Chicorée
icônes: 🍵
formule: tasse de chicorée * nombre
unité: kgCO2e/semaine

alimentation . boisson . chaude . café . nombre:
question: Nombre de cafés par semaine
par défaut: 10
Expand All @@ -88,6 +101,11 @@ alimentation . boisson . chaude . chocolat chaud . nombre:
par défaut: 0
unité: tasse/semaine

alimentation . boisson . chaude . chicorée . nombre:
question: Nombre de tasses de chicorée par semaine
par défaut: 0
unité: tasse/semaine

alimentation . boisson . tasse de café:
titre: Empreinte d'une tasse de café
formule: empreinte café moulu * quantité café par tasse
Expand Down Expand Up @@ -132,7 +150,7 @@ alimentation . boisson . tasse de thé . part consommation empreinte thé infus
alimentation . boisson . tasse de thé . quantité thé par tasse:
formule: 0.250
unité: kg/tasse
note: on fait l'hypothèse qu'une tasse de thé fait en moyenne 250 grammes.
note: On fait l'hypothèse qu'une tasse de thé fait en moyenne 250 grammes.

alimentation . boisson . tasse de chocolat chaud:
titre: Empreinte d'une tasse de chocolat chaud
Expand All @@ -150,7 +168,7 @@ alimentation . boisson . tasse de chocolat chaud . empreinte cacao en poudre:
alimentation . boisson . tasse de chocolat chaud . quantité cacao par tasse:
formule: 0.020
unité: kg/tasse
note: on fait l'hypothèse qu'une tasse de chocolat chaud contient en moyenne 20 grammes de cacao en poudre.
note: On fait l'hypothèse qu'une tasse de chocolat chaud contient en moyenne 20 grammes de cacao en poudre.

alimentation . boisson . tasse de chocolat chaud . empreinte lait:
formule:
Expand All @@ -163,6 +181,21 @@ alimentation . boisson . tasse de chocolat chaud . empreinte lait:
alors: empreinte lait d'avoine
unité: kgCO2e/kg

alimentation . boisson . tasse de chicorée:
titre: Empreinte d'une tasse de chicorée
formule: empreinte chicorée instantanée * quantité chicorée par tasse
unité: kgCO2e/tasse

alimentation . boisson . tasse de chicorée . empreinte chicorée instantanée:
formule: 2.28
unité: kgCO2e/kg
note: Facteur d'émission issu d'[Agibalyse, chicorée et café, instantané, non sucré, prêt à boire](https://agribalyse.ademe.fr/app/aliments/18162#Chicor%C3%A9e_et_caf%C3%A9,_instantan%C3%A9,_non_sucr%C3%A9,_pr%C3%AAt_%C3%A0_boire_(reconstitu%C3%A9e_avec_de_l'eau)).

alimentation . boisson . tasse de chicorée . quantité chicorée par tasse:
formule: 0.003
unité: kg/tasse
note: On fait l'hypothèse qu'une tasse de chicorée contient en moyenne 3 grammes de chicorée instantanée.

alimentation . type de lait:
applicable si:
une de ces conditions:
Expand Down
2 changes: 1 addition & 1 deletion data/alimentation/déchets.publicodes
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ alimentation . déchets . gestes:
type: selection
options:
- compostage biodéchets . présent
- gaspillage alimentaire
- gaspillage alimentaire . présent
- stop pub . présent
- acheter en vrac . présent
suggestions:
Expand Down
2 changes: 1 addition & 1 deletion data/divers/tabac.publicodes
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ divers . tabac . consommation par semaine:
Un paquet / mois: 0.25
Un paquet / semaine: 1
Un paquet / jour: 7
unité: paquet / semaine
unité: paquet/semaine
note: |
D'après l'étude INSEE sur les [dépenses des ménages en 2017](https://www.insee.fr/fr/statistiques/4648319?sommaire=4648339), un ménage dépense en moyenne 402€ par an pour l'achat de tabac (tous ménages confondus).
Le prix d'un paquet de cigarettes en 2017 était de [7,05 euros en moyenne](https://www.toutsurmesfinances.com/argent/a/prix-du-tabac-2017-2018-en-france-historique-et-augmentation).
Expand Down
87 changes: 87 additions & 0 deletions data/i18n/models/ES-en.publicodes
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
params:
code: ES
nom: Spain
gentilé: spanish
drapeau: ES
authors:
- nom: Jean-Charles Prabonneau
url: https://github.com/jc-prabonneau
intensité électricité:
titre: Carbon intensity of the electricity mix in mainland Spain (tCO2e / MWh)
formule: 0.206
note: |
Source: <a href="https://app.electricitymaps.com/map">Electricity Map</a>, 2022
transport . avion . court courrier . heures de vol:
suggestions:
🚫✈️: 0
Madrid ⇄ Barcelona: 2.27
Madrid ⇄ Palma de Mallorca: 2.37
Barcelona ⇄ Palma de Mallorca: 1.5
Barcelona ⇄ Seville: 3
transport . avion . moyen courrier . heures de vol:
suggestions:
🚫✈️: 0
Madrid ⇄ Gran Canaria: 6
Madrid ⇄ Paris: 3.7
Madrid ⇄ Amsterdam: 4.7
Barcelona ⇄ London: 4
transport . avion . long courrier . heures de vol:
suggestions:
🚫✈️: 0
Madrid ⇄ New York: 15.4
Madrid ⇄ Mexico City: 22
Madrid ⇄ Tokyo: 28
Barcelona ⇄ Sydney: 44
transport . train . impact par km:
formule: (TGV * proportion passagers km AVE) + (TER * (1 - proportion passagers km AVE))
avec:
proportion passagers km AVE: 0.523
unité: kgCO2e/km
note: |
We have chosen not to differentiate between high-speed and conventional trains for the time being (to avoid asking two questions).
We apply the AVE emissions factor to the 52.3% of journeys made at high speed (AVE, Euromed, Avant) and the Cercanías regional train emissions factor to the rest.
Source: <a href="https://cdn.mitma.gob.es/portal-web-drupal/ferroviario/observatorio/ofe_2021_feb2023_v2.pdf">Spanish Rail Observatory</a>, 2021
transport . train . TGV:
titre: AVE high-speed trains
formule: (intensité GHG TGV France / 1000 gCO2e/kgCO2e) * intensité mix électrique Espagne continentale / intensité mix électrique France métropolitaine
avec:
intensité mix électrique France métropolitaine: 90 gCO2e/kWh
intensité mix électrique Espagne continentale: 206 gCO2e/kWh
intensité GHG TGV France: 2.36 gCO2e/km
unité: kgCO2e/km
note: |
The impact of the Spanish high-speed train is calculated on the basis of the French TGV, by applying the carbon intensity of Spain's electricity mix.
Source:
- Carbon intensities of the two countries' electricity mixes: <a href="https://app.electricitymaps.com/map">Electricity Map</a>, 2022
- Impact TGV France: 2.36 gCO2e/km/person; Base Carbone consulted on 04/04/2022 (SNCF data)
transport . train . TER:
titre: Cercanías regional trains
formule: 0.0328
unité: kgCO2e/km
note: |
Cercanías regional trains - 32.8 gCO2e/passenger-km; <a href="https://sede.idae.gob.es/lang/extras/tramites-servicios/2021/MOVES_Proyectos_Singulares_II/Factores_de_conversion_ahorros_y_emisiones_de_CO2.pdf">IDAE data</a>, 2021
transport . train . km:
suggestions:
crossing a region: 300
Madrid ⇄ Barcelona: 1100
Barcelona ⇄ Paris: 2000
💳 Renfe Más Plata: 10000
💳 Renfe Más Oro: 20000
services publics:
description: |
> The calculation of emissions from Spanish public services is based on the French estimate, adjusted for Spanish public spending, of the carbon intensity of the Spanish economy and its population.
> This is an initial macroscopic estimate that may be revised in the future.
formule: poids des services publics espagnols
avec:
poids des services publics espagnols: 1142.5
note: |
Source: <a href="https://docs.google.com/spreadsheets/d/1zJ-CkVQ8W_HdFVvNyaN4xlRsyoZPzRef4rpiCqyowG4/edit?usp=sharing">Detailed estimate</a>
services marchands:
description: |
> The calculation of emissions from Spanish market services is based on the French estimate, adjusted for Spain's territorial emissions and population.
> This is an initial macroscopic estimate that may be revised in the future.
formule: poids des services marchands espagnols
avec:
poids des services marchands espagnols: 195.06
note: |
Source: <a href="https://docs.google.com/spreadsheets/d/1zJ-CkVQ8W_HdFVvNyaN4xlRsyoZPzRef4rpiCqyowG4/edit?usp=sharing">Detailed estimate</a>
Loading

0 comments on commit e3c5d0e

Please sign in to comment.