forked from incubateur-ademe/nosgestesclimat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Première extraction de la base carbone : plats préparés
- Loading branch information
Showing
6 changed files
with
350 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
base carbone v16.1.csv | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const csv = require("csv-parser"); | ||
const fs = require("fs"); | ||
const results = []; | ||
const yaml = require("js-yaml"); | ||
|
||
fs.createReadStream("base carbone v16.1.csv") | ||
.pipe(csv()) | ||
.on("data", data => { | ||
let { | ||
"Code de la catégorie": categorie, | ||
"Unité français": unité, | ||
"Type Ligne": type, | ||
"Total poste non décomposé": co2e | ||
} = data; | ||
|
||
categorie === | ||
"Achats de biens > Produits agro-alimentaires, plats préparés et boissons > Plats préparés > Petit déjeuner" && | ||
unité === "kgCO2e/portion" && | ||
type === "Elément" && | ||
results.push({ | ||
espace: "nourriture", | ||
nom: data["Nom base français"], | ||
description: data["Commentaire français"], | ||
formule: co2e, | ||
unité: "kgCO₂e" | ||
}); | ||
}) | ||
.on("end", () => { | ||
//console.log(results); | ||
fs.writeFile("./nourriture.yaml", yaml.safeDump(results), function(err) { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
|
||
console.log("The file was saved!"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
- espace: nourriture | ||
nom: Beurre doux | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,01 | ||
formule: '0.0949' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Bol de céréales | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,337 | ||
formule: '0.293' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Bol de lait | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,404 | ||
formule: '0.494' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Chocolat | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,02 | ||
formule: '0.0975' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Orange | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,12 | ||
formule: '0.102' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Pain | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,04 | ||
formule: '0.0609' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Pomme | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,146 | ||
formule: '0.0389' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Tasse de café | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,253 | ||
formule: '0.0503' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Tasse de thé | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,25 | ||
formule: '0.0123' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Viennoiserie brioche | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,05 | ||
formule: '0.143' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Viennoiserie pain au chocolat | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,05 | ||
formule: '0.114' | ||
unité: kgCO₂e | ||
- espace: nourriture | ||
nom: Yaourt | ||
description: >- | ||
masse d'ingrédients consommables dans l'assiette pour une portion (kg) : | ||
0,125 | ||
formule: '0.36' | ||
unité: kgCO₂e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "futureco-data", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "null", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/laem/futureco-data.git" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/laem/futureco-data/issues" | ||
}, | ||
"homepage": "https://github.com/laem/futureco-data#readme", | ||
"dependencies": { | ||
"csv-parser": "^2.3.1", | ||
"js-yaml": "^3.13.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@hapi/address@^2.1.2": | ||
version "2.1.2" | ||
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.2.tgz#1c794cd6dbf2354d1eb1ef10e0303f573e1c7222" | ||
integrity sha512-O4QDrx+JoGKZc6aN64L04vqa7e41tIiLU+OvKdcYaEMP97UttL0f9GIi9/0A4WAMx0uBd6SidDIhktZhgOcN8Q== | ||
|
||
"@hapi/formula@^1.2.0": | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-1.2.0.tgz#994649c7fea1a90b91a0a1e6d983523f680e10cd" | ||
integrity sha512-UFbtbGPjstz0eWHb+ga/GM3Z9EzqKXFWIbSOFURU0A/Gku0Bky4bCk9/h//K2Xr3IrCfjFNhMm4jyZ5dbCewGA== | ||
|
||
"@hapi/hoek@^8.2.4", "@hapi/hoek@^8.3.0": | ||
version "8.3.2" | ||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.3.2.tgz#91e7188edebc5d876f0b91a860f555ff06f0782b" | ||
integrity sha512-NP5SG4bzix+EtSMtcudp8TvI0lB46mXNo8uFpTDw6tqxGx4z5yx+giIunEFA0Z7oUO4DuWrOJV9xqR2tJVEdyA== | ||
|
||
"@hapi/joi@^16.1.4": | ||
version "16.1.7" | ||
resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-16.1.7.tgz#360857223a87bb1f5f67691537964c1b4908ed93" | ||
integrity sha512-anaIgnZhNooG3LJLrTFzgGALTiO97zRA1UkvQHm9KxxoSiIzCozB3RCNCpDnfhTJD72QlrHA8nwGmNgpFFCIeg== | ||
dependencies: | ||
"@hapi/address" "^2.1.2" | ||
"@hapi/formula" "^1.2.0" | ||
"@hapi/hoek" "^8.2.4" | ||
"@hapi/pinpoint" "^1.0.2" | ||
"@hapi/topo" "^3.1.3" | ||
|
||
"@hapi/pinpoint@^1.0.2": | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-1.0.2.tgz#025b7a36dbbf4d35bf1acd071c26b20ef41e0d13" | ||
integrity sha512-dtXC/WkZBfC5vxscazuiJ6iq4j9oNx1SHknmIr8hofarpKUZKmlUVYVIhNVzIEgK5Wrc4GMHL5lZtt1uS2flmQ== | ||
|
||
"@hapi/topo@^3.1.3": | ||
version "3.1.6" | ||
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.6.tgz#68d935fa3eae7fdd5ab0d7f953f3205d8b2bfc29" | ||
integrity sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ== | ||
dependencies: | ||
"@hapi/hoek" "^8.3.0" | ||
|
||
argparse@^1.0.7: | ||
version "1.0.10" | ||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" | ||
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== | ||
dependencies: | ||
sprintf-js "~1.0.2" | ||
|
||
buffer-alloc-unsafe@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" | ||
integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== | ||
|
||
buffer-alloc@^1.1.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" | ||
integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== | ||
dependencies: | ||
buffer-alloc-unsafe "^1.1.0" | ||
buffer-fill "^1.0.0" | ||
|
||
buffer-fill@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" | ||
integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= | ||
|
||
buffer-from@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" | ||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== | ||
|
||
core-util-is@~1.0.0: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" | ||
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= | ||
|
||
csv-parser@^2.3.1: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/csv-parser/-/csv-parser-2.3.1.tgz#dbc3cbef59241693bb78119634dbc879c2c83995" | ||
integrity sha512-/u51FlBo75BcY/IL0WGibT628rr/xn4cXS9jX+AwT4x9yE7kqGqss7YgXpbdFai6m3uNbr4g1F19BoXBFeiJbA== | ||
dependencies: | ||
"@hapi/joi" "^16.1.4" | ||
buffer-alloc "^1.1.0" | ||
buffer-from "^1.0.0" | ||
generate-object-property "^1.0.0" | ||
minimist "^1.2.0" | ||
ndjson "^1.4.0" | ||
|
||
esprima@^4.0.0: | ||
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" | ||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== | ||
|
||
generate-object-property@^1.0.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" | ||
integrity sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA= | ||
dependencies: | ||
is-property "^1.0.0" | ||
|
||
inherits@~2.0.3: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" | ||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== | ||
|
||
is-property@^1.0.0: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" | ||
integrity sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ= | ||
|
||
isarray@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" | ||
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= | ||
|
||
js-yaml@^3.13.1: | ||
version "3.13.1" | ||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" | ||
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== | ||
dependencies: | ||
argparse "^1.0.7" | ||
esprima "^4.0.0" | ||
|
||
json-stringify-safe@^5.0.1: | ||
version "5.0.1" | ||
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" | ||
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= | ||
|
||
minimist@^1.2.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" | ||
integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= | ||
|
||
ndjson@^1.4.0: | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/ndjson/-/ndjson-1.5.0.tgz#ae603b36b134bcec347b452422b0bf98d5832ec8" | ||
integrity sha1-rmA7NrE0vOw0e0UkIrC/mNWDLsg= | ||
dependencies: | ||
json-stringify-safe "^5.0.1" | ||
minimist "^1.2.0" | ||
split2 "^2.1.0" | ||
through2 "^2.0.3" | ||
|
||
process-nextick-args@~2.0.0: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" | ||
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== | ||
|
||
readable-stream@~2.3.6: | ||
version "2.3.6" | ||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" | ||
integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== | ||
dependencies: | ||
core-util-is "~1.0.0" | ||
inherits "~2.0.3" | ||
isarray "~1.0.0" | ||
process-nextick-args "~2.0.0" | ||
safe-buffer "~5.1.1" | ||
string_decoder "~1.1.1" | ||
util-deprecate "~1.0.1" | ||
|
||
safe-buffer@~5.1.0, safe-buffer@~5.1.1: | ||
version "5.1.2" | ||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" | ||
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== | ||
|
||
split2@^2.1.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/split2/-/split2-2.2.0.tgz#186b2575bcf83e85b7d18465756238ee4ee42493" | ||
integrity sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw== | ||
dependencies: | ||
through2 "^2.0.2" | ||
|
||
sprintf-js@~1.0.2: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" | ||
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= | ||
|
||
string_decoder@~1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" | ||
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== | ||
dependencies: | ||
safe-buffer "~5.1.0" | ||
|
||
through2@^2.0.2, through2@^2.0.3: | ||
version "2.0.5" | ||
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" | ||
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== | ||
dependencies: | ||
readable-stream "~2.3.6" | ||
xtend "~4.0.1" | ||
|
||
util-deprecate@~1.0.1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" | ||
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= | ||
|
||
xtend@~4.0.1: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" | ||
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== |