@tricoteuses/senat 3.1.19 → 3.1.21

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 (108) hide show
  1. package/LICENSE.md +32 -32
  2. package/README.md +326 -326
  3. package/lib/src/other_types/collaborateurs.d.ts +5 -0
  4. package/lib/src/other_types/manifest.d.ts +11 -0
  5. package/lib/src/parsers/collaborateurs.d.ts +44 -0
  6. package/lib/src/parsers/collaborateurs.js +157 -0
  7. package/lib/src/scripts/retrieve_agenda.js +38 -4
  8. package/lib/src/scripts/retrieve_collaborateurs.js +166 -0
  9. package/lib/src/scripts/retrieve_videos.js +5 -1
  10. package/lib/src/scripts/shared/incremental_import_sql.js +859 -859
  11. package/lib/src/scripts/shared/schema_version.js +84 -84
  12. package/lib/src/scripts/shared/staging_metadata_sql.js +214 -214
  13. package/lib/src/scripts/validate_prefixed_tables.js +12 -12
  14. package/lib/src/server/ameli.js +11 -11
  15. package/lib/src/server/conversion_textes.js +106 -106
  16. package/lib/src/server/debats.js +10 -10
  17. package/lib/src/server/documents.js +22 -22
  18. package/lib/src/server/dosleg.js +33 -33
  19. package/lib/src/server/questions.js +10 -10
  20. package/lib/src/server/scrutins.js +3 -3
  21. package/lib/src/server/sens.js +19 -19
  22. package/lib/src/utils/manifest.d.ts +6 -0
  23. package/lib/src/utils/manifest.js +37 -0
  24. package/lib/src/utils/reunion_deletion.d.ts +2 -0
  25. package/lib/src/utils/reunion_deletion.js +27 -0
  26. package/lib/src/videos/match.js +4 -4
  27. package/lib/tests/collaborateurs.test.js +115 -0
  28. package/package.json +117 -117
  29. package/lib/src/config.d.ts +0 -21
  30. package/lib/src/config.js +0 -27
  31. package/lib/src/conversion_textes.d.ts +0 -11
  32. package/lib/src/conversion_textes.js +0 -316
  33. package/lib/src/databases.d.ts +0 -2
  34. package/lib/src/databases.js +0 -26
  35. package/lib/src/datasets.d.ts +0 -34
  36. package/lib/src/datasets.js +0 -233
  37. package/lib/src/git.d.ts +0 -26
  38. package/lib/src/git.js +0 -217
  39. package/lib/src/loaders.d.ts +0 -52
  40. package/lib/src/loaders.js +0 -254
  41. package/lib/src/model/agenda.d.ts +0 -6
  42. package/lib/src/model/agenda.js +0 -148
  43. package/lib/src/model/ameli.d.ts +0 -55
  44. package/lib/src/model/ameli.js +0 -148
  45. package/lib/src/model/commission.d.ts +0 -18
  46. package/lib/src/model/commission.js +0 -269
  47. package/lib/src/model/debats.d.ts +0 -67
  48. package/lib/src/model/debats.js +0 -95
  49. package/lib/src/model/documents.d.ts +0 -12
  50. package/lib/src/model/documents.js +0 -141
  51. package/lib/src/model/dosleg.d.ts +0 -7
  52. package/lib/src/model/dosleg.js +0 -326
  53. package/lib/src/model/index.d.ts +0 -7
  54. package/lib/src/model/index.js +0 -7
  55. package/lib/src/model/questions.d.ts +0 -45
  56. package/lib/src/model/questions.js +0 -89
  57. package/lib/src/model/scrutins.d.ts +0 -13
  58. package/lib/src/model/scrutins.js +0 -114
  59. package/lib/src/model/seance.d.ts +0 -3
  60. package/lib/src/model/seance.js +0 -267
  61. package/lib/src/model/sens.d.ts +0 -182
  62. package/lib/src/model/sens.js +0 -485
  63. package/lib/src/model/util.d.ts +0 -9
  64. package/lib/src/model/util.js +0 -38
  65. package/lib/src/raw_types/ameli.d.ts +0 -914
  66. package/lib/src/raw_types/ameli.js +0 -5
  67. package/lib/src/raw_types/debats.d.ts +0 -207
  68. package/lib/src/raw_types/debats.js +0 -5
  69. package/lib/src/raw_types/dosleg.d.ts +0 -1619
  70. package/lib/src/raw_types/dosleg.js +0 -5
  71. package/lib/src/raw_types/questions.d.ts +0 -423
  72. package/lib/src/raw_types/questions.js +0 -5
  73. package/lib/src/raw_types/senat.d.ts +0 -11372
  74. package/lib/src/raw_types/senat.js +0 -5
  75. package/lib/src/raw_types/sens.d.ts +0 -8248
  76. package/lib/src/raw_types/sens.js +0 -5
  77. package/lib/src/raw_types_schemats/ameli.d.ts +0 -539
  78. package/lib/src/raw_types_schemats/ameli.js +0 -2
  79. package/lib/src/raw_types_schemats/debats.d.ts +0 -127
  80. package/lib/src/raw_types_schemats/debats.js +0 -2
  81. package/lib/src/raw_types_schemats/dosleg.d.ts +0 -977
  82. package/lib/src/raw_types_schemats/dosleg.js +0 -2
  83. package/lib/src/raw_types_schemats/questions.d.ts +0 -237
  84. package/lib/src/raw_types_schemats/questions.js +0 -2
  85. package/lib/src/raw_types_schemats/sens.d.ts +0 -6915
  86. package/lib/src/raw_types_schemats/sens.js +0 -2
  87. package/lib/src/scripts/test_iter_load.js +0 -12
  88. package/lib/src/types/agenda.d.ts +0 -45
  89. package/lib/src/types/ameli.d.ts +0 -5
  90. package/lib/src/types/compte_rendu.d.ts +0 -83
  91. package/lib/src/types/debats.d.ts +0 -2
  92. package/lib/src/types/debats.js +0 -1
  93. package/lib/src/types/dosleg.d.ts +0 -70
  94. package/lib/src/types/dosleg.js +0 -1
  95. package/lib/src/types/questions.d.ts +0 -2
  96. package/lib/src/types/questions.js +0 -1
  97. package/lib/src/types/sens.d.ts +0 -10
  98. package/lib/src/types/sens.js +0 -1
  99. package/lib/src/types/sessions.d.ts +0 -6
  100. package/lib/src/types/sessions.js +0 -19
  101. package/lib/src/types/texte.d.ts +0 -72
  102. package/lib/src/types/texte.js +0 -15
  103. package/lib/src/validators/config.d.ts +0 -9
  104. package/lib/src/validators/config.js +0 -10
  105. /package/lib/src/{scripts/test_iter_load.d.ts → other_types/collaborateurs.js} +0 -0
  106. /package/lib/src/{types/agenda.js → other_types/manifest.js} +0 -0
  107. /package/lib/src/{types/ameli.js → scripts/retrieve_collaborateurs.d.ts} +0 -0
  108. /package/lib/{src/types/compte_rendu.js → tests/collaborateurs.test.d.ts} +0 -0
