@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.
Files changed (146) hide show
  1. package/lib/config.d.ts +12 -1
  2. package/lib/config.js +12 -1
  3. package/lib/loaders.js +1 -1
  4. package/lib/model/ameli.js +1 -3
  5. package/lib/model/documents.js +5 -18
  6. package/lib/model/dosleg.js +11 -11
  7. package/lib/model/texte.js +15 -43
  8. package/lib/raw_types/questions.d.ts +4 -0
  9. package/lib/raw_types/senat.d.ts +4 -0
  10. package/lib/raw_types_schemats/ameli.d.ts +1 -1
  11. package/lib/raw_types_schemats/debats.d.ts +1 -1
  12. package/lib/raw_types_schemats/dosleg.d.ts +1 -1
  13. package/lib/raw_types_schemats/questions.d.ts +3 -1
  14. package/lib/raw_types_schemats/sens.d.ts +1 -1
  15. package/lib/scripts/convert_data.js +3 -3
  16. package/lib/scripts/parse_textes.js +2 -2
  17. package/lib/scripts/retrieve_open_data.js +1 -0
  18. package/lib/scripts/test_iter_load.js +1 -1
  19. package/lib/src/model/ameli.d.ts +4 -0
  20. package/lib/src/model/ameli.js +3 -3
  21. package/lib/src/scripts/retrieve_videos.js +1 -0
  22. package/lib/src/types/agenda.d.ts +1 -0
  23. package/lib/src/utils/nvs-timecode.d.ts +17 -0
  24. package/lib/src/utils/nvs-timecode.js +79 -0
  25. package/lib/src/utils/weights_scoring_config.d.ts +2 -0
  26. package/lib/src/utils/weights_scoring_config.js +15 -0
  27. package/lib/src/videos/pipeline.d.ts +2 -0
  28. package/lib/src/videos/pipeline.js +3 -2
  29. package/lib/utils/reunion_grouping.d.ts +4 -2
  30. package/lib/utils/reunion_grouping.js +6 -30
  31. package/package.json +1 -1
  32. package/lib/aggregates.d.ts +0 -52
  33. package/lib/aggregates.js +0 -930
  34. package/lib/aggregates.mjs +0 -713
  35. package/lib/aggregates.ts +0 -833
  36. package/lib/config.mjs +0 -16
  37. package/lib/config.ts +0 -26
  38. package/lib/databases.mjs +0 -57
  39. package/lib/databases.ts +0 -71
  40. package/lib/datasets.mjs +0 -78
  41. package/lib/datasets.ts +0 -118
  42. package/lib/fields.d.ts +0 -10
  43. package/lib/fields.js +0 -68
  44. package/lib/fields.mjs +0 -22
  45. package/lib/fields.ts +0 -29
  46. package/lib/index.mjs +0 -7
  47. package/lib/index.ts +0 -64
  48. package/lib/inserters.d.ts +0 -98
  49. package/lib/inserters.js +0 -500
  50. package/lib/inserters.mjs +0 -360
  51. package/lib/inserters.ts +0 -521
  52. package/lib/legislatures.json +0 -38
  53. package/lib/loaders.mjs +0 -158
  54. package/lib/loaders.ts +0 -271
  55. package/lib/model/ameli.mjs +0 -84
  56. package/lib/model/ameli.ts +0 -100
  57. package/lib/model/debats.mjs +0 -43
  58. package/lib/model/debats.ts +0 -68
  59. package/lib/model/dosleg.mjs +0 -196
  60. package/lib/model/dosleg.ts +0 -240
  61. package/lib/model/index.mjs +0 -5
  62. package/lib/model/index.ts +0 -15
  63. package/lib/model/questions.mjs +0 -71
  64. package/lib/model/questions.ts +0 -93
  65. package/lib/model/sens.mjs +0 -415
  66. package/lib/model/sens.ts +0 -516
  67. package/lib/model/texte.mjs +0 -208
  68. package/lib/model/texte.ts +0 -229
  69. package/lib/model/util.mjs +0 -19
  70. package/lib/model/util.ts +0 -32
  71. package/lib/raw_types/ameli.mjs +0 -163
  72. package/lib/raw_types/debats.mjs +0 -58
  73. package/lib/raw_types/dosleg.mjs +0 -438
  74. package/lib/raw_types/questions.mjs +0 -11
  75. package/lib/raw_types/sens.mjs +0 -508
  76. package/lib/raw_types_kysely/ameli.d.ts +0 -915
  77. package/lib/raw_types_kysely/ameli.js +0 -7
  78. package/lib/raw_types_kysely/ameli.mjs +0 -5
  79. package/lib/raw_types_kysely/ameli.ts +0 -951
  80. package/lib/raw_types_kysely/debats.d.ts +0 -207
  81. package/lib/raw_types_kysely/debats.js +0 -7
  82. package/lib/raw_types_kysely/debats.mjs +0 -5
  83. package/lib/raw_types_kysely/debats.ts +0 -222
  84. package/lib/raw_types_kysely/dosleg.d.ts +0 -3532
  85. package/lib/raw_types_kysely/dosleg.js +0 -7
  86. package/lib/raw_types_kysely/dosleg.mjs +0 -5
  87. package/lib/raw_types_kysely/dosleg.ts +0 -3621
  88. package/lib/raw_types_kysely/questions.d.ts +0 -414
  89. package/lib/raw_types_kysely/questions.js +0 -7
  90. package/lib/raw_types_kysely/questions.mjs +0 -5
  91. package/lib/raw_types_kysely/questions.ts +0 -426
  92. package/lib/raw_types_kysely/sens.d.ts +0 -4394
  93. package/lib/raw_types_kysely/sens.js +0 -7
  94. package/lib/raw_types_kysely/sens.mjs +0 -5
  95. package/lib/raw_types_kysely/sens.ts +0 -4499
  96. package/lib/raw_types_schemats/ameli.mjs +0 -2
  97. package/lib/raw_types_schemats/ameli.ts +0 -601
  98. package/lib/raw_types_schemats/debats.mjs +0 -2
  99. package/lib/raw_types_schemats/debats.ts +0 -145
  100. package/lib/raw_types_schemats/dosleg.mjs +0 -2
  101. package/lib/raw_types_schemats/dosleg.ts +0 -2193
  102. package/lib/raw_types_schemats/questions.mjs +0 -2
  103. package/lib/raw_types_schemats/questions.ts +0 -249
  104. package/lib/raw_types_schemats/sens.mjs +0 -2
  105. package/lib/raw_types_schemats/sens.ts +0 -2907
  106. package/lib/scripts/convert_data.mjs +0 -181
  107. package/lib/scripts/convert_data.ts +0 -243
  108. package/lib/scripts/datautil.mjs +0 -16
  109. package/lib/scripts/datautil.ts +0 -19
  110. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  111. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  112. package/lib/scripts/parse_textes.mjs +0 -46
  113. package/lib/scripts/parse_textes.ts +0 -65
  114. package/lib/scripts/retrieve_documents.mjs +0 -249
  115. package/lib/scripts/retrieve_documents.ts +0 -298
  116. package/lib/scripts/retrieve_open_data.mjs +0 -217
  117. package/lib/scripts/retrieve_open_data.ts +0 -268
  118. package/lib/scripts/retrieve_senateurs_photos.mjs +0 -147
  119. package/lib/scripts/retrieve_senateurs_photos.ts +0 -177
  120. package/lib/scripts/shared/cli_helpers.ts +0 -36
  121. package/lib/scripts/shared/util.ts +0 -33
  122. package/lib/strings.mjs +0 -18
  123. package/lib/strings.ts +0 -26
  124. package/lib/types/ameli.mjs +0 -13
  125. package/lib/types/ameli.ts +0 -21
  126. package/lib/types/debats.mjs +0 -2
  127. package/lib/types/debats.ts +0 -6
  128. package/lib/types/dosleg.mjs +0 -151
  129. package/lib/types/dosleg.ts +0 -284
  130. package/lib/types/questions.mjs +0 -1
  131. package/lib/types/questions.ts +0 -3
  132. package/lib/types/sens.mjs +0 -1
  133. package/lib/types/sens.ts +0 -12
  134. package/lib/types/sessions.mjs +0 -43
  135. package/lib/types/sessions.ts +0 -42
  136. package/lib/types/texte.mjs +0 -16
  137. package/lib/types/texte.ts +0 -76
  138. package/lib/typings/windows-1252.d.js +0 -2
  139. package/lib/typings/windows-1252.d.mjs +0 -2
  140. package/lib/typings/windows-1252.d.ts +0 -11
  141. package/lib/validators/config.mjs +0 -54
  142. package/lib/validators/config.ts +0 -79
  143. package/lib/validators/senat.d.ts +0 -0
  144. package/lib/validators/senat.js +0 -28
  145. package/lib/validators/senat.mjs +0 -24
  146. package/lib/validators/senat.ts +0 -26
