From f439d0a70d92da7a00d7c92bc954275bc01f2637 Mon Sep 17 00:00:00 2001 From: Emile Rolley Date: Tue, 21 Feb 2023 11:25:59 +0100 Subject: [PATCH] docs(optim): add an explanation for rulesToKeep --- scripts/modelOptim.mjs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/modelOptim.mjs b/scripts/modelOptim.mjs index 2e88ba8c6..b4ece59e2 100644 --- a/scripts/modelOptim.mjs +++ b/scripts/modelOptim.mjs @@ -1,7 +1,7 @@ // Description: contains wrappers around the constant folding optimization pass from // [publiopti] to be used in the build scripts: rulesToJSON. // -// [publiopti]: https:github.com/EmileRolley/publiopti +// [publiopti]: https:github.com/datagir/publiopti import Engine from 'publicodes' import path from 'path' @@ -9,15 +9,20 @@ import { readFileSync, writeFileSync } from 'fs' import { constantFolding, disabledLogger, getRawNodes } from 'publiopti' // Rule names which should be kept in the optimized model. +// +// We need to keep the rules below because they are used in the simulation +// (e.g. 'bilan' or 'actions' are used to compute the total CO2 emissions). +// We also need to keep rules which are used in the UI (e.g. 'pétrole . pleins' +// and 'pétrole . volume plein' are used to compute the total volume of fuel), and +// rules that contain the 'icônes' key. const rulesToKeep = [ - 'bilan', 'actions', - 'transport', - 'pétrole . pleins', - 'transport . voiture . thermique', + 'bilan', 'logement . gaz', 'logement . gaz . biogaz', + 'pétrole . pleins', 'pétrole . volume plein', + 'transport . voiture . thermique', ] export function compressRules(