@tricoteuses/senat 2.22.5 → 2.22.7
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 +12 -1
- package/lib/config.js +12 -1
- package/lib/loaders.js +1 -1
- package/lib/model/ameli.js +1 -3
- package/lib/model/documents.js +5 -18
- package/lib/model/dosleg.js +11 -11
- package/lib/model/texte.js +15 -43
- package/lib/raw_types/questions.d.ts +4 -0
- package/lib/raw_types/senat.d.ts +4 -0
- package/lib/raw_types_schemats/ameli.d.ts +1 -1
- package/lib/raw_types_schemats/debats.d.ts +1 -1
- package/lib/raw_types_schemats/dosleg.d.ts +1 -1
- package/lib/raw_types_schemats/questions.d.ts +3 -1
- package/lib/raw_types_schemats/sens.d.ts +1 -1
- package/lib/scripts/convert_data.js +3 -3
- package/lib/scripts/parse_textes.js +2 -2
- package/lib/scripts/retrieve_open_data.js +1 -0
- package/lib/scripts/test_iter_load.js +1 -1
- package/lib/src/model/ameli.d.ts +4 -0
- package/lib/src/model/ameli.js +3 -3
- package/lib/src/scripts/retrieve_videos.js +1 -0
- package/lib/src/types/agenda.d.ts +1 -0
- package/lib/src/utils/nvs-timecode.d.ts +17 -0
- package/lib/src/utils/nvs-timecode.js +79 -0
- 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/pipeline.d.ts +2 -0
- package/lib/src/videos/pipeline.js +3 -2
- package/lib/utils/reunion_grouping.d.ts +4 -2
- package/lib/utils/reunion_grouping.js +6 -30
- package/package.json +1 -1
- package/lib/aggregates.d.ts +0 -52
- package/lib/aggregates.js +0 -930
- package/lib/aggregates.mjs +0 -713
- package/lib/aggregates.ts +0 -833
- package/lib/config.mjs +0 -16
- package/lib/config.ts +0 -26
- package/lib/databases.mjs +0 -57
- package/lib/databases.ts +0 -71
- package/lib/datasets.mjs +0 -78
- package/lib/datasets.ts +0 -118
- package/lib/fields.d.ts +0 -10
- package/lib/fields.js +0 -68
- package/lib/fields.mjs +0 -22
- package/lib/fields.ts +0 -29
- package/lib/index.mjs +0 -7
- package/lib/index.ts +0 -64
- package/lib/inserters.d.ts +0 -98
- package/lib/inserters.js +0 -500
- package/lib/inserters.mjs +0 -360
- package/lib/inserters.ts +0 -521
- package/lib/legislatures.json +0 -38
- package/lib/loaders.mjs +0 -158
- package/lib/loaders.ts +0 -271
- package/lib/model/ameli.mjs +0 -84
- package/lib/model/ameli.ts +0 -100
- package/lib/model/debats.mjs +0 -43
- package/lib/model/debats.ts +0 -68
- package/lib/model/dosleg.mjs +0 -196
- package/lib/model/dosleg.ts +0 -240
- package/lib/model/index.mjs +0 -5
- package/lib/model/index.ts +0 -15
- package/lib/model/questions.mjs +0 -71
- package/lib/model/questions.ts +0 -93
- package/lib/model/sens.mjs +0 -415
- package/lib/model/sens.ts +0 -516
- package/lib/model/texte.mjs +0 -208
- package/lib/model/texte.ts +0 -229
- package/lib/model/util.mjs +0 -19
- package/lib/model/util.ts +0 -32
- package/lib/raw_types/ameli.mjs +0 -163
- package/lib/raw_types/debats.mjs +0 -58
- package/lib/raw_types/dosleg.mjs +0 -438
- package/lib/raw_types/questions.mjs +0 -11
- package/lib/raw_types/sens.mjs +0 -508
- package/lib/raw_types_kysely/ameli.d.ts +0 -915
- package/lib/raw_types_kysely/ameli.js +0 -7
- package/lib/raw_types_kysely/ameli.mjs +0 -5
- package/lib/raw_types_kysely/ameli.ts +0 -951
- package/lib/raw_types_kysely/debats.d.ts +0 -207
- package/lib/raw_types_kysely/debats.js +0 -7
- package/lib/raw_types_kysely/debats.mjs +0 -5
- package/lib/raw_types_kysely/debats.ts +0 -222
- package/lib/raw_types_kysely/dosleg.d.ts +0 -3532
- package/lib/raw_types_kysely/dosleg.js +0 -7
- package/lib/raw_types_kysely/dosleg.mjs +0 -5
- package/lib/raw_types_kysely/dosleg.ts +0 -3621
- package/lib/raw_types_kysely/questions.d.ts +0 -414
- package/lib/raw_types_kysely/questions.js +0 -7
- package/lib/raw_types_kysely/questions.mjs +0 -5
- package/lib/raw_types_kysely/questions.ts +0 -426
- package/lib/raw_types_kysely/sens.d.ts +0 -4394
- package/lib/raw_types_kysely/sens.js +0 -7
- package/lib/raw_types_kysely/sens.mjs +0 -5
- package/lib/raw_types_kysely/sens.ts +0 -4499
- package/lib/raw_types_schemats/ameli.mjs +0 -2
- package/lib/raw_types_schemats/ameli.ts +0 -601
- package/lib/raw_types_schemats/debats.mjs +0 -2
- package/lib/raw_types_schemats/debats.ts +0 -145
- package/lib/raw_types_schemats/dosleg.mjs +0 -2
- package/lib/raw_types_schemats/dosleg.ts +0 -2193
- package/lib/raw_types_schemats/questions.mjs +0 -2
- package/lib/raw_types_schemats/questions.ts +0 -249
- package/lib/raw_types_schemats/sens.mjs +0 -2
- package/lib/raw_types_schemats/sens.ts +0 -2907
- package/lib/scripts/convert_data.mjs +0 -181
- package/lib/scripts/convert_data.ts +0 -243
- package/lib/scripts/datautil.mjs +0 -16
- package/lib/scripts/datautil.ts +0 -19
- package/lib/scripts/images/transparent_150x192.jpg +0 -0
- package/lib/scripts/images/transparent_155x225.jpg +0 -0
- package/lib/scripts/parse_textes.mjs +0 -46
- package/lib/scripts/parse_textes.ts +0 -65
- package/lib/scripts/retrieve_documents.mjs +0 -249
- package/lib/scripts/retrieve_documents.ts +0 -298
- package/lib/scripts/retrieve_open_data.mjs +0 -217
- package/lib/scripts/retrieve_open_data.ts +0 -268
- package/lib/scripts/retrieve_senateurs_photos.mjs +0 -147
- package/lib/scripts/retrieve_senateurs_photos.ts +0 -177
- package/lib/scripts/shared/cli_helpers.ts +0 -36
- package/lib/scripts/shared/util.ts +0 -33
- package/lib/strings.mjs +0 -18
- package/lib/strings.ts +0 -26
- package/lib/types/ameli.mjs +0 -13
- package/lib/types/ameli.ts +0 -21
- package/lib/types/debats.mjs +0 -2
- package/lib/types/debats.ts +0 -6
- package/lib/types/dosleg.mjs +0 -151
- package/lib/types/dosleg.ts +0 -284
- package/lib/types/questions.mjs +0 -1
- package/lib/types/questions.ts +0 -3
- package/lib/types/sens.mjs +0 -1
- package/lib/types/sens.ts +0 -12
- package/lib/types/sessions.mjs +0 -43
- package/lib/types/sessions.ts +0 -42
- package/lib/types/texte.mjs +0 -16
- package/lib/types/texte.ts +0 -76
- package/lib/typings/windows-1252.d.js +0 -2
- package/lib/typings/windows-1252.d.mjs +0 -2
- package/lib/typings/windows-1252.d.ts +0 -11
- package/lib/validators/config.mjs +0 -54
- package/lib/validators/config.ts +0 -79
- package/lib/validators/senat.d.ts +0 -0
- package/lib/validators/senat.js +0 -28
- package/lib/validators/senat.mjs +0 -24
- package/lib/validators/senat.ts +0 -26
package/lib/config.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const configSchema: z.ZodObject<{
|
|
4
|
+
db: z.ZodObject<{
|
|
5
|
+
host: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
password: z.ZodString;
|
|
8
|
+
port: z.ZodCoercedNumber<unknown>;
|
|
9
|
+
user: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>;
|
|
2
12
|
declare const _default: {
|
|
3
13
|
db: {
|
|
4
14
|
host: string;
|
|
15
|
+
name: string;
|
|
5
16
|
password: string;
|
|
6
|
-
user: string;
|
|
7
17
|
port: number;
|
|
18
|
+
user: string;
|
|
8
19
|
};
|
|
9
20
|
};
|
|
10
21
|
export default _default;
|
package/lib/config.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import {
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const dbSchema = z.object({
|
|
4
|
+
host: z.string().trim().min(1, "Must not be empty"),
|
|
5
|
+
name: z.string().trim().min(1, "Must not be empty"),
|
|
6
|
+
password: z.string().trim().min(1, "Must not be empty"),
|
|
7
|
+
port: z.coerce.number().int().min(0).max(65535),
|
|
8
|
+
user: z.string().trim().min(1, "Must not be empty"),
|
|
9
|
+
});
|
|
10
|
+
export const configSchema = z.object({
|
|
11
|
+
db: dbSchema,
|
|
12
|
+
});
|
|
3
13
|
const config = {
|
|
4
14
|
db: {
|
|
5
15
|
host: process.env["TRICOTEUSES_SENAT_DB_HOST"] || "localhost",
|
|
16
|
+
name: process.env["TRICOTEUSES_SENAT_DB_NAME"] || "postgres",
|
|
6
17
|
password: process.env["TRICOTEUSES_SENAT_DB_PASSWORD"] || "opendata",
|
|
7
18
|
port: process.env["TRICOTEUSES_SENAT_DB_PORT"] || 5432,
|
|
8
19
|
user: process.env["TRICOTEUSES_SENAT_DB_USER"] || "opendata",
|
package/lib/loaders.js
CHANGED
|
@@ -193,7 +193,7 @@ export function* iterLoadSenatDocuments(dataDir, session, documentType, options
|
|
|
193
193
|
...document,
|
|
194
194
|
};
|
|
195
195
|
const documentItem = {
|
|
196
|
-
item: enrichedDocument
|
|
196
|
+
item: enrichedDocument,
|
|
197
197
|
};
|
|
198
198
|
if (document.url) {
|
|
199
199
|
const documentName = path.parse(document.url).name;
|
package/lib/model/ameli.js
CHANGED
|
@@ -47,9 +47,7 @@ const findAllAmendementsQuery = dbSenat
|
|
|
47
47
|
.leftJoin("ameli.typses", "ameli.typses.id", "ameli.ses.typid")
|
|
48
48
|
.leftJoin("ameli.nat", "ameli.txt_ameli.natid", "ameli.nat.id")
|
|
49
49
|
.leftJoin("ameli.lec_ameli", "ameli.txt_ameli.lecid", "ameli.lec_ameli.id")
|
|
50
|
-
.leftJoin("dosleg.texte", (join) => join
|
|
51
|
-
.onRef("ameli.ses.ann", "=", "dosleg.texte.sesann")
|
|
52
|
-
.onRef("ameli.txt_ameli.numabs", "=", "dosleg.texte.texnum"))
|
|
50
|
+
.leftJoin("dosleg.texte", (join) => join.onRef("ameli.ses.ann", "=", "dosleg.texte.sesann").onRef("ameli.txt_ameli.numabs", "=", "dosleg.texte.texnum"))
|
|
53
51
|
.leftJoin("dosleg.lecass", "dosleg.texte.lecassidt", "dosleg.lecass.lecassidt")
|
|
54
52
|
.leftJoin("ameli.mot", "ameli.amd.motid", "ameli.mot.id")
|
|
55
53
|
.leftJoin("ameli.avicom", "ameli.amd.avcid", "ameli.avicom.id")
|
package/lib/model/documents.js
CHANGED
|
@@ -28,10 +28,7 @@ function documentsAttaches(rapportId) {
|
|
|
28
28
|
.selectFrom("docatt")
|
|
29
29
|
.leftJoin("typatt", "docatt.typattcod", "typatt.typattcod")
|
|
30
30
|
.where("docatt.rapcod", "=", rapportId)
|
|
31
|
-
.select([
|
|
32
|
-
"docatt.docatturl as url",
|
|
33
|
-
"typatt.typattlib as type_document"
|
|
34
|
-
]));
|
|
31
|
+
.select(["docatt.docatturl as url", "typatt.typattlib as type_document"]));
|
|
35
32
|
}
|
|
36
33
|
function selectRapportAttributes({ eb, ref, val }) {
|
|
37
34
|
return [
|
|
@@ -70,14 +67,9 @@ const queryRapports = baseQueryRapports
|
|
|
70
67
|
.leftJoin("lecass", "lecass.lecassidt", "lecassrap.lecassidt")
|
|
71
68
|
.leftJoin("lecture", "lecture.lecidt", "lecass.lecidt")
|
|
72
69
|
.leftJoin("loi", "loi.loicod", "lecture.loicod")
|
|
73
|
-
.select((args) => [
|
|
74
|
-
"loi.signet as signet_dossier",
|
|
75
|
-
...selectRapportAttributes(args),
|
|
76
|
-
]);
|
|
70
|
+
.select((args) => ["loi.signet as signet_dossier", ...selectRapportAttributes(args)]);
|
|
77
71
|
export function rapports(lectureAssembleeId) {
|
|
78
|
-
return jsonArrayFrom(baseQueryRapports
|
|
79
|
-
.select(selectRapportAttributes)
|
|
80
|
-
.where("lecassrap.lecassidt", "=", lectureAssembleeId));
|
|
72
|
+
return jsonArrayFrom(baseQueryRapports.select(selectRapportAttributes).where("lecassrap.lecassidt", "=", lectureAssembleeId));
|
|
81
73
|
}
|
|
82
74
|
function auteursTexte(texteId) {
|
|
83
75
|
return jsonArrayFrom(dbSenat
|
|
@@ -134,14 +126,9 @@ const queryTextes = baseQueryTextes
|
|
|
134
126
|
.leftJoin("lecass", "lecass.lecassidt", "texte.lecassidt")
|
|
135
127
|
.leftJoin("lecture", "lecture.lecidt", "lecass.lecidt")
|
|
136
128
|
.leftJoin("loi", "loi.loicod", "lecture.loicod")
|
|
137
|
-
.select((args) => [
|
|
138
|
-
"loi.signet as signet_dossier",
|
|
139
|
-
...selectTexteAttributes(args),
|
|
140
|
-
]);
|
|
129
|
+
.select((args) => ["loi.signet as signet_dossier", ...selectTexteAttributes(args)]);
|
|
141
130
|
export function textes(lectureAssembleeId) {
|
|
142
|
-
return jsonArrayFrom(baseQueryTextes
|
|
143
|
-
.select(selectTexteAttributes)
|
|
144
|
-
.where("texte.lecassidt", "=", lectureAssembleeId));
|
|
131
|
+
return jsonArrayFrom(baseQueryTextes.select(selectTexteAttributes).where("texte.lecassidt", "=", lectureAssembleeId));
|
|
145
132
|
}
|
|
146
133
|
export function findAllTextes() {
|
|
147
134
|
return queryTextes.stream();
|
package/lib/model/dosleg.js
CHANGED
|
@@ -203,10 +203,10 @@ export function buildActesLegislatifs(dossier) {
|
|
|
203
203
|
numero: depotTexte.numero,
|
|
204
204
|
uid: `${loiSignet}-${phasePrefix}-DEPOT`,
|
|
205
205
|
session: lecAss.session,
|
|
206
|
-
chambre:
|
|
206
|
+
chambre: "SN",
|
|
207
207
|
signet_dossier: loiSignet,
|
|
208
208
|
texte_url: depotTexte.url,
|
|
209
|
-
code_organisme: null
|
|
209
|
+
code_organisme: null,
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
// =================================================================
|
|
@@ -225,7 +225,7 @@ export function buildActesLegislatifs(dossier) {
|
|
|
225
225
|
adoption: rap.adoption,
|
|
226
226
|
uid: `${loiSignet}-${phasePrefix}-COM`,
|
|
227
227
|
session: lecAss.session,
|
|
228
|
-
chambre:
|
|
228
|
+
chambre: "SN",
|
|
229
229
|
signet_dossier: loiSignet,
|
|
230
230
|
texte_url: rap.url,
|
|
231
231
|
});
|
|
@@ -247,9 +247,9 @@ export function buildActesLegislatifs(dossier) {
|
|
|
247
247
|
libelle: `Discussion en séance publique`,
|
|
248
248
|
uid: `${loiSignet}-${phasePrefix}-DEBATS-SEANCE`,
|
|
249
249
|
session: lecAss.session,
|
|
250
|
-
chambre:
|
|
250
|
+
chambre: "SN",
|
|
251
251
|
signet_dossier: loiSignet,
|
|
252
|
-
code_organisme: null
|
|
252
|
+
code_organisme: null,
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
}
|
|
@@ -281,10 +281,10 @@ export function buildActesLegislatifs(dossier) {
|
|
|
281
281
|
adoption: libelleStatut,
|
|
282
282
|
uid: `${loiSignet}-DEC-${texteFinal.numero}`,
|
|
283
283
|
session: lecAss.session,
|
|
284
|
-
chambre:
|
|
284
|
+
chambre: "SN",
|
|
285
285
|
signet_dossier: loiSignet,
|
|
286
286
|
texte_url: texteFinal.url,
|
|
287
|
-
code_organisme: null
|
|
287
|
+
code_organisme: null,
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -294,19 +294,19 @@ export function buildActesLegislatifs(dossier) {
|
|
|
294
294
|
// =================================================================
|
|
295
295
|
if (dossier.date_decision_CoC) {
|
|
296
296
|
actes.push({
|
|
297
|
-
code_acte:
|
|
297
|
+
code_acte: "CC",
|
|
298
298
|
date: dossier.date_decision_CoC,
|
|
299
299
|
libelle: `Décision du Conseil constitutionnel`,
|
|
300
300
|
id: dossier.url_decision_CoC,
|
|
301
301
|
uid: `${loiSignet}-CC`,
|
|
302
|
-
chambre:
|
|
302
|
+
chambre: "AN",
|
|
303
303
|
signet_dossier: loiSignet,
|
|
304
304
|
texte_url: dossier.url_decision_CoC || dossier.url_dossier_CoC,
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
if (dossier.date_promulgation) {
|
|
308
308
|
actes.push({
|
|
309
|
-
code_acte:
|
|
309
|
+
code_acte: "PROM",
|
|
310
310
|
date: dossier.date_promulgation,
|
|
311
311
|
libelle: `Promulgation de la loi`,
|
|
312
312
|
date_publication_JO: dossier.date_publication_JO,
|
|
@@ -314,7 +314,7 @@ export function buildActesLegislatifs(dossier) {
|
|
|
314
314
|
url_legifrance: dossier.url_JO,
|
|
315
315
|
id: dossier.url_JO,
|
|
316
316
|
uid: `${loiSignet}-PROM`,
|
|
317
|
-
chambre:
|
|
317
|
+
chambre: "AN",
|
|
318
318
|
signet_dossier: loiSignet,
|
|
319
319
|
});
|
|
320
320
|
}
|
package/lib/model/texte.js
CHANGED
|
@@ -9,15 +9,11 @@ function buildWorklow(metaElement) {
|
|
|
9
9
|
const identificationParts = AKN_WORKFLOW_IDENTIFICATION_STRUCTURE_REGEXP.exec(identification)?.groups;
|
|
10
10
|
steps.push({
|
|
11
11
|
eId: stepElement.getAttribute("eId"),
|
|
12
|
-
date: stepElement.getAttribute("date")
|
|
13
|
-
? new Date(stepElement.getAttribute("date") ?? "")
|
|
14
|
-
: null,
|
|
12
|
+
date: stepElement.getAttribute("date") ? new Date(stepElement.getAttribute("date") ?? "") : null,
|
|
15
13
|
type: identificationParts?.["type"] || null,
|
|
16
14
|
session: identificationParts?.["session"] || null,
|
|
17
15
|
numero: identificationParts?.["numTexte"] || null,
|
|
18
|
-
version: identificationParts?.["version"]
|
|
19
|
-
? identificationParts["version"]
|
|
20
|
-
: null,
|
|
16
|
+
version: identificationParts?.["version"] ? identificationParts["version"] : null,
|
|
21
17
|
outcome: stepElement.getAttribute("outcome"),
|
|
22
18
|
});
|
|
23
19
|
}
|
|
@@ -131,48 +127,26 @@ function flattenTexte(texteContentRoot) {
|
|
|
131
127
|
export function transformTexte(document) {
|
|
132
128
|
const metaElement = document.querySelector("meta");
|
|
133
129
|
const preambleElement = document.querySelector("preamble");
|
|
134
|
-
const identification = metaElement
|
|
135
|
-
?.querySelector("FRBRExpression FRBRuri")
|
|
136
|
-
?.getAttribute("value") ?? "";
|
|
130
|
+
const identification = metaElement?.querySelector("FRBRExpression FRBRuri")?.getAttribute("value") ?? "";
|
|
137
131
|
const identificationParts = AKN_IDENTIFICATION_STRUCTURE_REGEXP.exec(identification)?.groups;
|
|
138
132
|
const bodyElement = document.querySelector("body");
|
|
139
133
|
const sessionYears = identificationParts?.["session"]?.split("-") || null;
|
|
140
|
-
const datePresentation = metaElement
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const dateDepot = metaElement
|
|
144
|
-
?.querySelector("FRBRdate[name='#depot']")
|
|
145
|
-
?.getAttribute("date");
|
|
146
|
-
const datePublicationXml = metaElement
|
|
147
|
-
?.querySelector("FRBRdate[name='#publication-xml']")
|
|
148
|
-
?.getAttribute("date");
|
|
134
|
+
const datePresentation = metaElement?.querySelector("FRBRdate[name='#presentation']")?.getAttribute("date");
|
|
135
|
+
const dateDepot = metaElement?.querySelector("FRBRdate[name='#depot']")?.getAttribute("date");
|
|
136
|
+
const datePublicationXml = metaElement?.querySelector("FRBRdate[name='#publication-xml']")?.getAttribute("date");
|
|
149
137
|
return {
|
|
150
138
|
titre: preambleElement?.querySelector("docTitle")?.textContent || null,
|
|
151
|
-
titreCourt: metaElement
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
?.querySelector("FRBRalias[name='signet-dossier-legislatif-senat']")
|
|
156
|
-
?.getAttribute("value") || null,
|
|
157
|
-
urlDossierSenat: metaElement
|
|
158
|
-
?.querySelector("FRBRalias[name='url-senat']")
|
|
159
|
-
?.getAttribute("value") || null,
|
|
160
|
-
urlDossierAssemblee: metaElement
|
|
161
|
-
?.querySelector("FRBRalias[name='url-AN']")
|
|
162
|
-
?.getAttribute("value") || null,
|
|
139
|
+
titreCourt: metaElement?.querySelector("FRBRalias[name='intitule-court']")?.getAttribute("value") || null,
|
|
140
|
+
signetDossier: metaElement?.querySelector("FRBRalias[name='signet-dossier-legislatif-senat']")?.getAttribute("value") || null,
|
|
141
|
+
urlDossierSenat: metaElement?.querySelector("FRBRalias[name='url-senat']")?.getAttribute("value") || null,
|
|
142
|
+
urlDossierAssemblee: metaElement?.querySelector("FRBRalias[name='url-AN']")?.getAttribute("value") || null,
|
|
163
143
|
type: identificationParts?.["type"] || null,
|
|
164
144
|
session: sessionYears && sessionYears.length > 0 ? sessionYears[0] : null,
|
|
165
|
-
numero: identificationParts?.["numTexte"]
|
|
166
|
-
? parseInt(identificationParts["numTexte"])
|
|
167
|
-
: null,
|
|
145
|
+
numero: identificationParts?.["numTexte"] ? parseInt(identificationParts["numTexte"]) : null,
|
|
168
146
|
datePresentation: datePresentation ? new Date(datePresentation) : null,
|
|
169
147
|
dateDepot: dateDepot ? new Date(dateDepot) : null,
|
|
170
|
-
datePublicationXml: datePublicationXml
|
|
171
|
-
|
|
172
|
-
: null,
|
|
173
|
-
version: identificationParts?.["version"]
|
|
174
|
-
? identificationParts["version"]
|
|
175
|
-
: null,
|
|
148
|
+
datePublicationXml: datePublicationXml ? new Date(datePublicationXml) : null,
|
|
149
|
+
version: identificationParts?.["version"] ? identificationParts["version"] : null,
|
|
176
150
|
workflow: metaElement ? buildWorklow(metaElement) : [],
|
|
177
151
|
divisions: bodyElement ? flattenTexte(bodyElement) : [],
|
|
178
152
|
};
|
|
@@ -188,10 +162,8 @@ export function transformExposeDesMotifs(document) {
|
|
|
188
162
|
}
|
|
189
163
|
const firstParagraphContent = firstParagraph.textContent;
|
|
190
164
|
const secondParagraphContent = secondParagraph?.textContent;
|
|
191
|
-
if (!firstParagraphContent ||
|
|
192
|
-
!exposeDesMotifsRegexp.test(
|
|
193
|
-
if (!secondParagraphContent ||
|
|
194
|
-
!exposeDesMotifsRegexp.test(secondParagraphContent.toUpperCase())) {
|
|
165
|
+
if (!firstParagraphContent || !exposeDesMotifsRegexp.test(firstParagraphContent.toUpperCase())) {
|
|
166
|
+
if (!secondParagraphContent || !exposeDesMotifsRegexp.test(secondParagraphContent.toUpperCase())) {
|
|
195
167
|
continue;
|
|
196
168
|
}
|
|
197
169
|
else {
|
package/lib/raw_types/senat.d.ts
CHANGED
|
@@ -2735,6 +2735,10 @@ export interface QuestionsTamMinisteres {
|
|
|
2735
2735
|
titreministre: string | null;
|
|
2736
2736
|
}
|
|
2737
2737
|
export interface QuestionsTamQuestions {
|
|
2738
|
+
/**
|
|
2739
|
+
* Question caduque redéposée
|
|
2740
|
+
*/
|
|
2741
|
+
caduque_redeposee: string | null;
|
|
2738
2742
|
/**
|
|
2739
2743
|
* Libellé de la circonscription
|
|
2740
2744
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED FILE - DO NOT EDIT!
|
|
3
3
|
*
|
|
4
|
-
* This file was automatically generated by schemats v.2.
|
|
4
|
+
* This file was automatically generated by schemats v.2.20.33
|
|
5
5
|
* $ schemats generate -c postgres://username:password@localhost:5432/senat -t amd -t amdsen -t avicom -t avigvt -t cab -t com_ameli -t ent -t etatxt -t fbu -t grppol_ameli -t gvt -t intora -t irr -t lec_ameli -t mot -t nat -t orarol -t sai -t saisen -t sea -t sen_ameli -t ses -t sor -t sub -t txt_ameli -t typrect -t typses -t typsub -t w_nivrec -s ameli
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED FILE - DO NOT EDIT!
|
|
3
3
|
*
|
|
4
|
-
* This file was automatically generated by schemats v.2.
|
|
4
|
+
* This file was automatically generated by schemats v.2.20.33
|
|
5
5
|
* $ schemats generate -c postgres://username:password@localhost:5432/senat -t debats -t intdivers -t intpjl -t lecassdeb -t secdis -t secdivers -t syndeb -t typsec -s debats
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED FILE - DO NOT EDIT!
|
|
3
3
|
*
|
|
4
|
-
* This file was automatically generated by schemats v.2.
|
|
4
|
+
* This file was automatically generated by schemats v.2.20.33
|
|
5
5
|
* $ schemats generate -c postgres://username:password@localhost:5432/senat -t amescr -t ass -t aud -t auteur -t ble -t catrap -t corscr -t date_seance -t deccoc -t denrap -t doc -t docatt -t docsea -t ecr -t etaloi -t evtsea -t forpub -t gen -t lecass -t lecassrap -t lecture -t lnkrap -t loi -t loithe -t natloi -t org -t orgnomhis -t orippr -t oritxt -t posvot -t qua -t rap -t raporg -t rapthe -t rolsig -t scr -t ses -t stavot -t texte -t texte_ancien -t the -t titsen -t typatt -t typaut -t typdoc -t typevtsea -t typlec -t typloi -t typorg -t typrap -t typtxt -t typurl -t votsen -s dosleg
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED FILE - DO NOT EDIT!
|
|
3
3
|
*
|
|
4
|
-
* This file was automatically generated by schemats v.2.
|
|
4
|
+
* This file was automatically generated by schemats v.2.20.33
|
|
5
5
|
* $ schemats generate -c postgres://username:password@localhost:5432/senat -t etatquestion -t legquestion -t naturequestion -t sortquestion -t tam_ministeres -t tam_questions -t tam_reponses -t the -s questions
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
@@ -76,6 +76,7 @@ export interface tam_ministeres {
|
|
|
76
76
|
titreministre: tam_ministeresFields.titreministre;
|
|
77
77
|
}
|
|
78
78
|
export declare namespace tam_questionsFields {
|
|
79
|
+
type caduque_redeposee = string | null;
|
|
79
80
|
type circonscription = string | null;
|
|
80
81
|
type cirnum = number | null;
|
|
81
82
|
type codequalite = string | null;
|
|
@@ -135,6 +136,7 @@ export declare namespace tam_questionsFields {
|
|
|
135
136
|
type version = number | null;
|
|
136
137
|
}
|
|
137
138
|
export interface tam_questions {
|
|
139
|
+
caduque_redeposee: tam_questionsFields.caduque_redeposee;
|
|
138
140
|
circonscription: tam_questionsFields.circonscription;
|
|
139
141
|
cirnum: tam_questionsFields.cirnum;
|
|
140
142
|
codequalite: tam_questionsFields.codequalite;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED FILE - DO NOT EDIT!
|
|
3
3
|
*
|
|
4
|
-
* This file was automatically generated by schemats v.2.
|
|
4
|
+
* This file was automatically generated by schemats v.2.20.33
|
|
5
5
|
* $ schemats generate -c postgres://username:password@localhost:5432/senat -t acr -t activite -t activite_audit -t activite_delegation -t activite_delegation_audit -t activite_loi -t activite_loi_audit -t activite_obligatoire -t activite_participant -t activite_participant_audit -t activite_senateur -t activite_senateur_audit -t activite_senateur_params -t activite_senateur_params_audit -t activites_liees -t activites_liees_audit -t actpro -t adhgrpsen -t adr -t adresse -t adrsen -t app -t assparint -t asster -t autgrpsen -t autorisation_profil -t autorisations -t avis_nomination_art13 -t basdes -t bur -t bur3r -t bur4r -t cad -t candid -t candidat -t candtodelete -t categorie_activite -t catpro -t catpro2e -t catterrit -t cible_categorie_periode -t cirdep -t com -t con -t cotgip -t csp -t cspfam -t databasechangelog -t databasechangeloglock -t delega -t derogation -t derogation_audit -t derogation_senateur -t derogation_senateur_audit -t design -t designoep -t designorg -t discou -t div -t dpt -t dpt_seuil_presence -t dptele -t dptele_files -t dptele_processing -t dptele_processing_type -t dpttypman -t droits_acces -t droits_acces_audit -t droits_type_derogation -t ele -t eleloc -t elucan -t eludep -t eludiv -t elueur -t elueur_apf -t elumet -t elureg -t elusen -t elusen2e -t elusen3r -t elusen4r -t elusencommu -t elusenpair -t eluter -t elutit -t eluvil -t etadebman -t etadebman3r -t etadebman4r -t etafinman -t etafinman3r -t etafinman4r -t etaprr -t etarpm -t etasen -t ext2e_bio -t ext2e_csp -t ext2e_mandats -t ext2e_minist -t extsencom_identite -t extsencom_mandat -t fonact_participant -t foncandid -t foncom -t fondelega -t fongrppol -t fongrpsen -t fonmemcom -t fonmemdelega -t fonmemextpar -t fonmemgrppol -t fonmemgrpsen -t fonmemorg -t fonorg -t grppol -t grppol4r -t grpsenami -t grpsenamiadh -t grpsenamiadhreq -t grpsenamiadhreqeta -t grpsenamiunadh -t grpsim -t gvt -t insee_pays2008 -t jhi_authority -t jhi_user -t jhi_user_authority -t lanetr -t libcom -t libdelega -t libgrppol -t libgrpsen -t liborg -t lisdptele -t mel -t memcom -t memcomsea -t memdelega -t memextpar -t memgrppol -t memgrpsen -t memorg -t met -t minind -t minist -t mis -t misetafin -t mismin -t misrapeta -t missen -t moddes -t mode_acces_elusenpair -t nation -t nationgrpsen -t nivlan -t org -t orgext -t orgextpres -t orgthe -t pairie_elusenpair -t parpol -t parpolglo -t participa -t pcs -t pcs24 -t pcs42 -t pcs8 -t pcscatpro -t per -t per_sen -t perapp -t periode_presence -t perpolglo -t perrol -t pj_justificatif -t pj_justificatif_audit -t plaind -t plan_table -t plsql_profiler_runs -t plsql_profiler_units -t poicon -t posvot -t presences_scrutin_surcharge -t presencesrevisionentity -t profil_applicatif -t qua -t rap_the -t reg -t reladr -t requetes_profil -t reslis -t resultat -t reu -t revchanges -t rne_mandat -t rne_mandat_diff -t rne_sen -t rne_sen_diff -t rne_type_mandat -t rol -t sal -t scr -t scrusoldelega -t sea -t sec -t sec2e -t secexe -t sen -t senbur -t senbur3r -t senbur4r -t sennom -t senpj -t sensim -t sentablenom -t senurl -t seuil_presence -t sirpas_elusen -t sirpas_fonmemcom -t sirpas_fonmemdelega -t sirpas_fonmemgrppol -t sirpas_memcom -t sirpas_memdelega -t sirpas_memgrppol -t sirpas_mvt -t sirpas_mvtcm -t sirpas_mvttri -t sirpas_sen -t sirpas_senbur -t sirpas_trf -t srv -t stajur -t stavot -t suspensiontravaux -t suspensiontravaux_audit -t sysage -t syscognos -t sysevt -t sysvar -t sysvar_sendev -t sysvar_senprod -t tapsenrevchanges -t tapsenrevisionentity -t telephone -t temval -t tenpol -t territ -t testoracle -t titele -t titelerne -t titmin -t titnob -t tmpsd -t toutes -t turelu -t typadr -t typapppol -t typbister -t typcandid -t type_activite -t type_activite_participant -t type_activite_rol -t type_activite_senateur -t type_categorie -t type_derogation -t type_droit_acces -t type_pj_justificatif -t type_rne_diff -t type_type_derogation -t typele -t typgrpsen -t typman -t typmin -t typmoddes -t typorg -t typorgext -t typparpol -t typpoicon -t typprs -t typprssta -t typscr -t typtel -t typurl -t typvoi -t uploaded_file -t uploaded_file_type -t validation -t validation_defview_profil -t validation_profil -t vercand -t verres -t votes -t zongeo -s sens
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
@@ -5,7 +5,7 @@ import path from "path";
|
|
|
5
5
|
import pLimit from "p-limit";
|
|
6
6
|
import * as git from "../git";
|
|
7
7
|
import { datasets, EnabledDatasets, getEnabledDatasets } from "../datasets";
|
|
8
|
-
import { DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER, DOCUMENT_METADATA_FILE, DOSLEG_DOSSIERS_FOLDER, SCRUTINS_FOLDER, RAPPORT_FOLDER, SENS_CIRCONSCRIPTIONS_FOLDER, SENS_ORGANISMES_FOLDER, SENS_SENATEURS_FOLDER, TEXTE_FOLDER } from "../loaders";
|
|
8
|
+
import { DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER, DOCUMENT_METADATA_FILE, DOSLEG_DOSSIERS_FOLDER, SCRUTINS_FOLDER, RAPPORT_FOLDER, SENS_CIRCONSCRIPTIONS_FOLDER, SENS_ORGANISMES_FOLDER, SENS_SENATEURS_FOLDER, TEXTE_FOLDER, } from "../loaders";
|
|
9
9
|
import { findAllAmendements, findAllCirconscriptions, findAllDebats, findAllDossiers, findAllScrutins, findAllOrganismes, findAllQuestions, findAllSens, findAllTextes, findAllRapports, } from "../model";
|
|
10
10
|
import { processRapport, processTexte } from "./retrieve_documents";
|
|
11
11
|
import { buildActesLegislatifs } from "../model/dosleg";
|
|
@@ -164,7 +164,7 @@ async function convertDatasetDosLeg(dataDir, options) {
|
|
|
164
164
|
const actesBrutsNormalises = buildActesLegislatifs(dossier);
|
|
165
165
|
const dossierWithActes = {
|
|
166
166
|
...dossier,
|
|
167
|
-
actes_legislatifs: actesBrutsNormalises
|
|
167
|
+
actes_legislatifs: actesBrutsNormalises,
|
|
168
168
|
};
|
|
169
169
|
const dossierFile = `${dossier["signet"]}.json`;
|
|
170
170
|
await fs.outputJSON(path.join(dossierReorganizedDir, dossierFile), dossierWithActes, { spaces: 2 });
|
|
@@ -236,7 +236,7 @@ async function convertTextes(dataDir, options) {
|
|
|
236
236
|
const texteName = path.parse(texte["url"]).name;
|
|
237
237
|
const texteDir = path.join(originalTextesDir, `${session}`, texteName);
|
|
238
238
|
// oritxtcod = 1 corresponds to "Texte de loi déposé au Sénat"
|
|
239
|
-
const hasExposeDesMotifs = texte["origine"] ===
|
|
239
|
+
const hasExposeDesMotifs = texte["origine"] === "Sénat" && texte["ordre_origine"] === "1";
|
|
240
240
|
const metadata = {
|
|
241
241
|
name: texteName,
|
|
242
242
|
session: texte["session"],
|
|
@@ -2,8 +2,8 @@ import assert from "assert";
|
|
|
2
2
|
import commandLineArgs from "command-line-args";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import { iterFilePaths, TEXTE_FOLDER, DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER
|
|
6
|
-
import { parseExposeDesMotifsFromFile, parseTexteFromFile
|
|
5
|
+
import { iterFilePaths, TEXTE_FOLDER, DATA_ORIGINAL_FOLDER, DATA_TRANSFORMED_FOLDER } from "../loaders";
|
|
6
|
+
import { parseExposeDesMotifsFromFile, parseTexteFromFile } from "../model/texte";
|
|
7
7
|
import { commonOptions } from "./shared/cli_helpers";
|
|
8
8
|
import { ensureAndClearDir } from "./shared/util";
|
|
9
9
|
const optionsDefinitions = [...commonOptions];
|
|
@@ -272,6 +272,7 @@ async function retrieveOpenData() {
|
|
|
272
272
|
...process.env,
|
|
273
273
|
PGHOST: process.env["PGHOST"] || config.db.host,
|
|
274
274
|
PGPORT: process.env["PGPORT"] || String(config.db.port),
|
|
275
|
+
PGDATABASE: process.env["PGDATABASE"] || config.db.name,
|
|
275
276
|
PGUSER: process.env["PGUSER"] || config.db.user,
|
|
276
277
|
PGPASSWORD: process.env["PGPASSWORD"] || config.db.password,
|
|
277
278
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { iterLoadSenatRapports } from "../loaders";
|
|
1
|
+
import { iterLoadSenatRapports, } from "../loaders";
|
|
2
2
|
import commandLineArgs from "command-line-args";
|
|
3
3
|
import { dataDirDefaultOption } from "./shared/cli_helpers";
|
|
4
4
|
const optionsDefinitions = [dataDirDefaultOption];
|
package/lib/src/model/ameli.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ declare const findAllAmendementsQuery: import("kysely").SelectQueryBuilder<{
|
|
|
11
11
|
etat: string;
|
|
12
12
|
sort: any;
|
|
13
13
|
url: string;
|
|
14
|
+
au_nom_de_commission: string;
|
|
15
|
+
code_commission: string;
|
|
14
16
|
auteur_est_gouvernement: boolean;
|
|
15
17
|
scrutin_num: any;
|
|
16
18
|
auteurs: {
|
|
@@ -33,6 +35,8 @@ export declare function findAllAmendements(fromSession?: number): AsyncIterableI
|
|
|
33
35
|
etat: string;
|
|
34
36
|
sort: any;
|
|
35
37
|
url: string;
|
|
38
|
+
au_nom_de_commission: string;
|
|
39
|
+
code_commission: string;
|
|
36
40
|
auteur_est_gouvernement: boolean;
|
|
37
41
|
scrutin_num: any;
|
|
38
42
|
auteurs: {
|
package/lib/src/model/ameli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sql } from "kysely";
|
|
2
2
|
import { jsonArrayFrom } from "kysely/helpers/postgres";
|
|
3
3
|
import { dbSenat } from "../databases";
|
|
4
|
-
import { concat, toDateString } from "./util";
|
|
4
|
+
import { concat, rtrim, toDateString } from "./util";
|
|
5
5
|
function auteurs(amendementId) {
|
|
6
6
|
return jsonArrayFrom(dbSenat
|
|
7
7
|
.selectFrom("ameli.amdsen")
|
|
@@ -134,8 +134,8 @@ const findAllAmendementsQuery = dbSenat
|
|
|
134
134
|
.else(val("https://www.senat.fr/amendements/"))
|
|
135
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
136
|
"ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
137
|
-
"ameli.com_ameli.lil
|
|
138
|
-
"ameli.com_ameli.cod
|
|
137
|
+
rtrim(ref("ameli.com_ameli.lil")).as("au_nom_de_commission"),
|
|
138
|
+
rtrim(ref("ameli.com_ameli.cod")).as("code_commission"),
|
|
139
139
|
eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
|
|
140
140
|
scrutin(ref("ameli.amd.num"), ref("ameli.ses.ann"), ref("dosleg.texte.lecassidt")),
|
|
141
141
|
auteurs(ref("ameli.amd.id")).as("auteurs"),
|
|
@@ -132,6 +132,7 @@ async function processGroupedReunion(agenda, session, dataDir, lastByVideo) {
|
|
|
132
132
|
// 3) Always update BEST agenda JSON from local NVS
|
|
133
133
|
await processOneReunionMatch({
|
|
134
134
|
agenda,
|
|
135
|
+
best,
|
|
135
136
|
baseDir: ctx.baseDir,
|
|
136
137
|
dataDir: ctx.dataDir,
|
|
137
138
|
session: ctx.session,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type L1Chapter = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
index: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function getLevel1Chapters(dataNvs: string): L1Chapter[];
|
|
7
|
+
export declare function pickBestLevel1ChapterForAgenda(chapters: L1Chapter[], agendaTitle: string): {
|
|
8
|
+
chapter: L1Chapter;
|
|
9
|
+
score: number;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function getAgendaSegmentTimecodes(dataNvs: string, finalPlayerNvs: string, agendaTitleOrObjet: string): {
|
|
12
|
+
start: number;
|
|
13
|
+
end: number | null;
|
|
14
|
+
chapterId: string;
|
|
15
|
+
nextChapterId: string | null;
|
|
16
|
+
score: number;
|
|
17
|
+
} | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { XMLParser } from "fast-xml-parser";
|
|
2
|
+
import { dice, normalize } from "./scoring";
|
|
3
|
+
import { decodeHtmlEntities } from "./string_cleaning";
|
|
4
|
+
const CHAPTER_MATCH_THRESHOLD = 0.5;
|
|
5
|
+
const xmlParser = new XMLParser({
|
|
6
|
+
ignoreAttributes: false,
|
|
7
|
+
attributeNamePrefix: "@_",
|
|
8
|
+
});
|
|
9
|
+
function getTimecodeForChapterId(finalPlayerNvs, chapterId) {
|
|
10
|
+
const xml = xmlParser.parse(finalPlayerNvs);
|
|
11
|
+
const synchros = xml?.player?.synchro;
|
|
12
|
+
if (!synchros)
|
|
13
|
+
return null;
|
|
14
|
+
const synchsArray = Array.isArray(synchros) ? synchros : [synchros];
|
|
15
|
+
const match = synchsArray.find((s) => String(s["@_id"]) === String(chapterId));
|
|
16
|
+
if (!match)
|
|
17
|
+
return null;
|
|
18
|
+
const rawTimecode = match["@_timecode"];
|
|
19
|
+
if (rawTimecode == null)
|
|
20
|
+
return null;
|
|
21
|
+
const ms = Number(rawTimecode);
|
|
22
|
+
if (Number.isNaN(ms))
|
|
23
|
+
return null;
|
|
24
|
+
return Math.floor(ms / 1000);
|
|
25
|
+
}
|
|
26
|
+
function toArray(v) {
|
|
27
|
+
if (!v)
|
|
28
|
+
return [];
|
|
29
|
+
return Array.isArray(v) ? v : [v];
|
|
30
|
+
}
|
|
31
|
+
export function getLevel1Chapters(dataNvs) {
|
|
32
|
+
const xml = xmlParser.parse(dataNvs);
|
|
33
|
+
const root = xml?.data?.chapters?.chapter ?? xml?.chapters?.chapter;
|
|
34
|
+
const roots = toArray(root);
|
|
35
|
+
return roots
|
|
36
|
+
.map((ch, i) => {
|
|
37
|
+
const id = ch?.id ?? ch?.["@_id"];
|
|
38
|
+
const labelRaw = ch?.label ?? ch?.["@_label"] ?? "";
|
|
39
|
+
return {
|
|
40
|
+
id: String(id),
|
|
41
|
+
label: decodeHtmlEntities(String(labelRaw)).trim(),
|
|
42
|
+
index: i,
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
.filter((c) => c.id && c.label);
|
|
46
|
+
}
|
|
47
|
+
export function pickBestLevel1ChapterForAgenda(chapters, agendaTitle) {
|
|
48
|
+
const q = normalize(agendaTitle);
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const ch of chapters) {
|
|
51
|
+
const s = dice(q, ch.label);
|
|
52
|
+
if (!best || s > best.score)
|
|
53
|
+
best = { chapter: ch, score: s };
|
|
54
|
+
}
|
|
55
|
+
if (!best || best.score < CHAPTER_MATCH_THRESHOLD)
|
|
56
|
+
return { chapter: chapters[0], score: 0 };
|
|
57
|
+
return best;
|
|
58
|
+
}
|
|
59
|
+
export function getAgendaSegmentTimecodes(dataNvs, finalPlayerNvs, agendaTitleOrObjet) {
|
|
60
|
+
const l1 = getLevel1Chapters(dataNvs);
|
|
61
|
+
if (!l1.length)
|
|
62
|
+
return null;
|
|
63
|
+
const best = pickBestLevel1ChapterForAgenda(l1, agendaTitleOrObjet);
|
|
64
|
+
if (!best)
|
|
65
|
+
return null;
|
|
66
|
+
const chapter = best.chapter;
|
|
67
|
+
const next = l1[chapter.index + 1] ?? null;
|
|
68
|
+
const start = getTimecodeForChapterId(finalPlayerNvs, chapter.id);
|
|
69
|
+
if (start == null)
|
|
70
|
+
return null;
|
|
71
|
+
const end = next ? getTimecodeForChapterId(finalPlayerNvs, next.id) : null;
|
|
72
|
+
return {
|
|
73
|
+
start,
|
|
74
|
+
end,
|
|
75
|
+
chapterId: chapter.id,
|
|
76
|
+
nextChapterId: next?.id ?? null,
|
|
77
|
+
score: best.score,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// BASED ON TESTS RESULTS
|
|
2
|
+
// these weights yield good results in the benchmark test suite
|
|
3
|
+
// aiming at 0 WRONG matches while maximizing HITs
|
|
4
|
+
export const weights = {
|
|
5
|
+
wTitle: 0.7,
|
|
6
|
+
wOrg: 0.1,
|
|
7
|
+
wSalle: 0,
|
|
8
|
+
wTime: 0.2,
|
|
9
|
+
sameOrgBonus: 0.2,
|
|
10
|
+
minAccept: 0.5,
|
|
11
|
+
margin: 0.1,
|
|
12
|
+
titleMin: 0.2,
|
|
13
|
+
titleDominance: 0,
|
|
14
|
+
orgUncertainPenalty: 0.8,
|
|
15
|
+
};
|
|
@@ -3,6 +3,7 @@ import { BestMatch, LastForVideo, MatchContext } from "./types";
|
|
|
3
3
|
import { CommandLineOptions } from "command-line-args";
|
|
4
4
|
export declare function processOneReunionMatch(args: {
|
|
5
5
|
agenda: Reunion;
|
|
6
|
+
best: BestMatch | null;
|
|
6
7
|
baseDir: string;
|
|
7
8
|
dataDir: string;
|
|
8
9
|
session: number;
|
|
@@ -29,6 +30,7 @@ export declare function processBisIfNeeded(args: {
|
|
|
29
30
|
writeIfChanged: (p: string, content: string) => Promise<void>;
|
|
30
31
|
processOneReunionMatch: (args: {
|
|
31
32
|
agenda: Reunion;
|
|
33
|
+
best: BestMatch | null;
|
|
32
34
|
baseDir: string;
|
|
33
35
|
dataDir: string;
|
|
34
36
|
session: number;
|