@@ -6,7 +6,7 @@ import fs from "fs-extra";
6
6
  import fsp from "fs/promises";
7
7
  import path from "path";
8
8
  export async function processOneReunionMatch(args) {
9
- const { agenda, baseDir, dataDir, session, options, writeIfChanged, lastByVideo, getAgendaSegmentTimecodes, buildSenatVodMasterM3u8FromNvs, } = args;
9
+ const { agenda, best, baseDir, dataDir, session, options, writeIfChanged, lastByVideo, getAgendaSegmentTimecodes, buildSenatVodMasterM3u8FromNvs, } = args;
10
10
  const reunionUid = agenda.uid;
11
11
  let dataTxt;
12
12
  let finalTxt;
@@ -67,7 +67,7 @@ export async function processOneReunionMatch(args) {
67
67
  console.warn(`[warn] invalid JSON in ${agendaJsonPath}`);
68
68
  return;
69
69
  }
70
- const next = { ...obj, urlVideo: master, startTime: agenda.startTime };
70
+ const next = { ...obj, urlVideo: master, startTime: agenda.startTime, urlPageVideo: best?.pageUrl };
71
71
  if (timecodeDebutVideo != null) {
72
72
  next.timecodeDebutVideo = timecodeDebutVideo;
73
73
  if (timecodeFinVideo != null)
@@ -102,6 +102,7 @@ export async function processBisIfNeeded(args) {
102
102
  await downloadNvsForMatch(secondBest, baseDirBis);
103
103
  await processOneReunionMatch({
104
104
  agenda: agendaBis,
105
+ best: secondBest,
105
106
  baseDir: baseDirBis,
106
107
  dataDir: ctx.dataDir,
107
108
  session: ctx.session,
@@ -1,7 +1,9 @@
1
1
  import { AgendaEvent, GroupedReunion, TimeSlot } from "../types/agenda";
2
+ import { DossierLegislatifResult } from "../model/dosleg";
2
3
  type KnownType = "SP" | "COM" | "MC" | "OD" | "ID";
3
- export declare function groupNonSPByTypeOrganeHour(events: AgendaEvent[]): Record<"IDC" | "IDM" | "IDO" | "IDI", GroupedReunion[]>;
4
- export declare function groupSeancePubliqueBySlot(events: AgendaEvent[]): Record<TimeSlot, GroupedReunion[]>;
4
+ type DossierBySenatUrl = Record<string, DossierLegislatifResult>;
5
+ export declare function groupNonSPByTypeOrganeHour(events: AgendaEvent[], DossierBySenatUrl: DossierBySenatUrl): Record<"IDC" | "IDM" | "IDO" | "IDI", GroupedReunion[]>;
6
+ export declare function groupSeancePubliqueBySlot(events: AgendaEvent[], dossierBySenatUrl: DossierBySenatUrl): Record<TimeSlot, GroupedReunion[]>;
5
7
  export declare function makeTypeGroupUid(dateISO: string, kind: KnownType, agendaEventId: string, organe?: string | null): string;
6
8
  export declare function makeGroupUid(date: string, slot: TimeSlot): string;
7
9
  export declare function formatYYYYMMDD(dateYYYYMMDD: string): string;
@@ -1,5 +1,6 @@
1
1
  import { DateTime } from "luxon";
2
2
  import { norm } from "../model/util";
3
+ import { buildOdj } from "./reunion_odj_building";
3
4
  const PARIS = "Europe/Paris";
4
5
  const STOPWORDS = new Set([
5
6
  "de",
@@ -21,7 +22,7 @@ const STOPWORDS = new Set([
21
22
  "a",
22
23
  "aux",
23
24
  ]);
24
- export function groupNonSPByTypeOrganeHour(events) {
25
+ export function groupNonSPByTypeOrganeHour(events, DossierBySenatUrl) {
25
26
  const out = { IDC: [], IDM: [], IDO: [], IDI: [] };
26
27
  if (!events?.length)
27
28
  return out;
@@ -49,6 +50,7 @@ export function groupNonSPByTypeOrganeHour(events) {
49
50
  titre: e.titre,
50
51
  objet: e.objet || "",
51
52
  events: [e],
53
+ odj: buildOdj([e], DossierBySenatUrl),
52
54
  };
53
55
  out[suffix].push(group);
54
56
  }
@@ -61,8 +63,7 @@ export function groupNonSPByTypeOrganeHour(events) {
61
63
  }
62
64
  return out;
63
65
  }
64
- export function groupSeancePubliqueBySlot(events) {
65
- // Résultat à la manière de groupNonSPByTypeOrganeHour : objet de listes, ici indexé par créneau
66
+ export function groupSeancePubliqueBySlot(events, dossierBySenatUrl) {
66
67
  const out = {};
67
68
  const ensureBucket = (slot) => (out[slot] ??= []);
68
69
  if (!events?.length)
@@ -70,7 +71,6 @@ export function groupSeancePubliqueBySlot(events) {
70
71
  const sp = events.filter((e) => isSeancePublique(e?.type));
71
72
  if (sp.length === 0)
72
73
  return out;
73
- // Regroupement par date
74
74
  const byDate = new Map();
75
75
  for (const e of sp) {
76
76
  const d = norm(e.date);
@@ -124,6 +124,7 @@ export function groupSeancePubliqueBySlot(events) {
124
124
  }, null);
125
125
  const titres = sorted.map((x) => x.ev.titre || "").filter(Boolean);
126
126
  const captationVideo = sorted.some((x) => x.ev.captationVideo === true);
127
+ const eventsForSlot = sorted.map((x) => x.ev);
127
128
  ensureBucket(slot).push({
128
129
  uid: makeGroupUid(date, slot),
129
130
  chambre: "SN",
@@ -137,6 +138,7 @@ export function groupSeancePubliqueBySlot(events) {
137
138
  titre: compactTitleList(titres, 5),
138
139
  objet: joinObjets(sorted.map((x) => x.ev)),
139
140
  events: sorted.map((x) => x.ev),
141
+ odj: buildOdj(eventsForSlot, dossierBySenatUrl),
140
142
  });
141
143
  }
142
144
  }
@@ -189,32 +191,6 @@ function typeToSuffixStrict(kind) {
189
191
  return "IDI";
190
192
  }
191
193
  }
192
- function hourShortFromISO(iso) {
193
- if (!iso)
194
- return null;
195
- const dt = parseISO(iso);
196
- if (!dt)
197
- return null;
198
- const z = DateTime.fromISO(iso, { zone: PARIS });
199
- const H = String(z.hour);
200
- const mm = String(z.minute).padStart(2, "0");
201
- return `${H}${mm}`;
202
- }
203
- function hourShortFromOriginal(s) {
204
- if (!s)
205
- return null;
206
- const clean = normalizeNoAccents(s).toLowerCase();
207
- const m = clean.match(/(\d{1,2})\s*[h:]\s*(\d{2})/);
208
- if (m) {
209
- const H = String(parseInt(m[1], 10));
210
- const mm = m[2].padStart(2, "0");
211
- return `${H}${mm}`;
212
- }
213
- const m2 = clean.match(/(\d{1,2})\s*h\b/);
214
- if (m2)
215
- return `${parseInt(m2[1], 10)}00`;
216
- return null;
217
- }
218
194
  function organeInitials(input, maxLen = 8) {
219
195
  if (!input)
220
196
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/senat",
3
- "version": "2.22.5",
3
+ "version": "2.22.7",
4
4
  "description": "Handle French Sénat's open data",
5
5
  "keywords": [
6
6
  "France",
@@ -1,52 +0,0 @@
1
- import { Ses, Sub, TxtAmeli } from "./types/ameli";
2
- import { Debat } from "./types/debats";
3
- import { Ass, Aud, Auteur, DateSeance, DecCoc, DenRap, DocAtt, Ecr, EtaLoi, LecAss, LecAssRap, Lecture, Loi, Org, OriTxt, Qua, Rap, Scr, Texte, TypAtt, TypLec, TypLoi, TypTxt, TypUrl } from "./types/dosleg";
4
- import { Question } from "./types/questions";
5
- export declare const allFollows: string[];
6
- export declare class Aggregator {
7
- follow: Set<string>;
8
- objectByIdByTableName: {
9
- [name: string]: {
10
- [id: string]: object;
11
- };
12
- };
13
- requestedIdsByTableName: {
14
- [name: string]: Set<string>;
15
- };
16
- visitedIdsByTableName: {
17
- [name: string]: Set<string>;
18
- };
19
- constructor(follow: Set<string>);
20
- addAss(ass: Ass): void;
21
- addAud(aud: Aud): void;
22
- addAuteur(auteur: Auteur): void;
23
- addDateSeance(dateSeance: DateSeance): void;
24
- addDebat(debat: Debat): void;
25
- addDeccoc(deccoc: DecCoc): void;
26
- addDenrap(denrap: DenRap): void;
27
- addDocatt(docatt: DocAtt): void;
28
- addEcr(ecr: Ecr): void;
29
- addEtaloi(etaloi: EtaLoi): void;
30
- addLecass(lecass: LecAss): void;
31
- addLecassrap(lecassrap: LecAssRap): void;
32
- addLecture(lecture: Lecture): void;
33
- addLoi(loi: Loi): void;
34
- addOrg(org: Org): void;
35
- addOritxt(oritxt: OriTxt): void;
36
- addQua(qua: Qua): void;
37
- addQuestion(question: Question): void;
38
- addRap(rap: Rap): void;
39
- addScr(scr: Scr): void;
40
- addSes(ses: Ses): void;
41
- addSub(sub: Sub): void;
42
- addTexte(texte: Texte): void;
43
- addTxtAmeli(txtAmeli: TxtAmeli): void;
44
- addTypatt(typatt: TypAtt): void;
45
- addTyplec(typlec: TypLec): void;
46
- addTyploi(typloi: TypLoi): void;
47
- addTyptxt(typtxt: TypTxt): void;
48
- addTypurl(typurl: TypUrl): void;
49
- getAll(): Promise<void>;
50
- request(tableName: string, id: string): void;
51
- toJson(): any;
52
- }