@tricoteuses/senat 2.20.6 → 2.20.8
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.
- package/lib/model/ameli.js +2 -1
- package/lib/model/commission.js +2 -2
- package/lib/scripts/convert_data.js +11 -15
- package/package.json +1 -1
package/lib/model/ameli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
1
2
|
import { jsonArrayFrom } from "kysely/helpers/postgres";
|
|
2
3
|
import { dbSenat } from "../databases";
|
|
3
4
|
import { concat, toDateString } from "./util";
|
|
@@ -122,7 +123,7 @@ const findAllAmendementsQuery = dbSenat
|
|
|
122
123
|
"ameli.avigvt.lib as avis_gouvernement",
|
|
123
124
|
eb.fn.coalesce("ameli.sor.lib", "ameli.irr.libirr").as("sort"),
|
|
124
125
|
"ameli.amd.rev as revision",
|
|
125
|
-
concat(val("https://www.senat.fr/amendements/"), ref("ameli.ses.
|
|
126
|
+
concat(val("https://www.senat.fr/amendements/"), ref("ameli.ses.ann"), val("-"), sql `(ameli.ses.ann + 1)`, val("/"), ref("ameli.txt_ameli.numabs"), val("/Amdt_"), ref("ameli.amd.numabs"), val(".html")).as("url"),
|
|
126
127
|
"ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
127
128
|
"ameli.com_ameli.lil as au_nom_de_commission",
|
|
128
129
|
eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
|
package/lib/model/commission.js
CHANGED
|
@@ -234,8 +234,8 @@ export function parseCommissionCRSectionFromDom($, htmlFilePath, opts) {
|
|
|
234
234
|
$cursor = $cursor.next();
|
|
235
235
|
}
|
|
236
236
|
const points = buildPointsFromParagraphs($, paras);
|
|
237
|
-
if (points.length < 4) {
|
|
238
|
-
console.warn(`[COM-CR][parse] Insufficient points found for section
|
|
237
|
+
if (points.length < 4 || !points.some((pt) => pt.code_grammaire === "PAROLE_GENERIQUE" && pt.orateurs)) {
|
|
238
|
+
console.warn(`[COM-CR][parse] Insufficient points or no interventions found for a section in ${path.basename(htmlFilePath)}`);
|
|
239
239
|
return null;
|
|
240
240
|
}
|
|
241
241
|
const session = dateISO.slice(5, 7) >= "10" ? `${dateISO.slice(0, 4)}` : `${Number(dateISO.slice(0, 4)) - 1}`;
|
|
@@ -122,22 +122,18 @@ async function convertDatasetScrutins(dataDir, options) {
|
|
|
122
122
|
}
|
|
123
123
|
const scrutinsReorganizedDir = path.join(dataDir, SCRUTINS_FOLDER);
|
|
124
124
|
ensureAndClearDir(scrutinsReorganizedDir);
|
|
125
|
-
const limit = pLimit(10);
|
|
126
|
-
const tasks = [];
|
|
127
125
|
for await (const scrutin of findAllScrutins(options["fromSession"])) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
}));
|
|
126
|
+
if (options["verbose"]) {
|
|
127
|
+
console.log(`Converting ${scrutin["numero"]} file…`);
|
|
128
|
+
}
|
|
129
|
+
let scrutinReorganizedDir = path.join(scrutinsReorganizedDir, String(UNDEFINED_SESSION));
|
|
130
|
+
const session = scrutin["session"] || UNDEFINED_SESSION;
|
|
131
|
+
scrutinReorganizedDir = path.join(scrutinsReorganizedDir, String(session));
|
|
132
|
+
await fs.ensureDir(scrutinReorganizedDir);
|
|
133
|
+
const scrutinFileName = `${scrutin["numero"]}.json`;
|
|
134
|
+
await fs.writeJSON(path.join(scrutinReorganizedDir, scrutinFileName), scrutin, {
|
|
135
|
+
spaces: 2,
|
|
136
|
+
});
|
|
141
137
|
}
|
|
142
138
|
}
|
|
143
139
|
async function convertDatasetQuestions(dataDir) {
|