@tricoteuses/senat 3.1.15 → 3.1.17
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs, { ensureDir } from "fs-extra";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import * as cheerio from "cheerio";
|
|
4
|
-
import { COMMISSION_FOLDER, DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER } from "../server/loaders.js";
|
|
4
|
+
import { AGENDA_FOLDER, COMMISSION_FOLDER, DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER } from "../server/loaders.js";
|
|
5
5
|
import { loadAgendaForDate, parseCommissionMetadataFromHtml, linkCRtoCommissionGroup } from "../utils/cr_spliting.js";
|
|
6
6
|
import { cleanTitle, extractDayH3Sections, parseCommissionCRSectionFromDom } from "../server/commission.js";
|
|
7
7
|
import commandLineArgs from "command-line-args";
|
|
@@ -360,7 +360,9 @@ async function retrieveCommissionCRs(options = {}) {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
const debatsDir = path.join(dataDir, COMMISSION_FOLDER);
|
|
363
|
+
const agendaDir = path.join(dataDir, AGENDA_FOLDER);
|
|
363
364
|
commitAndPushGit(debatsDir, options);
|
|
365
|
+
commitAndPushGit(agendaDir, options);
|
|
364
366
|
}
|
|
365
367
|
async function main() {
|
|
366
368
|
assertExistingDirectory(options["dataDir"], "data directory");
|
|
@@ -206,7 +206,9 @@ export async function retrieveCriXmlDump(dataDir, options = {}) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
const debatsDir = path.join(dataDir, COMPTES_RENDUS_FOLDER);
|
|
209
|
+
const agendaDir = path.join(dataDir, AGENDA_FOLDER);
|
|
209
210
|
commitAndPushGit(debatsDir, options);
|
|
211
|
+
commitAndPushGit(agendaDir, options);
|
|
210
212
|
}
|
|
211
213
|
function commitAndPushGit(datasetDir, options) {
|
|
212
214
|
if (options.commit) {
|
|
@@ -168,8 +168,8 @@ async function processAll(dataDir, sessions) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
commitAndPushGit(
|
|
171
|
+
const agendaDir = path.join(dataDir, AGENDA_FOLDER);
|
|
172
|
+
commitAndPushGit(agendaDir, options);
|
|
173
173
|
}
|
|
174
174
|
function commitAndPushGit(datasetDir, options) {
|
|
175
175
|
if (options.commit) {
|
|
@@ -44,7 +44,7 @@ export declare function loadSenatTexteContent(dataDir: string, session: number |
|
|
|
44
44
|
export declare function loadSenatCompteRenduContent(dataDir: string, session: number, debatId: string | number): {
|
|
45
45
|
item: CompteRendu | null;
|
|
46
46
|
};
|
|
47
|
-
export declare function iterLoadSenatAgendas(dataDir: string, session: number | undefined): Generator<IterItem<Reunion>>;
|
|
47
|
+
export declare function iterLoadSenatAgendas(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<Reunion>>;
|
|
48
48
|
export declare function iterLoadSenatCirconscriptions(dataDir: string, options?: {}): Generator<IterItem<CirconscriptionResult>>;
|
|
49
49
|
export declare function iterLoadSenatOrganismes(dataDir: string, options?: {}): Generator<IterItem<OrganismeResult>>;
|
|
50
50
|
export declare function iterLoadSenatSenateurs(dataDir: string, options?: {}): Generator<IterItem<SenateurResult>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fsex from "fs-extra";
|
|
2
1
|
import fs from "fs";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import * as git from "./git.js";
|
|
@@ -207,30 +206,16 @@ export function loadSenatCompteRenduContent(dataDir, session, debatId) {
|
|
|
207
206
|
const json = fs.readFileSync(fullPath, { encoding: "utf8" });
|
|
208
207
|
return { item: JSON.parse(json) };
|
|
209
208
|
}
|
|
210
|
-
export function* iterLoadSenatAgendas(dataDir, session) {
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
return;
|
|
214
|
-
const files = (fs.readdirSync(baseDir) || []).filter((f) => f.startsWith("RUSN") && f.endsWith(".json")).sort();
|
|
215
|
-
for (const fileName of files) {
|
|
216
|
-
const filePath = path.join(baseDir, fileName);
|
|
217
|
-
let raw;
|
|
218
|
-
try {
|
|
219
|
-
raw = fsex.readJSONSync(filePath);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
continue; // JSON invalide
|
|
223
|
-
}
|
|
224
|
-
if (!raw || typeof raw !== "object")
|
|
225
|
-
continue;
|
|
226
|
-
const gr = raw;
|
|
209
|
+
export function* iterLoadSenatAgendas(dataDir, session, options = {}) {
|
|
210
|
+
for (const reunionItem of iterLoadSenatItems(dataDir, AGENDA_FOLDER, session, DATA_TRANSFORMED_FOLDER, options)) {
|
|
211
|
+
const gr = reunionItem.item;
|
|
227
212
|
if (!gr.uid || !gr.date || !gr.titre)
|
|
228
213
|
continue;
|
|
229
|
-
|
|
214
|
+
reunionItem.item = {
|
|
230
215
|
...gr,
|
|
231
216
|
events: Array.isArray(gr.events) ? gr.events : [],
|
|
232
217
|
};
|
|
233
|
-
yield
|
|
218
|
+
yield reunionItem;
|
|
234
219
|
}
|
|
235
220
|
}
|
|
236
221
|
export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
|