@tricoteuses/senat 2.20.10 → 2.20.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,20 +23,50 @@ async function convertData() {
|
|
|
23
23
|
const enabledDatasets = getEnabledDatasets(options["categories"]);
|
|
24
24
|
console.time("data transformation time");
|
|
25
25
|
if (enabledDatasets & EnabledDatasets.Ameli) {
|
|
26
|
-
|
|
26
|
+
try {
|
|
27
|
+
await convertDatasetAmeli(dataDir, options);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(`Error converting Ameli dataset:`, error);
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
if (enabledDatasets & EnabledDatasets.Debats) {
|
|
29
|
-
|
|
34
|
+
try {
|
|
35
|
+
await convertDatasetDebats(dataDir, options);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(`Error converting Debats dataset:`, error);
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
if (enabledDatasets & EnabledDatasets.DosLeg) {
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
try {
|
|
43
|
+
await convertDatasetDosLeg(dataDir, options);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(`Error converting DosLeg dataset:`, error);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
await convertDatasetScrutins(dataDir, options);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error(`Error converting Scrutins dataset:`, error);
|
|
53
|
+
}
|
|
34
54
|
}
|
|
35
55
|
if (enabledDatasets & EnabledDatasets.Questions) {
|
|
36
|
-
|
|
56
|
+
try {
|
|
57
|
+
await convertDatasetQuestions(dataDir);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(`Error converting Questions dataset:`, error);
|
|
61
|
+
}
|
|
37
62
|
}
|
|
38
63
|
if (enabledDatasets & EnabledDatasets.Sens) {
|
|
39
|
-
|
|
64
|
+
try {
|
|
65
|
+
await convertDatasetSens(dataDir);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error(`Error converting Sens dataset:`, error);
|
|
69
|
+
}
|
|
40
70
|
}
|
|
41
71
|
if (!options["silent"]) {
|
|
42
72
|
console.timeEnd("data transformation time");
|
|
@@ -116,13 +116,19 @@ async function copyToSenat(dataset, dataDir, options) {
|
|
|
116
116
|
execSync(`${options["sudo"] ? `sudo -u ${options["sudo"]} ` : ""}psql --quiet -d senat -f ${schemaDumpFile}`, {
|
|
117
117
|
env: process.env,
|
|
118
118
|
encoding: "utf-8",
|
|
119
|
-
stdio: ["ignore", "
|
|
119
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (!options["silent"]) {
|
|
124
|
+
console.error(`Failed to import ${dataset.database} schema:`);
|
|
125
|
+
if (error.stderr) {
|
|
126
|
+
console.error(error.stderr);
|
|
127
|
+
}
|
|
128
|
+
if (error.stdout) {
|
|
129
|
+
console.error(error.stdout);
|
|
130
|
+
}
|
|
124
131
|
}
|
|
125
|
-
catch { }
|
|
126
132
|
}
|
|
127
133
|
resolve();
|
|
128
134
|
});
|