@tricoteuses/senat 2.22.8 → 2.22.10
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/config.d.ts +21 -0
- package/lib/config.js +27 -0
- package/lib/databases.d.ts +2 -0
- package/lib/databases.js +26 -0
- package/lib/datasets.d.ts +34 -0
- package/lib/datasets.js +233 -0
- package/lib/git.d.ts +26 -0
- package/lib/git.js +167 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +1 -0
- package/lib/loaders.d.ts +58 -0
- package/lib/loaders.js +286 -0
- package/lib/model/agenda.d.ts +6 -0
- package/lib/model/agenda.js +148 -0
- package/lib/model/ameli.d.ts +51 -0
- package/lib/model/ameli.js +147 -0
- package/lib/model/commission.d.ts +18 -0
- package/lib/model/commission.js +269 -0
- package/lib/model/debats.d.ts +67 -0
- package/lib/model/debats.js +95 -0
- package/lib/model/documents.d.ts +12 -0
- package/lib/model/documents.js +138 -0
- package/lib/model/dosleg.d.ts +7 -0
- package/lib/model/dosleg.js +326 -0
- package/lib/model/index.d.ts +7 -0
- package/lib/model/index.js +7 -0
- package/lib/model/questions.d.ts +45 -0
- package/lib/model/questions.js +89 -0
- package/lib/model/scrutins.d.ts +13 -0
- package/lib/model/scrutins.js +114 -0
- package/lib/model/seance.d.ts +3 -0
- package/lib/model/seance.js +267 -0
- package/lib/model/sens.d.ts +146 -0
- package/lib/model/sens.js +454 -0
- package/lib/model/texte.d.ts +7 -0
- package/lib/model/texte.js +228 -0
- package/lib/model/util.d.ts +9 -0
- package/lib/model/util.js +38 -0
- package/lib/parsers/texte.d.ts +7 -0
- package/lib/parsers/texte.js +228 -0
- package/lib/raw_types/ameli.d.ts +914 -0
- package/lib/raw_types/ameli.js +5 -0
- package/lib/raw_types/debats.d.ts +207 -0
- package/lib/raw_types/debats.js +5 -0
- package/lib/raw_types/dosleg.d.ts +1619 -0
- package/lib/raw_types/dosleg.js +5 -0
- package/lib/raw_types/questions.d.ts +423 -0
- package/lib/raw_types/questions.js +5 -0
- package/lib/raw_types/senat.d.ts +11372 -0
- package/lib/raw_types/senat.js +5 -0
- package/lib/raw_types/sens.d.ts +8248 -0
- package/lib/raw_types/sens.js +5 -0
- package/lib/raw_types_schemats/ameli.d.ts +539 -0
- package/lib/raw_types_schemats/ameli.js +2 -0
- package/lib/raw_types_schemats/debats.d.ts +127 -0
- package/lib/raw_types_schemats/debats.js +2 -0
- package/lib/raw_types_schemats/dosleg.d.ts +977 -0
- package/lib/raw_types_schemats/dosleg.js +2 -0
- package/lib/raw_types_schemats/questions.d.ts +237 -0
- package/lib/raw_types_schemats/questions.js +2 -0
- package/lib/raw_types_schemats/sens.d.ts +6915 -0
- package/lib/raw_types_schemats/sens.js +2 -0
- package/lib/scripts/convert_data.d.ts +1 -0
- package/lib/scripts/convert_data.js +354 -0
- package/lib/scripts/data-download.d.ts +1 -0
- package/lib/scripts/data-download.js +12 -0
- package/lib/scripts/datautil.d.ts +8 -0
- package/lib/scripts/datautil.js +34 -0
- package/lib/scripts/parse_textes.d.ts +1 -0
- package/lib/scripts/parse_textes.js +44 -0
- package/lib/scripts/retrieve_agenda.d.ts +1 -0
- package/lib/scripts/retrieve_agenda.js +132 -0
- package/lib/scripts/retrieve_cr_commission.d.ts +1 -0
- package/lib/scripts/retrieve_cr_commission.js +364 -0
- package/lib/scripts/retrieve_cr_seance.d.ts +6 -0
- package/lib/scripts/retrieve_cr_seance.js +347 -0
- package/lib/scripts/retrieve_documents.d.ts +3 -0
- package/lib/scripts/retrieve_documents.js +219 -0
- package/lib/scripts/retrieve_open_data.d.ts +1 -0
- package/lib/scripts/retrieve_open_data.js +316 -0
- package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
- package/lib/scripts/retrieve_senateurs_photos.js +147 -0
- package/lib/scripts/retrieve_videos.d.ts +1 -0
- package/lib/scripts/retrieve_videos.js +461 -0
- package/lib/scripts/shared/cli_helpers.d.ts +95 -0
- package/lib/scripts/shared/cli_helpers.js +91 -0
- package/lib/scripts/shared/util.d.ts +4 -0
- package/lib/scripts/shared/util.js +35 -0
- package/lib/scripts/test_iter_load.d.ts +1 -0
- package/lib/scripts/test_iter_load.js +12 -0
- package/lib/src/loaders.js +1 -1
- package/lib/src/utils/nvs-timecode.d.ts +17 -0
- package/lib/src/utils/nvs-timecode.js +79 -0
- package/lib/src/utils/scoring.d.ts +3 -0
- package/lib/src/utils/scoring.js +37 -6
- package/lib/src/utils/weights_scoring_config.d.ts +2 -0
- package/lib/src/utils/weights_scoring_config.js +15 -0
- package/lib/src/videos/types.d.ts +2 -2
- package/lib/strings.d.ts +1 -0
- package/lib/strings.js +18 -0
- package/lib/types/agenda.d.ts +44 -0
- package/lib/types/agenda.js +1 -0
- package/lib/types/ameli.d.ts +5 -0
- package/lib/types/ameli.js +1 -0
- package/lib/types/compte_rendu.d.ts +83 -0
- package/lib/types/compte_rendu.js +1 -0
- package/lib/types/debats.d.ts +2 -0
- package/lib/types/debats.js +1 -0
- package/lib/types/dosleg.d.ts +70 -0
- package/lib/types/dosleg.js +1 -0
- package/lib/types/questions.d.ts +2 -0
- package/lib/types/questions.js +1 -0
- package/lib/types/sens.d.ts +10 -0
- package/lib/types/sens.js +1 -0
- package/lib/types/sessions.d.ts +5 -0
- package/lib/types/sessions.js +84 -0
- package/lib/types/texte.d.ts +74 -0
- package/lib/types/texte.js +16 -0
- package/lib/utils/cr_spliting.d.ts +28 -0
- package/lib/utils/cr_spliting.js +265 -0
- package/lib/utils/date.d.ts +10 -0
- package/lib/utils/date.js +100 -0
- package/lib/utils/nvs-timecode.d.ts +7 -0
- package/lib/utils/nvs-timecode.js +79 -0
- package/lib/utils/reunion_grouping.d.ts +11 -0
- package/lib/utils/reunion_grouping.js +337 -0
- package/lib/utils/reunion_odj_building.d.ts +5 -0
- package/lib/utils/reunion_odj_building.js +154 -0
- package/lib/utils/reunion_parsing.d.ts +23 -0
- package/lib/utils/reunion_parsing.js +209 -0
- package/lib/utils/scoring.d.ts +14 -0
- package/lib/utils/scoring.js +147 -0
- package/lib/utils/string_cleaning.d.ts +7 -0
- package/lib/utils/string_cleaning.js +57 -0
- package/lib/validators/config.d.ts +9 -0
- package/lib/validators/config.js +10 -0
- package/package.json +1 -1
package/lib/loaders.js
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import fsex from "fs-extra";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import * as git from "./git";
|
|
5
|
+
import { datasets } from "./datasets";
|
|
6
|
+
import { UNDEFINED_SESSION } from "./types/sessions";
|
|
7
|
+
export { EnabledDatasets } from "./datasets";
|
|
8
|
+
export const AGENDA_FOLDER = "agenda";
|
|
9
|
+
export const COMPTES_RENDUS_FOLDER = "seances";
|
|
10
|
+
export const COMMISSION_FOLDER = "commissions";
|
|
11
|
+
export const DOSLEG_DOSSIERS_FOLDER = "dossiers";
|
|
12
|
+
export const SCRUTINS_FOLDER = "scrutins";
|
|
13
|
+
export const SENS_CIRCONSCRIPTIONS_FOLDER = "circonscriptions";
|
|
14
|
+
export const SENS_ORGANISMES_FOLDER = "organismes";
|
|
15
|
+
export const SENS_SENATEURS_FOLDER = "senateurs";
|
|
16
|
+
export const TEXTE_FOLDER = "leg";
|
|
17
|
+
export const RAPPORT_FOLDER = "rap";
|
|
18
|
+
export const DATA_ORIGINAL_FOLDER = "original";
|
|
19
|
+
export const DATA_TRANSFORMED_FOLDER = "transformed";
|
|
20
|
+
export const DOCUMENT_METADATA_FILE = "metadata.json";
|
|
21
|
+
export function* iterFilePaths(dirPath) {
|
|
22
|
+
if (dirPath && fs.existsSync(dirPath)) {
|
|
23
|
+
const files = fs.readdirSync(dirPath, {
|
|
24
|
+
withFileTypes: true,
|
|
25
|
+
recursive: true,
|
|
26
|
+
});
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
if (file.isFile()) {
|
|
29
|
+
yield path.join(file.parentPath, file.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function* iterLoadSenatItems(dataDir, dataName, legislatureOrSession, subDir, { log = false, sinceCommit } = {}) {
|
|
35
|
+
let itemsDir = path.join(dataDir, dataName);
|
|
36
|
+
if (subDir) {
|
|
37
|
+
itemsDir = path.join(itemsDir, subDir);
|
|
38
|
+
}
|
|
39
|
+
if (legislatureOrSession) {
|
|
40
|
+
itemsDir = path.join(itemsDir, String(legislatureOrSession));
|
|
41
|
+
}
|
|
42
|
+
// Get changed files if sinceCommit is specified (excluding deleted files)
|
|
43
|
+
const changedFiles = sinceCommit
|
|
44
|
+
? git.getChangedFilesSinceCommit(itemsDir, sinceCommit, {
|
|
45
|
+
diffFilter: "AMR", // Added, Modified, Renamed
|
|
46
|
+
})
|
|
47
|
+
: null;
|
|
48
|
+
if (log && sinceCommit) {
|
|
49
|
+
console.log(`Filtering files changed since commit ${sinceCommit} in ${itemsDir}`);
|
|
50
|
+
console.log(`Found ${changedFiles?.size || 0} changed files (AMR)`);
|
|
51
|
+
}
|
|
52
|
+
for (const filePath of iterFilePaths(itemsDir)) {
|
|
53
|
+
if (!filePath.endsWith(".json")) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const relativePath = path.relative(path.join(dataDir, dataName), filePath);
|
|
57
|
+
const gitStatus = changedFiles?.get(relativePath);
|
|
58
|
+
// Filter by changed files if sinceCommit is specified
|
|
59
|
+
if (changedFiles && !gitStatus) {
|
|
60
|
+
// Skip files not in the change set
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (log) {
|
|
64
|
+
console.log(`Loading file: ${filePath}…${gitStatus ? ` (${gitStatus})` : ""}`);
|
|
65
|
+
}
|
|
66
|
+
let item;
|
|
67
|
+
try {
|
|
68
|
+
const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
69
|
+
item = JSON.parse(itemJson);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
console.warn(`[iterLoadSenatItems] skipped invalid JSON: ${filePath} (${err.message})`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const filePathFromDataset = filePath.substring(filePath.indexOf(dataName) + dataName.length);
|
|
76
|
+
yield {
|
|
77
|
+
item,
|
|
78
|
+
filePathFromDataset,
|
|
79
|
+
legislature: legislatureOrSession,
|
|
80
|
+
...(gitStatus && { gitStatus }), // Include gitStatus
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Yield deleted files at the end if sinceCommit is specified
|
|
84
|
+
if (sinceCommit) {
|
|
85
|
+
const deletedFiles = git.getChangedFilesSinceCommit(itemsDir, sinceCommit, {
|
|
86
|
+
diffFilter: "D", // Deleted
|
|
87
|
+
});
|
|
88
|
+
if (log) {
|
|
89
|
+
console.log(`Found ${deletedFiles.size || 0} deleted files (D)`);
|
|
90
|
+
}
|
|
91
|
+
for (const [relativePath, status] of deletedFiles.entries()) {
|
|
92
|
+
const deletedFilePath = path.join(itemsDir, relativePath);
|
|
93
|
+
if (log) {
|
|
94
|
+
console.log(`Deleted file: ${deletedFilePath}`);
|
|
95
|
+
}
|
|
96
|
+
// Extract UID from filename (remove extension) for the placeholder item
|
|
97
|
+
const fileExtension = path.extname(relativePath) || ".json"; // Assuming files use an extension like .json
|
|
98
|
+
const filename = path.basename(relativePath, fileExtension);
|
|
99
|
+
const fakeItem = { uid: filename }; // Placeholder item using uid constraint
|
|
100
|
+
const filePathFromDataset = deletedFilePath.substring(deletedFilePath.indexOf(dataName) + dataName.length);
|
|
101
|
+
yield {
|
|
102
|
+
item: fakeItem,
|
|
103
|
+
filePathFromDataset,
|
|
104
|
+
legislature: legislatureOrSession,
|
|
105
|
+
gitStatus: status,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export function* iterLoadSenatAmendements(dataDir, session, options = {}) {
|
|
111
|
+
for (const amendementItem of iterLoadSenatItems(dataDir, datasets.ameli.database, session, undefined, options)) {
|
|
112
|
+
yield amendementItem;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export function* iterLoadSenatDebats(dataDir, session, options = {}) {
|
|
116
|
+
for (const debatItem of iterLoadSenatItems(dataDir, datasets.debats.database, session, undefined, options)) {
|
|
117
|
+
yield debatItem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function* iterLoadSenatComptesRendusGeneric(dataDir, session, subFolder) {
|
|
121
|
+
const basePath = path.join(dataDir, subFolder, DATA_TRANSFORMED_FOLDER, String(session));
|
|
122
|
+
if (!fs.existsSync(basePath)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const files = (fs.readdirSync(basePath) || []).filter((f) => f.endsWith(".json")).sort();
|
|
126
|
+
for (const fileName of files) {
|
|
127
|
+
const filePath = path.join(basePath, fileName);
|
|
128
|
+
try {
|
|
129
|
+
const fileContent = fs.readFileSync(filePath, "utf-8");
|
|
130
|
+
const compteRendu = JSON.parse(fileContent);
|
|
131
|
+
if (!compteRendu?.uid) {
|
|
132
|
+
console.warn(`[SN] CR without uid → ${fileName}`);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
yield { compteRendu, session };
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
console.warn(`[SN] error reading CR → ${fileName}`, err);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function* iterLoadSenatComptesRendusSeances(dataDir, session) {
|
|
143
|
+
yield* iterLoadSenatComptesRendusGeneric(dataDir, session, COMPTES_RENDUS_FOLDER);
|
|
144
|
+
}
|
|
145
|
+
export function* iterLoadSenatComptesRendusCommissions(dataDir, session) {
|
|
146
|
+
yield* iterLoadSenatComptesRendusGeneric(dataDir, session, COMMISSION_FOLDER);
|
|
147
|
+
}
|
|
148
|
+
export function* iterLoadSenatDossiersLegislatifs(dataDir, session, options = {}) {
|
|
149
|
+
for (const dossierLegislatifItem of iterLoadSenatItems(dataDir, datasets.dosleg.database, session, DOSLEG_DOSSIERS_FOLDER, options)) {
|
|
150
|
+
yield dossierLegislatifItem;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function* iterLoadSenatRapportUrls(dataDir, session) {
|
|
154
|
+
let itemsDir = path.join(dataDir, RAPPORT_FOLDER, DATA_ORIGINAL_FOLDER);
|
|
155
|
+
if (session) {
|
|
156
|
+
itemsDir = path.join(itemsDir, session.toString());
|
|
157
|
+
}
|
|
158
|
+
for (const filePath of iterFilePaths(itemsDir)) {
|
|
159
|
+
const parsedFilePath = path.parse(filePath);
|
|
160
|
+
if (parsedFilePath.base === DOCUMENT_METADATA_FILE) {
|
|
161
|
+
const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
162
|
+
const item = JSON.parse(itemJson);
|
|
163
|
+
yield {
|
|
164
|
+
item,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export function* iterLoadSenatTexteUrls(dataDir, session) {
|
|
170
|
+
let itemsDir = path.join(dataDir, TEXTE_FOLDER, DATA_ORIGINAL_FOLDER);
|
|
171
|
+
if (session) {
|
|
172
|
+
itemsDir = path.join(itemsDir, session.toString());
|
|
173
|
+
}
|
|
174
|
+
for (const filePath of iterFilePaths(itemsDir)) {
|
|
175
|
+
const parsedFilePath = path.parse(filePath);
|
|
176
|
+
if (parsedFilePath.base === DOCUMENT_METADATA_FILE) {
|
|
177
|
+
const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
178
|
+
const item = JSON.parse(itemJson);
|
|
179
|
+
yield {
|
|
180
|
+
item,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
export function* iterLoadSenatDocuments(dataDir, session, documentType, options = {}) {
|
|
186
|
+
for (const { item: dossierLegislatif } of iterLoadSenatDossiersLegislatifs(dataDir, session, options)) {
|
|
187
|
+
for (const lecture of dossierLegislatif["lectures"]) {
|
|
188
|
+
const lecturesSenat = lecture.lectures_assemblee.filter((lectureAssemblee) => lectureAssemblee.assemblee === "Sénat");
|
|
189
|
+
for (const lectureSenat of lecturesSenat) {
|
|
190
|
+
for (const document of lectureSenat[documentType]) {
|
|
191
|
+
const enrichedDocument = {
|
|
192
|
+
signet_dossier: dossierLegislatif["signet"],
|
|
193
|
+
...document,
|
|
194
|
+
};
|
|
195
|
+
const documentItem = {
|
|
196
|
+
item: enrichedDocument,
|
|
197
|
+
};
|
|
198
|
+
if (document.url) {
|
|
199
|
+
const documentName = path.parse(document.url).name;
|
|
200
|
+
documentItem.filePathFromDataset = path.join(`${document.session ?? UNDEFINED_SESSION}`, documentName, `${documentName}.pdf`);
|
|
201
|
+
}
|
|
202
|
+
yield documentItem;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export function* iterLoadSenatRapports(dataDir, session, options = {}) {
|
|
209
|
+
for (const iterItem of iterLoadSenatItems(dataDir, RAPPORT_FOLDER, session, "original", options)) {
|
|
210
|
+
if (iterItem.item?.["id"]) {
|
|
211
|
+
yield iterItem;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export function* iterLoadSenatTextes(dataDir, session, options = {}) {
|
|
216
|
+
for (const iterItem of iterLoadSenatDocuments(dataDir, session, "textes", options)) {
|
|
217
|
+
yield iterItem;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function loadSenatTexteContent(dataDir, textePathFromDataset) {
|
|
221
|
+
const parsedTextePath = path.parse(textePathFromDataset);
|
|
222
|
+
const jsonTexteName = `${parsedTextePath.name}.json`;
|
|
223
|
+
const fullTextePath = path.join(dataDir, TEXTE_FOLDER, DATA_TRANSFORMED_FOLDER, parsedTextePath.dir, jsonTexteName);
|
|
224
|
+
if (!fs.existsSync(fullTextePath)) {
|
|
225
|
+
return { item: null };
|
|
226
|
+
}
|
|
227
|
+
const texteJson = fs.readFileSync(fullTextePath, { encoding: "utf8" });
|
|
228
|
+
return { item: JSON.parse(texteJson) };
|
|
229
|
+
}
|
|
230
|
+
export function loadSenatCompteRenduContent(dataDir, session, debatId) {
|
|
231
|
+
const fullPath = path.join(dataDir, COMPTES_RENDUS_FOLDER, DATA_TRANSFORMED_FOLDER, String(session), `${debatId}.json`);
|
|
232
|
+
if (!fs.existsSync(fullPath)) {
|
|
233
|
+
return { item: null };
|
|
234
|
+
}
|
|
235
|
+
const json = fs.readFileSync(fullPath, { encoding: "utf8" });
|
|
236
|
+
return { item: JSON.parse(json) };
|
|
237
|
+
}
|
|
238
|
+
export function* iterLoadSenatAgendas(dataDir, session) {
|
|
239
|
+
const baseDir = path.join(dataDir, AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER, String(session ?? ""));
|
|
240
|
+
if (!fs.existsSync(baseDir))
|
|
241
|
+
return;
|
|
242
|
+
const files = (fs.readdirSync(baseDir) || []).filter((f) => f.startsWith("RUSN") && f.endsWith(".json")).sort();
|
|
243
|
+
for (const fileName of files) {
|
|
244
|
+
const filePath = path.join(baseDir, fileName);
|
|
245
|
+
let raw;
|
|
246
|
+
try {
|
|
247
|
+
raw = fsex.readJSONSync(filePath);
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
continue; // JSON invalide
|
|
251
|
+
}
|
|
252
|
+
if (!raw || typeof raw !== "object")
|
|
253
|
+
continue;
|
|
254
|
+
const gr = raw;
|
|
255
|
+
if (!gr.uid || !gr.date || !gr.titre)
|
|
256
|
+
continue;
|
|
257
|
+
if (!Array.isArray(gr.events))
|
|
258
|
+
gr.events = [];
|
|
259
|
+
yield { item: gr };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
|
|
263
|
+
for (const circonscriptionItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_CIRCONSCRIPTIONS_FOLDER, options)) {
|
|
264
|
+
yield circonscriptionItem;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
export function* iterLoadSenatOrganismes(dataDir, options = {}) {
|
|
268
|
+
for (const organismeItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_ORGANISMES_FOLDER, options)) {
|
|
269
|
+
yield organismeItem;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
export function* iterLoadSenatSenateurs(dataDir, options = {}) {
|
|
273
|
+
for (const senateurItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_SENATEURS_FOLDER, options)) {
|
|
274
|
+
yield senateurItem;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
export function* iterLoadSenatQuestions(dataDir, legislature, options = {}) {
|
|
278
|
+
for (const questionItem of iterLoadSenatItems(dataDir, datasets.questions.database, legislature, undefined, options)) {
|
|
279
|
+
yield questionItem;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
export function* iterLoadSenatScrutins(dataDir, session, options = {}) {
|
|
283
|
+
for (const scrutinItem of iterLoadSenatItems(dataDir, "scrutins", session, undefined, options)) {
|
|
284
|
+
yield scrutinItem;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AgendaEvent } from "../types/agenda";
|
|
2
|
+
export declare function getStartAndEndTimes(timeStr: string | null | undefined, dateISO: string): {
|
|
3
|
+
startTime: string | null;
|
|
4
|
+
endTime: string | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function parseAgendaFromFile(htmlFilePath: string): Promise<AgendaEvent[] | null>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { JSDOM } from "jsdom";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { ID_DATE_FORMAT, STANDARD_DATE_FORMAT } from "../scripts/datautil";
|
|
5
|
+
const FR_TZ = "Europe/Paris";
|
|
6
|
+
function eventIsSeance(eventElement) {
|
|
7
|
+
return eventElement.classList.contains("evt-seance");
|
|
8
|
+
}
|
|
9
|
+
function getEventType(eventClasses) {
|
|
10
|
+
const typeClass = [...eventClasses].find((className) => className.startsWith("evt-")) || null;
|
|
11
|
+
switch (typeClass) {
|
|
12
|
+
case "evt-seance":
|
|
13
|
+
return "Séance publique";
|
|
14
|
+
case "evt-instanz":
|
|
15
|
+
return "Commissions";
|
|
16
|
+
case "evt-cemi":
|
|
17
|
+
return "Mission de contrôle";
|
|
18
|
+
case "evt-deleg":
|
|
19
|
+
return "Offices et délégations";
|
|
20
|
+
case "evt-bureau":
|
|
21
|
+
return "Instances décisionnelles";
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function getUrlDossierSenat(lienElements) {
|
|
26
|
+
const urlElement = [...lienElements].find((lienElement) => lienElement.textContent?.includes("dossier législatif"));
|
|
27
|
+
return urlElement ? urlElement.getAttribute("href") : null;
|
|
28
|
+
}
|
|
29
|
+
function getQuantieme(eventElement, seancesElements) {
|
|
30
|
+
const seanceIndex = seancesElements.indexOf(eventElement);
|
|
31
|
+
if (seancesElements.length === 1 && seanceIndex === 0) {
|
|
32
|
+
return "Unique";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
switch (seanceIndex) {
|
|
36
|
+
case 0:
|
|
37
|
+
return "Première";
|
|
38
|
+
case 1:
|
|
39
|
+
return "Deuxième";
|
|
40
|
+
case 2:
|
|
41
|
+
return "Troisième";
|
|
42
|
+
case 3:
|
|
43
|
+
return "Quatrième";
|
|
44
|
+
case 4:
|
|
45
|
+
return "Cinquième";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return "Non défini";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Normalize time string to become a simple start time ("H'h'mm") or a duration ("'de 'H'h'mm' à 'H'h'mm").
|
|
52
|
+
*/
|
|
53
|
+
function normalizeTime(timeStr) {
|
|
54
|
+
return timeStr
|
|
55
|
+
?.replace(/^À l'issue de l'espace réservé .* et au plus tard\s/i, "") // Must be processed first
|
|
56
|
+
?.replace(/^(?:le )?matin/i, "10h00") // We chose "matin" to mean 10h00
|
|
57
|
+
?.replace(/^(?:l')?après-midi/i, "16h00") // We chose "après-midi" to mean 16h00
|
|
58
|
+
?.replace(/^(?:le )?soir/i, "20h00") // We chose "soir" to mean 20h00
|
|
59
|
+
?.replace(/^(?:la )?nuit/i, "22h00") // We chose "nuit" to mean 22h00
|
|
60
|
+
?.replace(/^à\s/gi, "")
|
|
61
|
+
?.replace(/heures/gi, "h00")
|
|
62
|
+
?.replace(/\set.*/i, "")
|
|
63
|
+
?.replace(/,.*/, "")
|
|
64
|
+
?.replace(/\s\(hors hémicycle\)/i, "")
|
|
65
|
+
?.replace(/\s*h\s*/gi, "h");
|
|
66
|
+
}
|
|
67
|
+
export function getStartAndEndTimes(timeStr, dateISO) {
|
|
68
|
+
const normalizedTime = normalizeTime(timeStr);
|
|
69
|
+
if (!normalizedTime) {
|
|
70
|
+
return { startTime: null, endTime: null };
|
|
71
|
+
}
|
|
72
|
+
const rangeMatch = normalizedTime.match(/^de (?<start>\d{1,2}h\d{2}) à (?<end>\d{1,2}h\d{2})$/i);
|
|
73
|
+
const toUtcTimeOnly = (value) => {
|
|
74
|
+
if (!value)
|
|
75
|
+
return null;
|
|
76
|
+
const time = DateTime.fromFormat(value, "H'h'mm", { zone: FR_TZ });
|
|
77
|
+
if (!time.isValid)
|
|
78
|
+
return null;
|
|
79
|
+
const local = DateTime.fromISO(dateISO, { zone: FR_TZ }).set({
|
|
80
|
+
hour: time.hour,
|
|
81
|
+
minute: time.minute,
|
|
82
|
+
second: 0,
|
|
83
|
+
millisecond: 0,
|
|
84
|
+
});
|
|
85
|
+
if (!local.isValid)
|
|
86
|
+
return null;
|
|
87
|
+
return local.toUTC().toFormat("HH:mm:ss.SSS'Z'");
|
|
88
|
+
};
|
|
89
|
+
if (rangeMatch?.groups) {
|
|
90
|
+
const { start, end } = rangeMatch.groups;
|
|
91
|
+
return {
|
|
92
|
+
startTime: toUtcTimeOnly(start),
|
|
93
|
+
endTime: toUtcTimeOnly(end),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
startTime: toUtcTimeOnly(normalizedTime),
|
|
98
|
+
endTime: null,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function transformAgenda(document, fileName) {
|
|
102
|
+
const agendaEvents = [];
|
|
103
|
+
const eventElements = document.querySelectorAll(".evt");
|
|
104
|
+
const seanceElements = Array.from(eventElements).filter((eventElement) => eventIsSeance(eventElement));
|
|
105
|
+
for (const eventElement of eventElements) {
|
|
106
|
+
const id = eventElement.previousElementSibling?.getAttribute("name") || null;
|
|
107
|
+
if (!id) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const type = getEventType(eventElement.classList);
|
|
111
|
+
const date = DateTime.fromFormat(fileName, ID_DATE_FORMAT).toFormat(STANDARD_DATE_FORMAT);
|
|
112
|
+
const timeOriginal = eventElement.querySelector(".time")?.textContent || null;
|
|
113
|
+
const { startTime, endTime } = getStartAndEndTimes(timeOriginal, date);
|
|
114
|
+
const titre = eventElement.querySelector(".titre")?.textContent?.trim() || "";
|
|
115
|
+
const organe = eventElement.querySelector(".organe")?.textContent?.trim() || null;
|
|
116
|
+
const objet = eventElement.querySelector(".objet")?.textContent?.trim()?.replace(/^- /, "") || null;
|
|
117
|
+
const lieu = eventElement.querySelector(".lieu")?.textContent || null;
|
|
118
|
+
const videoElement = eventElement.querySelector(".video");
|
|
119
|
+
const urlDossierSenat = getUrlDossierSenat(eventElement.querySelectorAll(".lien a"));
|
|
120
|
+
agendaEvents.push({
|
|
121
|
+
id,
|
|
122
|
+
type,
|
|
123
|
+
date,
|
|
124
|
+
startTime,
|
|
125
|
+
endTime,
|
|
126
|
+
timeOriginal,
|
|
127
|
+
titre,
|
|
128
|
+
organe,
|
|
129
|
+
objet,
|
|
130
|
+
lieu,
|
|
131
|
+
captationVideo: videoElement !== null,
|
|
132
|
+
urlDossierSenat: urlDossierSenat,
|
|
133
|
+
quantieme: eventIsSeance(eventElement) ? getQuantieme(eventElement, seanceElements) : null,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return agendaEvents;
|
|
137
|
+
}
|
|
138
|
+
export async function parseAgendaFromFile(htmlFilePath) {
|
|
139
|
+
try {
|
|
140
|
+
const { document } = (await JSDOM.fromFile(htmlFilePath, { contentType: "text/html" })).window;
|
|
141
|
+
const fileName = path.parse(htmlFilePath).name;
|
|
142
|
+
return transformAgenda(document, fileName);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.error(`Could not parse texte with error ${error}`);
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { InferResult } from "kysely";
|
|
2
|
+
export type AmendementResult = InferResult<typeof findAllAmendementsQuery>[0];
|
|
3
|
+
declare const findAllAmendementsQuery: import("kysely").SelectQueryBuilder<{
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
[x: number]: any;
|
|
6
|
+
[x: symbol]: any;
|
|
7
|
+
}, "ameli.amd" | "ameli.sub" | "ameli.typsub" | "ameli.typrect" | "ameli.txt_ameli" | "ameli.etatxt" | "ameli.ses" | "ameli.typses" | "ameli.nat" | "ameli.lec_ameli" | "dosleg.texte" | "dosleg.lecass" | "ameli.mot" | "ameli.avicom" | "ameli.avigvt" | "ameli.sor" | "ameli.irr" | "ameli.grppol_ameli" | "ameli.com_ameli" | "ameli.cab", {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
nature: string;
|
|
10
|
+
date_depot: string;
|
|
11
|
+
etat: string;
|
|
12
|
+
sort: any;
|
|
13
|
+
url: string;
|
|
14
|
+
auteur_est_gouvernement: boolean;
|
|
15
|
+
scrutin_num: any;
|
|
16
|
+
auteurs: {
|
|
17
|
+
prenom: any;
|
|
18
|
+
homonyme: any;
|
|
19
|
+
nom: any;
|
|
20
|
+
qualite: any;
|
|
21
|
+
rang: any;
|
|
22
|
+
matricule: any;
|
|
23
|
+
groupe_politique_id: any;
|
|
24
|
+
group_politique_code: any;
|
|
25
|
+
groupe_politique_libelle_court: any;
|
|
26
|
+
groupe_politique_libelle: any;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
export declare function findAllAmendements(fromSession?: number): AsyncIterableIterator<{
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
nature: string;
|
|
32
|
+
date_depot: string;
|
|
33
|
+
etat: string;
|
|
34
|
+
sort: any;
|
|
35
|
+
url: string;
|
|
36
|
+
auteur_est_gouvernement: boolean;
|
|
37
|
+
scrutin_num: any;
|
|
38
|
+
auteurs: {
|
|
39
|
+
prenom: any;
|
|
40
|
+
homonyme: any;
|
|
41
|
+
nom: any;
|
|
42
|
+
qualite: any;
|
|
43
|
+
rang: any;
|
|
44
|
+
matricule: any;
|
|
45
|
+
groupe_politique_id: any;
|
|
46
|
+
group_politique_code: any;
|
|
47
|
+
groupe_politique_libelle_court: any;
|
|
48
|
+
groupe_politique_libelle: any;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
2
|
+
import { jsonArrayFrom } from "kysely/helpers/postgres";
|
|
3
|
+
import { dbSenat } from "../databases";
|
|
4
|
+
import { concat, toDateString } from "./util";
|
|
5
|
+
function auteurs(amendementId) {
|
|
6
|
+
return jsonArrayFrom(dbSenat
|
|
7
|
+
.selectFrom("ameli.amdsen")
|
|
8
|
+
.leftJoin("ameli.sen_ameli", "ameli.amdsen.senid", "ameli.sen_ameli.entid")
|
|
9
|
+
.leftJoin("ameli.grppol_ameli", "ameli.amdsen.grpid", "ameli.grppol_ameli.entid")
|
|
10
|
+
.where("ameli.amdsen.amdid", "=", amendementId)
|
|
11
|
+
.select([
|
|
12
|
+
"ameli.amdsen.prenomuse as prenom",
|
|
13
|
+
"ameli.amdsen.hom as homonyme",
|
|
14
|
+
"ameli.amdsen.nomuse as nom",
|
|
15
|
+
"ameli.amdsen.qua as qualite",
|
|
16
|
+
"ameli.amdsen.rng as rang",
|
|
17
|
+
"ameli.sen_ameli.mat as matricule",
|
|
18
|
+
"ameli.amdsen.grpid as groupe_politique_id",
|
|
19
|
+
"ameli.grppol_ameli.cod as group_politique_code",
|
|
20
|
+
"ameli.grppol_ameli.libcou as groupe_politique_libelle_court",
|
|
21
|
+
"ameli.grppol_ameli.lilcou as groupe_politique_libelle",
|
|
22
|
+
])
|
|
23
|
+
.orderBy("ameli.amdsen.rng", "asc"));
|
|
24
|
+
}
|
|
25
|
+
function scrutin(amendementNum, sesann, lecassidt) {
|
|
26
|
+
return dbSenat
|
|
27
|
+
.selectFrom("dosleg.amescr")
|
|
28
|
+
.leftJoin("dosleg.scr", (join) => join
|
|
29
|
+
.onRef("dosleg.amescr.scrnum", "=", "dosleg.scr.scrnum")
|
|
30
|
+
.onRef("dosleg.amescr.sesann", "=", "dosleg.scr.sesann"))
|
|
31
|
+
.leftJoin("dosleg.date_seance", "dosleg.scr.code", "dosleg.date_seance.code")
|
|
32
|
+
.where("dosleg.amescr.amescrnum", "=", amendementNum)
|
|
33
|
+
.where("dosleg.amescr.sesann", "=", sesann)
|
|
34
|
+
.where("dosleg.date_seance.lecidt", "=", lecassidt)
|
|
35
|
+
.select(["dosleg.amescr.scrnum as scrutin_num"])
|
|
36
|
+
.limit(1)
|
|
37
|
+
.as("scrutin_num");
|
|
38
|
+
}
|
|
39
|
+
const findAllAmendementsQuery = dbSenat
|
|
40
|
+
.selectFrom("ameli.amd")
|
|
41
|
+
.leftJoin("ameli.sub", "ameli.amd.subid", "ameli.sub.id")
|
|
42
|
+
.leftJoin("ameli.typsub", "ameli.sub.typid", "ameli.typsub.id")
|
|
43
|
+
.leftJoin("ameli.typrect", "ameli.amd.typrectid", "ameli.typrect.id")
|
|
44
|
+
.leftJoin("ameli.txt_ameli", "ameli.amd.txtid", "ameli.txt_ameli.id")
|
|
45
|
+
.leftJoin("ameli.etatxt", "ameli.txt_ameli.txtetaid", "ameli.etatxt.id")
|
|
46
|
+
.leftJoin("ameli.ses", "ameli.txt_ameli.sesdepid", "ameli.ses.id")
|
|
47
|
+
.leftJoin("ameli.typses", "ameli.typses.id", "ameli.ses.typid")
|
|
48
|
+
.leftJoin("ameli.nat", "ameli.txt_ameli.natid", "ameli.nat.id")
|
|
49
|
+
.leftJoin("ameli.lec_ameli", "ameli.txt_ameli.lecid", "ameli.lec_ameli.id")
|
|
50
|
+
.leftJoin("dosleg.texte", (join) => join.onRef("ameli.ses.ann", "=", "dosleg.texte.sesann").onRef("ameli.txt_ameli.numabs", "=", "dosleg.texte.texnum"))
|
|
51
|
+
.leftJoin("dosleg.lecass", "dosleg.texte.lecassidt", "dosleg.lecass.lecassidt")
|
|
52
|
+
.leftJoin("ameli.mot", "ameli.amd.motid", "ameli.mot.id")
|
|
53
|
+
.leftJoin("ameli.avicom", "ameli.amd.avcid", "ameli.avicom.id")
|
|
54
|
+
.leftJoin("ameli.avigvt", "ameli.amd.avgid", "ameli.avigvt.id")
|
|
55
|
+
.leftJoin("ameli.sor", "ameli.amd.sorid", "ameli.sor.id")
|
|
56
|
+
.leftJoin("ameli.irr", "ameli.amd.irrid", "ameli.irr.id")
|
|
57
|
+
.leftJoin("ameli.grppol_ameli", "ameli.amd.nomentid", "ameli.grppol_ameli.entid")
|
|
58
|
+
.leftJoin("ameli.com_ameli", "ameli.amd.nomentid", "ameli.com_ameli.entid")
|
|
59
|
+
.leftJoin("ameli.cab", "ameli.amd.nomentid", "ameli.cab.entid")
|
|
60
|
+
.select(({ eb, ref, val }) => [
|
|
61
|
+
"ameli.ses.ann as session",
|
|
62
|
+
"ameli.ses.lil as session_libelle",
|
|
63
|
+
"ameli.typses.lib as type_session",
|
|
64
|
+
"ameli.txt_ameli.doslegsignet as signet_dossier_legislatif",
|
|
65
|
+
"ameli.nat.libcourt as nature_texte",
|
|
66
|
+
"ameli.nat.lib as nature_texte_libelle",
|
|
67
|
+
"ameli.txt_ameli.numabs as numero_texte",
|
|
68
|
+
"ameli.txt_ameli.numado as numero_adoption_texte",
|
|
69
|
+
"ameli.txt_ameli.int as intitule_texte",
|
|
70
|
+
"ameli.etatxt.lic as etat_texte",
|
|
71
|
+
"ameli.etatxt.lib as etat_texte_libelle",
|
|
72
|
+
"ameli.etatxt.txttyp as type_texte",
|
|
73
|
+
"ameli.lec_ameli.lib as lecture",
|
|
74
|
+
eb
|
|
75
|
+
.case()
|
|
76
|
+
.when("ameli.amd.typ", "=", "A")
|
|
77
|
+
.then(val("Amendement"))
|
|
78
|
+
.when("ameli.amd.typ", "=", "M")
|
|
79
|
+
.then(val("Motion"))
|
|
80
|
+
.when("ameli.amd.typ", "=", "S")
|
|
81
|
+
.then(val("Sous-amendement"))
|
|
82
|
+
.else("")
|
|
83
|
+
.end()
|
|
84
|
+
.as("nature"),
|
|
85
|
+
"ameli.amd.id as id",
|
|
86
|
+
"ameli.amd.amdperid as parent_id",
|
|
87
|
+
"ameli.amd.ideid as identique_id",
|
|
88
|
+
"ameli.amd.discomid as discussion_commune_id",
|
|
89
|
+
"ameli.amd.num as numero",
|
|
90
|
+
"ameli.amd.numabs as numero_absolu",
|
|
91
|
+
"ameli.amd.ord as ordre",
|
|
92
|
+
"ameli.amd.accgou as accepte_gouvernement",
|
|
93
|
+
"ameli.amd.txtid as texte_id",
|
|
94
|
+
"ameli.sub.lib as subdivision_libelle",
|
|
95
|
+
"ameli.sub.lic as subdivision_libelle_court",
|
|
96
|
+
"ameli.sub.pos as subdivision_position_texte",
|
|
97
|
+
"ameli.sub.posder as subdivision_position_discussion",
|
|
98
|
+
"ameli.sub.merid as subdivision_mere_id",
|
|
99
|
+
"ameli.sub.sig as subdivision_signet",
|
|
100
|
+
"ameli.sub.comdelid as subdivision_commission_id",
|
|
101
|
+
"ameli.sub.dupl as subdivision_dupliquee",
|
|
102
|
+
"ameli.typsub.lib as subdivision_type",
|
|
103
|
+
"ameli.amd.alinea as alinea",
|
|
104
|
+
"ameli.amd.obs as observations",
|
|
105
|
+
"ameli.amd.mot as observations_additionnelles",
|
|
106
|
+
toDateString(ref("ameli.amd.datdep")).as("date_depot"),
|
|
107
|
+
"ameli.amd.dis as dispositif",
|
|
108
|
+
"ameli.amd.obj as objet",
|
|
109
|
+
"ameli.typrect.lib as type_rectification",
|
|
110
|
+
"ameli.mot.lib as motion_libelle",
|
|
111
|
+
eb
|
|
112
|
+
.case()
|
|
113
|
+
.when("ameli.amd.etaid", "=", 7)
|
|
114
|
+
.then(val("Diffusé"))
|
|
115
|
+
.when("ameli.amd.etaid", "=", 8)
|
|
116
|
+
.then(val("Retiré avant réunion ou séance"))
|
|
117
|
+
.when("ameli.amd.etaid", "=", 9)
|
|
118
|
+
.then(val("Examiné en commission ou séance"))
|
|
119
|
+
.when("ameli.amd.etaid", "=", 10)
|
|
120
|
+
.then(val("Irrecevable"))
|
|
121
|
+
.when("ameli.amd.etaid", "=", 11)
|
|
122
|
+
.then(val("Irrecevable"))
|
|
123
|
+
.else("")
|
|
124
|
+
.end()
|
|
125
|
+
.as("etat"),
|
|
126
|
+
"ameli.avicom.lib as avis_commission",
|
|
127
|
+
"ameli.avigvt.lib as avis_gouvernement",
|
|
128
|
+
eb.fn.coalesce("ameli.sor.lib", "ameli.irr.libirr").as("sort"),
|
|
129
|
+
"ameli.amd.rev as revision",
|
|
130
|
+
concat(eb
|
|
131
|
+
.case()
|
|
132
|
+
.when("ameli.amd.num", "like", "%COM%")
|
|
133
|
+
.then(val("https://www.senat.fr/amendements/commissions/"))
|
|
134
|
+
.else(val("https://www.senat.fr/amendements/"))
|
|
135
|
+
.end(), ref("ameli.ses.ann"), val("-"), sql `(ameli.ses.ann + 1)`, val("/"), ref("ameli.txt_ameli.numabs"), val("/Amdt_"), ref("ameli.amd.num"), val(".html")).as("url"),
|
|
136
|
+
"ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
137
|
+
"ameli.com_ameli.lil as au_nom_de_commission",
|
|
138
|
+
eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
|
|
139
|
+
scrutin(ref("ameli.amd.num"), ref("ameli.ses.ann"), ref("dosleg.texte.lecassidt")),
|
|
140
|
+
auteurs(ref("ameli.amd.id")).as("auteurs"),
|
|
141
|
+
]);
|
|
142
|
+
export function findAllAmendements(fromSession) {
|
|
143
|
+
if (fromSession !== undefined) {
|
|
144
|
+
return findAllAmendementsQuery.where("ameli.ses.ann", ">=", fromSession).stream();
|
|
145
|
+
}
|
|
146
|
+
return findAllAmendementsQuery.stream();
|
|
147
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as cheerio from "cheerio";
|
|
2
|
+
import { CompteRendu } from "../types/compte_rendu";
|
|
3
|
+
import { Reunion } from "../types/agenda";
|
|
4
|
+
export declare function getRemainingTextAfterSpeakerHeader($: cheerio.CheerioAPI, $p: cheerio.Cheerio<any>): string;
|
|
5
|
+
export type DaySection = {
|
|
6
|
+
title: string;
|
|
7
|
+
$start: cheerio.Cheerio<any>;
|
|
8
|
+
time?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function cleanTitle(t: string): string;
|
|
11
|
+
export declare function extractDayH3Sections($: cheerio.CheerioAPI, dateISO: string): DaySection[];
|
|
12
|
+
export declare function parseCommissionCRSectionFromDom($: cheerio.CheerioAPI, htmlFilePath: string, opts: {
|
|
13
|
+
dateISO: string;
|
|
14
|
+
hourShort: string | null;
|
|
15
|
+
organe?: string | null;
|
|
16
|
+
section: DaySection;
|
|
17
|
+
matched?: Reunion;
|
|
18
|
+
}): CompteRendu | null;
|