@@ -1,316 +0,0 @@
1
- import { JSDOM } from "jsdom";
2
- import fs from "fs-extra";
3
- import path from "path";
4
- import { DateTime } from "luxon";
5
- export function extractMetadata(xmlDoc) {
6
- const metadata = {
7
- number: null,
8
- session: null,
9
- date: null,
10
- type: null,
11
- authors: null,
12
- title: xmlDoc.querySelector("docTitle")?.textContent?.trim() || null,
13
- commission: null,
14
- };
15
- // Extract Number
16
- const docIdAlias = xmlDoc.querySelector('FRBRalias[name="signet-dossier-legislatif-senat"]');
17
- if (docIdAlias) {
18
- const value = docIdAlias.getAttribute("value");
19
- if (value) {
20
- const match = value.match(/\d+$/);
21
- if (match)
22
- metadata.number = match[0];
23
- }
24
- }
25
- // Extract Session
26
- const sessionUri = xmlDoc.querySelector("FRBRExpression > FRBRuri")?.getAttribute("value");
27
- if (sessionUri) {
28
- const match = sessionUri.match(/\d{4}-\d{4}/);
29
- if (match)
30
- metadata.session = match[0];
31
- }
32
- // Extract Date
33
- const depotDate = xmlDoc.querySelector('FRBRdate[name="#depot"]')?.getAttribute("date");
34
- if (depotDate) {
35
- metadata.date = DateTime.fromISO(depotDate).setLocale("fr").toFormat("d MMMM yyyy");
36
- }
37
- else {
38
- const presentationDate = xmlDoc.querySelector('FRBRdate[name="#presentation"]')?.getAttribute("date");
39
- if (presentationDate) {
40
- metadata.date = DateTime.fromISO(presentationDate).setLocale("fr").toFormat("d MMMM yyyy");
41
- }
42
- }
43
- // Extract Type
44
- const bill = xmlDoc.querySelector("bill");
45
- const typeCode = bill?.getAttribute("name");
46
- if (typeCode === "ppl") {
47
- metadata.type = "PROPOSITION DE LOI";
48
- }
49
- else if (typeCode === "pjl") {
50
- metadata.type = "PROJET DE LOI";
51
- }
52
- // Extract Authors
53
- const authorRef = xmlDoc.querySelector('FRBRWork > FRBRauthor[as="#auteur"]')?.getAttribute("href");
54
- if (authorRef) {
55
- const authorId = authorRef.replace(/^#/, "");
56
- const authorPerson = xmlDoc.querySelector(`TLCPerson[eId="${authorId}"]`);
57
- if (authorPerson) {
58
- const showAs = authorPerson.getAttribute("showAs");
59
- if (showAs) {
60
- metadata.authors = showAs.replace(/, Sénateurs$/, ", Sénateurs et Sénatrices");
61
- }
62
- }
63
- }
64
- // Extract Commission
65
- const commissionNode = xmlDoc.querySelector('TLCOrganization[eId="commission-senat"]') ||
66
- xmlDoc.querySelector('TLCOrganization[eId^="commission-"]:not([eId*="assemblee"])');
67
- if (commissionNode) {
68
- metadata.commission = commissionNode.getAttribute("showAs");
69
- }
70
- return metadata;
71
- }
72
- export async function convertSenatXmlToHtml(texteXml, outputFilePath) {
73
- let xmlDoc;
74
- try {
75
- xmlDoc = new JSDOM(texteXml, { contentType: "text/xml" }).window.document;
76
- }
77
- catch (err) {
78
- if (await fs.pathExists(outputFilePath)) {
79
- await fs.remove(outputFilePath);
80
- }
81
- throw err;
82
- }
83
- const metadata = extractMetadata(xmlDoc);
84
- const xmlBody = xmlDoc.querySelector("body");
85
- const style = `
86
- body {
87
- font-family: "URW Bookman", "Bookman Old Style", serif;
88
- max-width: 800px;
89
- margin: 40px auto;
90
- line-height: 1.5;
91
- color: #333;
92
- }
93
- .header {
94
- text-align: center;
95
- margin-bottom: 40px;
96
- border-bottom: 2px solid #333;
97
- padding-bottom: 20px;
98
- }
99
- .header-top {
100
- font-weight: bold;
101
- font-size: 1.2em;
102
- margin-bottom: 10px;
103
- }
104
- .header-session {
105
- text-transform: uppercase;
106
- font-size: 0.9em;
107
- margin-bottom: 5px;
108
- }
109
- .header-date {
110
- font-size: 0.9em;
111
- margin-bottom: 5px;
112
- }
113
- .header-number {
114
- font-weight: bold;
115
- font-size: 1.1em;
116
- margin-bottom: 20px;
117
- }
118
- .header-type {
119
- font-weight: bold;
120
- font-size: 1.5em;
121
- margin-top: 20px;
122
- }
123
- .header-authors {
124
- margin-top: 20px;
125
- font-style: italic;
126
- }
127
- .header-commission {
128
- margin-top: 15px;
129
- font-size: 0.9em;
130
- }
131
- h1 {
132
- text-align: center;
133
- font-size: 1.8em;
134
- margin-top: 10px;
135
- }
136
- p {
137
- margin: 0.6em 0;
138
- }
139
- p.has-alinea {
140
- position: relative;
141
- padding-left: 2.5em;
142
- }
143
- .alinea {
144
- position: absolute;
145
- left: 0;
146
- top: 0.15em;
147
- display: inline-flex;
148
- align-items: center;
149
- justify-content: center;
150
- min-width: 1.5em;
151
- height: 1.5em;
152
- padding: 0 0.3em;
153
- margin-right: 0.3em;
154
- font-size: 0.75em;
155
- font-weight: bold;
156
- color: #555;
157
- background-color: #f0f0f0;
158
- border: 1px solid #ccc;
159
- border-radius: 1em;
160
- }
161
- .num {
162
- font-weight: bold;
163
- margin-right: 0.2em;
164
- }
165
- .article {
166
- margin-top: 2em;
167
- }
168
- .article h3 {
169
- border-bottom: 1px solid #eee;
170
- padding-bottom: 5px;
171
- }
172
- `;
173
- const htmlDocTemplate = `<!DOCTYPE html>
174
- <html lang="fr">
175
- <head>
176
- <meta charset="utf-8">
177
- <title>${metadata.title || "Document Sénat"}</title>
178
- <style>${style}</style>
179
- </head>
180
- <body>
181
- <div class="header">
182
- <div class="header-top">SÉNAT</div>
183
- <div class="header-session">SESSION ORDINAIRE DE ${metadata.session || "...."}</div>
184
- ${metadata.date ? `<div class="header-date">Enregistré à la Présidence du Sénat le ${metadata.date}</div>` : ""}
185
- <div class="header-number">N° ${metadata.number || "...."}</div>
186
- <div class="header-type">${metadata.type || ""}</div>
187
- <div class="header-authors">${metadata.authors || ""}</div>
188
- ${metadata.commission
189
- ? `<div class="header-commission">Envoyée à la ${metadata.commission.toLowerCase()}, sous réserve de la constitution éventuelle d'une commission spéciale dans les conditions prévues par le Règlement.</div>`
190
- : ""}
191
- </div>
192
- <h1>${metadata.title || ""}</h1>
193
- </body>
194
- </html>`;
195
- const { document: htmlDoc } = new JSDOM(htmlDocTemplate).window;
196
- const body = htmlDoc.body;
197
- if (xmlBody) {
198
- const processNode = (xmlNode, htmlParent, alineaData = null) => {
199
- const children = Array.from(xmlNode.childNodes);
200
- const alineaChildren = [];
201
- const otherChildren = [];
202
- for (const child of children) {
203
- if (child.nodeType === 1 && child.tagName.toLowerCase() === "alinea") {
204
- alineaChildren.push(child);
205
- }
206
- else {
207
- otherChildren.push(child);
208
- }
209
- }
210
- for (const child of otherChildren) {
211
- if (child.nodeType === 3) {
212
- htmlParent.appendChild(htmlDoc.createTextNode(child.textContent || ""));
213
- }
214
- else if (child.nodeType === 1) {
215
- const element = child;
216
- const tagName = element.tagName.toLowerCase();
217
- let htmlElement = null;
218
- switch (tagName) {
219
- case "article": {
220
- htmlElement = htmlDoc.createElement("div");
221
- htmlElement.className = "article";
222
- const artId = element.getAttribute("eId");
223
- if (artId)
224
- htmlElement.id = artId;
225
- const artGuid = element.getAttribute("GUID");
226
- if (artGuid)
227
- htmlElement.setAttribute("data-guid", artGuid);
228
- break;
229
- }
230
- case "num": {
231
- const parentTagName = element.parentElement?.tagName.toLowerCase();
232
- if (parentTagName === "alinea" && alineaData) {
233
- alineaData.numText = element.textContent?.trim();
234
- continue;
235
- }
236
- htmlElement = htmlDoc.createElement("span");
237
- htmlElement.className = "num";
238
- break;
239
- }
240
- case "heading":
241
- htmlElement = htmlDoc.createElement("h4");
242
- break;
243
- case "p":
244
- htmlElement = htmlDoc.createElement("p");
245
- if (alineaData) {
246
- htmlElement.classList.add("has-alinea");
247
- if (alineaData.id)
248
- htmlElement.id = alineaData.id;
249
- if (alineaData.guid)
250
- htmlElement.setAttribute("data-guid", alineaData.guid);
251
- const pastille = alineaData.pastille;
252
- if (pastille) {
253
- htmlElement.setAttribute("data-pastille", pastille);
254
- if (!alineaData.pastilleApplied) {
255
- const span = htmlDoc.createElement("span");
256
- span.className = "alinea";
257
- span.setAttribute("data-alinea", pastille);
258
- span.textContent = pastille;
259
- htmlElement.appendChild(span);
260
- alineaData.pastilleApplied = true;
261
- }
262
- }
263
- if (alineaData.numText) {
264
- const xmlPText = element.textContent || "";
265
- const normalize = (s) => s.replace(/[\\s\\u00A0]+/g, " ").trim();
266
- const normalizedNum = normalize(alineaData.numText);
267
- const normalizedP = normalize(xmlPText);
268
- if (normalizedNum && !normalizedP.startsWith(normalizedNum)) {
269
- const numSpan = htmlDoc.createElement("span");
270
- numSpan.className = "num";
271
- numSpan.textContent = alineaData.numText + " ";
272
- htmlElement.appendChild(numSpan);
273
- }
274
- alineaData.numText = null;
275
- }
276
- }
277
- break;
278
- case "content":
279
- processNode(element, htmlParent, alineaData);
280
- continue;
281
- case "doctitle":
282
- continue;
283
- case "i":
284
- case "b":
285
- case "u":
286
- case "sup":
287
- case "sub":
288
- htmlElement = htmlDoc.createElement(tagName);
289
- break;
290
- default:
291
- htmlElement = htmlDoc.createElement("span");
292
- htmlElement.setAttribute("data-xml-tag", tagName);
293
- break;
294
- }
295
- if (htmlElement) {
296
- htmlParent.appendChild(htmlElement);
297
- processNode(element, htmlElement, alineaData);
298
- }
299
- }
300
- }
301
- for (const element of alineaChildren) {
302
- const nextAlineaData = {
303
- id: element.getAttribute("eId"),
304
- guid: element.getAttribute("GUID"),
305
- pastille: element.getAttribute("data:pastille"),
306
- pastilleApplied: false,
307
- };
308
- processNode(element, htmlParent, nextAlineaData);
309
- }
310
- };
311
- processNode(xmlBody, body);
312
- }
313
- const htmlContent = "<!DOCTYPE html>\n" + htmlDoc.documentElement.outerHTML;
314
- await fs.ensureDir(path.dirname(outputFilePath));
315
- await fs.outputFile(outputFilePath, htmlContent);
316
- }
@@ -1,2 +0,0 @@
1
- import { Kysely } from "kysely";
2
- export declare const dbSenat: Kysely<any>;
@@ -1,26 +0,0 @@
1
- import { Kysely, PostgresDialect } from "kysely";
2
- import * as pg from "pg";
3
- import { types } from "pg";
4
- import Cursor from "pg-cursor";
5
- import config from "./config";
6
- // Map int8 to number instead of string
7
- // https://github.com/brianc/node-pg-types#use
8
- pg.types.setTypeParser(types.builtins.INT8, (val) => {
9
- return parseInt(val, 10);
10
- });
11
- const senatPool = new pg.Pool({
12
- database: "senat",
13
- host: config.db.host,
14
- user: config.db.user,
15
- password: config.db.password,
16
- port: config.db.port,
17
- max: 10,
18
- });
19
- const senatDialect = new PostgresDialect({
20
- pool: senatPool,
21
- cursor: Cursor,
22
- });
23
- export const dbSenat = new Kysely({
24
- log: ["error"],
25
- dialect: senatDialect,
26
- });
@@ -1,34 +0,0 @@
1
- export interface Dataset {
2
- database: string;
3
- repairEncoding: boolean;
4
- repairZip?: (dataset: Dataset, dataDir: string) => void;
5
- title: string;
6
- url: string;
7
- indexes?: {
8
- [table: string]: Array<{
9
- name: string;
10
- columns: string[];
11
- }>;
12
- };
13
- }
14
- export interface Datasets {
15
- ameli: Dataset;
16
- debats: Dataset;
17
- dosleg: Dataset;
18
- questions: Dataset;
19
- sens: Dataset;
20
- }
21
- export declare enum EnabledDatasets {
22
- None = 0,
23
- Ameli = 1,
24
- Debats = 2,
25
- DosLeg = 4,
26
- Questions = 8,
27
- Sens = 16,
28
- PhotosSenateurs = 32,
29
- Agenda = 64,
30
- All = 127
31
- }
32
- export declare const datasets: Datasets;
33
- export declare function getEnabledDatasets(categories: string[]): EnabledDatasets;
34
- export declare function getChosenDatasets(enabledDatasets: EnabledDatasets): Dataset[];
@@ -1,233 +0,0 @@
1
- import fs from "fs-extra";
2
- import path from "path";
3
- import assert from "assert";
4
- export var EnabledDatasets;
5
- (function (EnabledDatasets) {
6
- EnabledDatasets[EnabledDatasets["None"] = 0] = "None";
7
- EnabledDatasets[EnabledDatasets["Ameli"] = 1] = "Ameli";
8
- EnabledDatasets[EnabledDatasets["Debats"] = 2] = "Debats";
9
- EnabledDatasets[EnabledDatasets["DosLeg"] = 4] = "DosLeg";
10
- EnabledDatasets[EnabledDatasets["Questions"] = 8] = "Questions";
11
- EnabledDatasets[EnabledDatasets["Sens"] = 16] = "Sens";
12
- EnabledDatasets[EnabledDatasets["PhotosSenateurs"] = 32] = "PhotosSenateurs";
13
- EnabledDatasets[EnabledDatasets["Agenda"] = 64] = "Agenda";
14
- EnabledDatasets[EnabledDatasets["All"] = 127] = "All";
15
- })(EnabledDatasets || (EnabledDatasets = {}));
16
- export const datasets = {
17
- ameli: {
18
- database: "ameli",
19
- repairEncoding: true,
20
- repairZip: (dataset, dataDir) => {
21
- const sqlFilename = `${dataset.database}.sql`;
22
- const sqlFilePath = path.join(dataDir, sqlFilename);
23
- fs.removeSync(sqlFilePath);
24
- fs.moveSync(path.join(dataDir, "var", "opt", "opendata", sqlFilename), sqlFilePath);
25
- },
26
- title: "Amendements",
27
- url: "https://data.senat.fr/data/ameli/ameli.zip",
28
- indexes: {
29
- amdsen: [
30
- { name: "idx_amdid", columns: ["amdid"] },
31
- { name: "idx_senid", columns: ["senid"] },
32
- { name: "idx_grpid", columns: ["grpid"] },
33
- ],
34
- sen_ameli: [{ name: "idx_entid", columns: ["entid"] }],
35
- grppol_ameli: [{ name: "idx_entid", columns: ["entid"] }],
36
- sub: [
37
- { name: "idx_id", columns: ["id"] },
38
- { name: "idx_typid", columns: ["typid"] },
39
- { name: "idx_merid", columns: ["merid"] },
40
- { name: "idx_comdelid", columns: ["comdelid"] },
41
- ],
42
- typsub: [{ name: "idx_id", columns: ["id"] }],
43
- typrect: [{ name: "idx_id", columns: ["id"] }],
44
- txt_ameli: [
45
- { name: "idx_id", columns: ["id"] },
46
- { name: "idx_txtetaid", columns: ["txtetaid"] },
47
- { name: "idx_sesdepid", columns: ["sesdepid"] },
48
- { name: "idx_natid", columns: ["natid"] },
49
- { name: "idx_lecid", columns: ["lecid"] },
50
- ],
51
- etatxt: [{ name: "idx_id", columns: ["id"] }],
52
- ses: [
53
- { name: "idx_id", columns: ["id"] },
54
- { name: "idx_typid", columns: ["typid"] },
55
- { name: "idx_ann", columns: ["ann"] },
56
- ],
57
- typses: [{ name: "idx_id", columns: ["id"] }],
58
- nat: [{ name: "idx_id", columns: ["id"] }],
59
- lec_ameli: [{ name: "idx_id", columns: ["id"] }],
60
- mot: [{ name: "idx_id", columns: ["id"] }],
61
- avicom: [{ name: "idx_id", columns: ["id"] }],
62
- avigvt: [{ name: "idx_id", columns: ["id"] }],
63
- sor: [{ name: "idx_id", columns: ["id"] }],
64
- irr: [{ name: "idx_id", columns: ["id"] }],
65
- com_ameli: [{ name: "idx_entid", columns: ["entid"] }],
66
- cab: [{ name: "idx_entid", columns: ["entid"] }],
67
- amd: [
68
- { name: "idx_subid", columns: ["subid"] },
69
- { name: "idx_typrectid", columns: ["typrectid"] },
70
- { name: "idx_txtid", columns: ["txtid"] },
71
- { name: "idx_motid", columns: ["motid"] },
72
- { name: "idx_avcid", columns: ["avcid"] },
73
- { name: "idx_avgid", columns: ["avgid"] },
74
- { name: "idx_sorid", columns: ["sorid"] },
75
- { name: "idx_irrid", columns: ["irrid"] },
76
- { name: "idx_nomentid", columns: ["nomentid"] },
77
- ],
78
- },
79
- },
80
- debats: {
81
- database: "debats",
82
- repairEncoding: false,
83
- title: "Informations relatives aux comptes rendus intégraux de la séance publique",
84
- url: "https://data.senat.fr/data/debats/debats.zip",
85
- indexes: {
86
- secdis: [
87
- { name: "idx_datsea", columns: ["datsea"] },
88
- { name: "idx_typseccod", columns: ["typseccod"] },
89
- ],
90
- intpjl: [{ name: "idx_secdiscle", columns: ["secdiscle"] }],
91
- secdivers: [
92
- { name: "idx_datsea", columns: ["datsea"] },
93
- { name: "idx_typseccod", columns: ["typseccod"] },
94
- ],
95
- intdivers: [{ name: "idx_intdiverscle", columns: ["intdiverscle"] }],
96
- lecassdeb: [{ name: "idx_datsea", columns: ["datsea"] }],
97
- },
98
- },
99
- dosleg: {
100
- database: "dosleg",
101
- repairEncoding: false,
102
- title: "Dossiers législatifs",
103
- url: "https://data.senat.fr/data/dosleg/dosleg.zip",
104
- indexes: {
105
- amescr: [{ name: "idx_scrnum", columns: ["scrnum"] }],
106
- auteur: [{ name: "idx_autcod", columns: ["autcod"] }],
107
- corscr: [{ name: "idx_scrnum", columns: ["scrnum"] }],
108
- date_seance: [
109
- { name: "idx_code", columns: ["code"] },
110
- { name: "idx_lecidt", columns: ["lecidt"] },
111
- ],
112
- deccoc: [{ name: "idx_deccoccod", columns: ["deccoccod"] }],
113
- etaloi: [{ name: "idx_etaloicod", columns: ["etaloicod"] }],
114
- lecass: [
115
- { name: "idx_lecidt", columns: ["lecidt"] },
116
- { name: "idx_codass", columns: ["codass"] },
117
- { name: "idx_orgcod", columns: ["orgcod"] },
118
- { name: "idx_orippr", columns: ["orippr"] },
119
- ],
120
- lecassrap: [
121
- { name: "idx_rapcod", columns: ["rapcod"] },
122
- { name: "idx_lecassidt", columns: ["lecassidt"] },
123
- ],
124
- lecture: [
125
- { name: "idx_loicod", columns: ["loicod"] },
126
- { name: "idx_typleccod", columns: ["typleccod"] },
127
- { name: "idx_lecidt", columns: ["lecidt"] },
128
- ],
129
- loi: [
130
- { name: "idx_typloicod", columns: ["typloicod"] },
131
- { name: "idx_etaloicod", columns: ["etaloicod"] },
132
- { name: "idx_deccoccod", columns: ["deccoccod"] },
133
- { name: "idx_loicod", columns: ["loicod"] },
134
- ],
135
- loithe: [
136
- { name: "idx_thecle", columns: ["thecle"] },
137
- { name: "idx_loicod", columns: ["loicod"] },
138
- ],
139
- posvot: [{ name: "idx_posvotcod", columns: ["posvotcod"] }],
140
- rap: [
141
- { name: "idx_rapcod", columns: ["rapcod"] },
142
- { name: "idx_coddenrap", columns: ["coddenrap"] },
143
- ],
144
- rolsig: [{ name: "idx_signataire", columns: ["signataire"] }],
145
- scr: [
146
- { name: "idx_code", columns: ["code"] },
147
- { name: "idx_scrnum", columns: ["scrnum"] },
148
- { name: "idx_sesann", columns: ["sesann"] },
149
- ],
150
- stavot: [{ name: "idx_stavotidt", columns: ["stavotidt"] }],
151
- texte: [
152
- { name: "idx_lecassidt", columns: ["lecassidt"] },
153
- { name: "idx_oritxtcod", columns: ["oritxtcod"] },
154
- { name: "idx_typtxtcod", columns: ["typtxtcod"] },
155
- { name: "idx_texcod", columns: ["texcod"] },
156
- ],
157
- the: [{ name: "idx_thecle", columns: ["thecle"] }],
158
- titsen: [{ name: "idx_titsencod", columns: ["titsencod"] }],
159
- typloi: [{ name: "idx_typloicod", columns: ["typloicod"] }],
160
- typtxt: [{ name: "idx_typtxtcod", columns: ["typtxtcod"] }],
161
- votsen: [
162
- { name: "idx_scrnum", columns: ["scrnum"] },
163
- { name: "idx_sesann", columns: ["sesann"] },
164
- { name: "idx_titsencod", columns: ["titsencod"] },
165
- { name: "idx_stavotidt", columns: ["stavotidt"] },
166
- { name: "idx_posvotcod", columns: ["posvotcod"] },
167
- { name: "idx_senmat", columns: ["senmat"] },
168
- ],
169
- },
170
- },
171
- questions: {
172
- database: "questions",
173
- repairEncoding: false,
174
- title: "Questions écrites et orales posées par les sénateurs au Gouvernement",
175
- url: "https://data.senat.fr/data/questions/questions.zip",
176
- indexes: {
177
- tam_reponses: [{ name: "idx_idque", columns: ["idque"] }],
178
- tam_questions: [
179
- { name: "idx_sorquecod", columns: ["sorquecod"] },
180
- { name: "idx_etaquecod", columns: ["etaquecod"] },
181
- ],
182
- the: [{ name: "idx_thenouidt", columns: ["thenouidt"] }],
183
- sortquestion: [{ name: "idx_sorquecod", columns: ["sorquecod"] }],
184
- etatquestion: [{ name: "idx_etaquecod", columns: ["etaquecod"] }],
185
- },
186
- },
187
- sens: {
188
- database: "sens",
189
- repairEncoding: false,
190
- repairZip: (dataset, dataDir) => {
191
- const sqlFilename = `${dataset.database}.sql`;
192
- const sqlFilePath = path.join(dataDir, sqlFilename);
193
- fs.removeSync(sqlFilePath);
194
- fs.moveSync(path.join(dataDir, "export_sens.sql"), sqlFilePath);
195
- },
196
- title: "Sénateurs (y compris organes et présence)",
197
- url: "https://data.senat.fr/data/senateurs/export_sens.zip",
198
- indexes: {
199
- dpt: [
200
- { name: "idx_dptnum", columns: ["dptnum"] },
201
- { name: "idx_regcod", columns: ["regcod"] },
202
- ],
203
- activite_loi: [{ name: "idx_actid", columns: ["actid"] }],
204
- activite_delegation: [{ name: "idx_actid", columns: ["actid"] }],
205
- activite_participant: [{ name: "idx_senmat", columns: ["senmat"] }],
206
- activite_senateur: [{ name: "idx_senmat", columns: ["senmat"] }],
207
- senbur: [
208
- { name: "idx_senmat", columns: ["senmat"] },
209
- { name: "idx_burcod", columns: ["burcod"] },
210
- ],
211
- elucan: [
212
- { name: "idx_senmat", columns: ["senmat"] },
213
- { name: "idx_typmancod", columns: ["typmancod"] },
214
- ],
215
- },
216
- },
217
- };
218
- export function getEnabledDatasets(categories) {
219
- categories.map((datasetName) => assert.notStrictEqual(EnabledDatasets[datasetName], undefined, `Unknown name of dataset: ${datasetName}`));
220
- return categories.reduce((enabledDatasets, datasetName) => {
221
- const enabledDataset = EnabledDatasets[datasetName];
222
- return enabledDatasets | (enabledDataset || EnabledDatasets.None);
223
- }, EnabledDatasets.None);
224
- }
225
- export function getChosenDatasets(enabledDatasets) {
226
- return [
227
- enabledDatasets & EnabledDatasets.Ameli ? datasets.ameli : null,
228
- enabledDatasets & EnabledDatasets.Debats ? datasets.debats : null,
229
- enabledDatasets & EnabledDatasets.DosLeg ? datasets.dosleg : null,
230
- enabledDatasets & EnabledDatasets.Questions ? datasets.questions : null,
231
- enabledDatasets & EnabledDatasets.Sens ? datasets.sens : null,
232
- ].filter((dataset) => dataset !== null);
233
- }
package/lib/src/git.d.ts DELETED
@@ -1,26 +0,0 @@
1
- export declare function initRepo(repositoryDir: string): void;
2
- export declare function commit(repositoryDir: string, message: string): boolean;
3
- export declare function commitAndPush(repositoryDir: string, message: string, remotes?: string[]): number;
4
- export declare function resetAndPull(gitDir: string): boolean;
5
- export declare function clone(gitGroupUrl: string | undefined, gitName: string, workingDir: string): void;
6
- export declare function run(repositoryDir: string, args: string, verbose?: boolean): string;
7
- export declare function test(repositoryDir: string, args: string, verbose?: boolean): boolean;
8
- /**
9
- * Information about a changed file in git
10
- */
11
- export interface GitChangedFile {
12
- path: string;
13
- status: "A" | "M" | "D" | "R" | "C" | "T" | "U";
14
- }
15
- /**
16
- * Get the list of files that have changed since a specific commit in a git repository.
17
- * @param repositoryDir The directory of the git repository
18
- * @param sinceCommit The commit hash to compare against (e.g., "HEAD~1", "abc123", etc.)
19
- * @param options Options for filtering
20
- * @param options.diffFilter Git diff-filter string (default: "AMR").
21
- * A=Added, M=Modified, D=Deleted, R=Renamed, C=Copied, T=Type changed, U=Unmerged
22
- * @returns A Map of file paths to their git status
23
- */
24
- export declare function getChangedFilesSinceCommit(repositoryDir: string, sinceCommit: string, options?: {
25
- diffFilter?: string;
26
- }): Map<string, GitChangedFile["status"]>;