@tricoteuses/assemblee 2.4.3 → 2.5.0
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/README.md +2 -2
- package/lib/loaders.js +213 -200
- package/lib/parsers.js +1 -1
- package/lib/scripts/process_open_dataset.d.ts +2 -1
- package/lib/scripts/retrieve_documents.d.ts +2 -1
- package/lib/scripts/retrieve_videos.d.ts +1 -3
- package/lib/scripts/shared/cli_helpers.d.ts +6 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -100,9 +100,9 @@ If you use such options, use them in all subsequent commands too (_data:regorgan
|
|
|
100
100
|
- `--dataset` or `-d <name>`: Clean a specific dataset only
|
|
101
101
|
- `--no-reset-after-commit`: Skip Git reset after committing (useful to preserve local changes)
|
|
102
102
|
- `--no-validate` or `-V`: Skip schema validation during cleaning
|
|
103
|
-
- `--
|
|
104
|
-
- `--fetchDocuments` : Specify to retrieve documents like reports, videos metadata files
|
|
103
|
+
- `--fetchDocuments` : Specify to retrieve documents
|
|
105
104
|
- `--parseDocuments`: Specify to parse documents into cleaned json
|
|
105
|
+
- `--fetchVideos`: Retrieve videos
|
|
106
106
|
|
|
107
107
|
### Options for Retrieving Documents
|
|
108
108
|
|
package/lib/loaders.js
CHANGED
|
@@ -3,12 +3,15 @@ import i from "fs-extra";
|
|
|
3
3
|
import n from "node:path";
|
|
4
4
|
import "node:crypto";
|
|
5
5
|
import { L as r, a1 as R, a2 as Z, a3 as q, a4 as B, a5 as J, a6 as N, Y, $ as G, a0 as K, X as ee, Z as te, _ as se } from "./uids-DaRrTkI-.js";
|
|
6
|
-
import { w as
|
|
6
|
+
import { w as P } from "./file_systems-CzTtoLWb.js";
|
|
7
7
|
import { C as w } from "./amendements-40Z7OJLT.js";
|
|
8
|
-
var I = /* @__PURE__ */ ((
|
|
9
|
-
function y(
|
|
10
|
-
const e = n.join(
|
|
11
|
-
i.existsSync(e) && i.removeSync(e), i.existsSync(n.join(
|
|
8
|
+
var I = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.ActeursEtOrganes = 1] = "ActeursEtOrganes", t[t.Agendas = 2] = "Agendas", t[t.Amendements = 4] = "Amendements", t[t.DossiersLegislatifs = 8] = "DossiersLegislatifs", t[t.Photos = 16] = "Photos", t[t.Scrutins = 32] = "Scrutins", t[t.Questions = 64] = "Questions", t[t.ComptesRendusSeances = 128] = "ComptesRendusSeances", t[t.All = 255] = "All", t))(I || {});
|
|
9
|
+
function y(t, s) {
|
|
10
|
+
const e = n.join(s, t.filename);
|
|
11
|
+
i.existsSync(e) && i.removeSync(e), i.existsSync(n.join(s, `${t.filename}.temp`, "json")) ? i.moveSync(
|
|
12
|
+
n.join(s, `${t.filename}.temp`, "json"),
|
|
13
|
+
e
|
|
14
|
+
) : i.mkdirSync(e);
|
|
12
15
|
}
|
|
13
16
|
const S = {
|
|
14
17
|
acteursEtOrganes: [
|
|
@@ -276,13 +279,15 @@ const S = {
|
|
|
276
279
|
filename: "AMO40_deputes_actifs_mandats_actifs_organes_divises_XVII.json",
|
|
277
280
|
ignoreForWeb: !0,
|
|
278
281
|
legislature: r.DixSept,
|
|
279
|
-
repairZip: (
|
|
280
|
-
const e = n.join(
|
|
281
|
-
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.pathExistsSync(
|
|
282
|
-
n.join(
|
|
282
|
+
repairZip: (t, s) => {
|
|
283
|
+
const e = n.join(s, t.filename);
|
|
284
|
+
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.pathExistsSync(
|
|
285
|
+
n.join(s, `${t.filename}.temp`, "acteur")
|
|
286
|
+
) && i.moveSync(
|
|
287
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
283
288
|
n.join(e, "acteur")
|
|
284
289
|
), i.moveSync(
|
|
285
|
-
n.join(
|
|
290
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
286
291
|
n.join(e, "organe")
|
|
287
292
|
);
|
|
288
293
|
},
|
|
@@ -318,13 +323,15 @@ const S = {
|
|
|
318
323
|
filename: "AMO40_deputes_actifs_mandats_actifs_organes_divises_XVI.json",
|
|
319
324
|
ignoreForWeb: !0,
|
|
320
325
|
legislature: r.Seize,
|
|
321
|
-
repairZip: (
|
|
322
|
-
const e = n.join(
|
|
323
|
-
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.pathExistsSync(
|
|
324
|
-
n.join(
|
|
326
|
+
repairZip: (t, s) => {
|
|
327
|
+
const e = n.join(s, t.filename);
|
|
328
|
+
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.pathExistsSync(
|
|
329
|
+
n.join(s, `${t.filename}.temp`, "acteur")
|
|
330
|
+
) && i.moveSync(
|
|
331
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
325
332
|
n.join(e, "acteur")
|
|
326
333
|
), i.moveSync(
|
|
327
|
-
n.join(
|
|
334
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
328
335
|
n.join(e, "organe")
|
|
329
336
|
);
|
|
330
337
|
},
|
|
@@ -360,13 +367,13 @@ const S = {
|
|
|
360
367
|
filename: "AMO40_deputes_actifs_mandats_actifs_organes_divises_XV.json",
|
|
361
368
|
ignoreForWeb: !0,
|
|
362
369
|
legislature: r.Quinze,
|
|
363
|
-
repairZip: (
|
|
364
|
-
const e = n.join(
|
|
370
|
+
repairZip: (t, s) => {
|
|
371
|
+
const e = n.join(s, t.filename);
|
|
365
372
|
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.moveSync(
|
|
366
|
-
n.join(
|
|
373
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
367
374
|
n.join(e, "acteur")
|
|
368
375
|
), i.moveSync(
|
|
369
|
-
n.join(
|
|
376
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
370
377
|
n.join(e, "organe")
|
|
371
378
|
);
|
|
372
379
|
},
|
|
@@ -392,16 +399,16 @@ const S = {
|
|
|
392
399
|
filename: "AMO50_acteurs_mandats_organes_divises_XVII.json",
|
|
393
400
|
ignoreForWeb: !0,
|
|
394
401
|
legislature: r.DixSept,
|
|
395
|
-
repairZip: (
|
|
396
|
-
const e = n.join(
|
|
402
|
+
repairZip: (t, s) => {
|
|
403
|
+
const e = n.join(s, t.filename);
|
|
397
404
|
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.moveSync(
|
|
398
|
-
n.join(
|
|
405
|
+
n.join(s, `${t.filename}.temp`, "mandat"),
|
|
399
406
|
n.join(e, "mandat")
|
|
400
407
|
), i.moveSync(
|
|
401
|
-
n.join(
|
|
408
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
402
409
|
n.join(e, "acteur")
|
|
403
410
|
), i.moveSync(
|
|
404
|
-
n.join(
|
|
411
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
405
412
|
n.join(e, "organe")
|
|
406
413
|
);
|
|
407
414
|
},
|
|
@@ -427,16 +434,16 @@ const S = {
|
|
|
427
434
|
filename: "AMO50_acteurs_mandats_organes_divises_XVI.json",
|
|
428
435
|
ignoreForWeb: !0,
|
|
429
436
|
legislature: r.Seize,
|
|
430
|
-
repairZip: (
|
|
431
|
-
const e = n.join(
|
|
437
|
+
repairZip: (t, s) => {
|
|
438
|
+
const e = n.join(s, t.filename);
|
|
432
439
|
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.moveSync(
|
|
433
|
-
n.join(
|
|
440
|
+
n.join(s, `${t.filename}.temp`, "mandat"),
|
|
434
441
|
n.join(e, "mandat")
|
|
435
442
|
), i.moveSync(
|
|
436
|
-
n.join(
|
|
443
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
437
444
|
n.join(e, "acteur")
|
|
438
445
|
), i.moveSync(
|
|
439
|
-
n.join(
|
|
446
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
440
447
|
n.join(e, "organe")
|
|
441
448
|
);
|
|
442
449
|
},
|
|
@@ -462,16 +469,16 @@ const S = {
|
|
|
462
469
|
filename: "AMO50_acteurs_mandats_organes_divises_XV.json",
|
|
463
470
|
ignoreForWeb: !0,
|
|
464
471
|
legislature: r.Quinze,
|
|
465
|
-
repairZip: (
|
|
466
|
-
const e = n.join(
|
|
472
|
+
repairZip: (t, s) => {
|
|
473
|
+
const e = n.join(s, t.filename);
|
|
467
474
|
i.existsSync(e) && i.removeSync(e), i.mkdirSync(e), i.moveSync(
|
|
468
|
-
n.join(
|
|
475
|
+
n.join(s, `${t.filename}.temp`, "mandat"),
|
|
469
476
|
n.join(e, "mandat")
|
|
470
477
|
), i.moveSync(
|
|
471
|
-
n.join(
|
|
478
|
+
n.join(s, `${t.filename}.temp`, "acteur"),
|
|
472
479
|
n.join(e, "acteur")
|
|
473
480
|
), i.moveSync(
|
|
474
|
-
n.join(
|
|
481
|
+
n.join(s, `${t.filename}.temp`, "organe"),
|
|
475
482
|
n.join(e, "organe")
|
|
476
483
|
);
|
|
477
484
|
},
|
|
@@ -668,9 +675,12 @@ const S = {
|
|
|
668
675
|
{
|
|
669
676
|
filename: "Comptes_Rendus_Seances_XVII.xml",
|
|
670
677
|
legislature: r.DixSept,
|
|
671
|
-
repairZip: (
|
|
672
|
-
const e = n.join(
|
|
673
|
-
i.existsSync(e) && i.removeSync(e), i.moveSync(
|
|
678
|
+
repairZip: (t, s) => {
|
|
679
|
+
const e = n.join(s, t.filename);
|
|
680
|
+
i.existsSync(e) && i.removeSync(e), i.moveSync(
|
|
681
|
+
n.join(s, `${t.filename}.temp`, "xml"),
|
|
682
|
+
e
|
|
683
|
+
);
|
|
674
684
|
},
|
|
675
685
|
structure: 1,
|
|
676
686
|
title: "Comptes rendus des séances publiques de la XVIIème législature",
|
|
@@ -679,9 +689,12 @@ const S = {
|
|
|
679
689
|
{
|
|
680
690
|
filename: "Comptes_Rendus_Seances_XVI.xml",
|
|
681
691
|
legislature: r.Seize,
|
|
682
|
-
repairZip: (
|
|
683
|
-
const e = n.join(
|
|
684
|
-
i.existsSync(e) && i.removeSync(e), i.moveSync(
|
|
692
|
+
repairZip: (t, s) => {
|
|
693
|
+
const e = n.join(s, t.filename);
|
|
694
|
+
i.existsSync(e) && i.removeSync(e), i.moveSync(
|
|
695
|
+
n.join(s, `${t.filename}.temp`, "xml"),
|
|
696
|
+
e
|
|
697
|
+
);
|
|
685
698
|
},
|
|
686
699
|
structure: 1,
|
|
687
700
|
title: "Comptes rendus des séances publiques de la XVIème législature",
|
|
@@ -716,57 +729,57 @@ const S = {
|
|
|
716
729
|
1,
|
|
717
730
|
"I"
|
|
718
731
|
];
|
|
719
|
-
function ne(
|
|
720
|
-
if (
|
|
732
|
+
function ne(t) {
|
|
733
|
+
if (t < 0)
|
|
721
734
|
return;
|
|
722
|
-
if (
|
|
735
|
+
if (t === 0)
|
|
723
736
|
return "0I";
|
|
724
|
-
let
|
|
737
|
+
let s = "";
|
|
725
738
|
for (let e = 0; e < W.length; e += 2)
|
|
726
|
-
for (;
|
|
727
|
-
|
|
728
|
-
return
|
|
739
|
+
for (; t >= W[e]; )
|
|
740
|
+
s += W[e + 1], t -= W[e];
|
|
741
|
+
return s;
|
|
729
742
|
}
|
|
730
|
-
function*
|
|
743
|
+
function* z(t, s, e, a, l, d = "json", { enriched: _ = !1, log: j = !1, noValidation: h = !1 } = {}) {
|
|
731
744
|
const F = /* @__PURE__ */ new Set();
|
|
732
745
|
for (const v of e) {
|
|
733
|
-
if (v.ignoreForWeb || !ie(
|
|
746
|
+
if (v.ignoreForWeb || !ie(s, v))
|
|
734
747
|
continue;
|
|
735
|
-
const b = new RegExp(`\\.${d}$`),
|
|
736
|
-
|
|
748
|
+
const b = new RegExp(`\\.${d}$`), x = n.join(
|
|
749
|
+
t,
|
|
737
750
|
v.filename.replace(
|
|
738
751
|
b,
|
|
739
752
|
_ ? "_enrichi" : "_nettoye"
|
|
740
753
|
)
|
|
741
754
|
);
|
|
742
|
-
for (const D of
|
|
755
|
+
for (const D of P(x, l)) {
|
|
743
756
|
if (!D[D.length - 1].endsWith(".json"))
|
|
744
757
|
continue;
|
|
745
|
-
const X = n.join(
|
|
758
|
+
const X = n.join(x, ...D);
|
|
746
759
|
j && console.log(`Loading file: ${X}…`);
|
|
747
760
|
let V = i.readFileSync(X, { encoding: "utf8" });
|
|
748
|
-
const
|
|
749
|
-
F.has(
|
|
761
|
+
const $ = h ? JSON.parse(V) : a(V);
|
|
762
|
+
F.has($.uid) || (F.add($.uid), yield {
|
|
750
763
|
datasetLegislature: v.legislature,
|
|
751
764
|
filePath: X,
|
|
752
|
-
item:
|
|
765
|
+
item: $
|
|
753
766
|
}, V = null);
|
|
754
767
|
}
|
|
755
768
|
}
|
|
756
769
|
F.clear();
|
|
757
770
|
}
|
|
758
|
-
function ie(
|
|
759
|
-
const e = Array.isArray(
|
|
760
|
-
return
|
|
771
|
+
function ie(t, s) {
|
|
772
|
+
const e = Array.isArray(t) ? t : t !== void 0 ? [t] : [];
|
|
773
|
+
return t === void 0 || e.includes(0) || s.legislature === r.All ? !0 : e.includes(s.legislature);
|
|
761
774
|
}
|
|
762
|
-
function* de(
|
|
775
|
+
function* de(t, s, e = {}) {
|
|
763
776
|
for (const {
|
|
764
777
|
datasetLegislature: a,
|
|
765
778
|
item: l,
|
|
766
779
|
filePath: d
|
|
767
|
-
} of
|
|
768
|
-
s,
|
|
780
|
+
} of z(
|
|
769
781
|
t,
|
|
782
|
+
s,
|
|
770
783
|
S.acteursEtOrganes,
|
|
771
784
|
R.toActeur,
|
|
772
785
|
["acteurs"],
|
|
@@ -775,14 +788,14 @@ function* de(s, t, e = {}) {
|
|
|
775
788
|
))
|
|
776
789
|
yield { acteur: l, datasetLegislature: a, filePath: d };
|
|
777
790
|
}
|
|
778
|
-
function* pe(
|
|
791
|
+
function* pe(t, s, e = {}) {
|
|
779
792
|
for (const {
|
|
780
793
|
item: a,
|
|
781
794
|
datasetLegislature: l,
|
|
782
795
|
filePath: d
|
|
783
|
-
} of
|
|
784
|
-
s,
|
|
796
|
+
} of z(
|
|
785
797
|
t,
|
|
798
|
+
s,
|
|
786
799
|
S.acteursEtOrganes,
|
|
787
800
|
R.toOrgane,
|
|
788
801
|
["organes"],
|
|
@@ -791,14 +804,14 @@ function* pe(s, t, e = {}) {
|
|
|
791
804
|
))
|
|
792
805
|
yield { organe: a, datasetLegislature: l, filePath: d };
|
|
793
806
|
}
|
|
794
|
-
function* ge(
|
|
807
|
+
function* ge(t, s, e = {}) {
|
|
795
808
|
for (const {
|
|
796
809
|
datasetLegislature: a,
|
|
797
810
|
item: l,
|
|
798
811
|
filePath: d
|
|
799
|
-
} of
|
|
800
|
-
s,
|
|
812
|
+
} of z(
|
|
801
813
|
t,
|
|
814
|
+
s,
|
|
802
815
|
S.amendements,
|
|
803
816
|
w.toAmendement,
|
|
804
817
|
[],
|
|
@@ -807,14 +820,14 @@ function* ge(s, t, e = {}) {
|
|
|
807
820
|
))
|
|
808
821
|
yield { amendement: l, datasetLegislature: a, filePath: d };
|
|
809
822
|
}
|
|
810
|
-
function* _e(
|
|
823
|
+
function* _e(t, s, e = {}) {
|
|
811
824
|
for (const {
|
|
812
825
|
item: a,
|
|
813
826
|
datasetLegislature: l,
|
|
814
827
|
filePath: d
|
|
815
|
-
} of
|
|
816
|
-
s,
|
|
828
|
+
} of z(
|
|
817
829
|
t,
|
|
830
|
+
s,
|
|
818
831
|
S.dossiersLegislatifs,
|
|
819
832
|
q.toDocument,
|
|
820
833
|
["documents"],
|
|
@@ -823,14 +836,14 @@ function* _e(s, t, e = {}) {
|
|
|
823
836
|
))
|
|
824
837
|
yield { document: a, datasetLegislature: l, filePath: d };
|
|
825
838
|
}
|
|
826
|
-
function* je(
|
|
839
|
+
function* je(t, s, e = {}) {
|
|
827
840
|
for (const {
|
|
828
841
|
item: a,
|
|
829
842
|
datasetLegislature: l,
|
|
830
843
|
filePath: d
|
|
831
|
-
} of
|
|
832
|
-
s,
|
|
844
|
+
} of z(
|
|
833
845
|
t,
|
|
846
|
+
s,
|
|
834
847
|
S.dossiersLegislatifs,
|
|
835
848
|
q.toDossierParlementaire,
|
|
836
849
|
["dossiers"],
|
|
@@ -839,14 +852,14 @@ function* je(s, t, e = {}) {
|
|
|
839
852
|
))
|
|
840
853
|
yield { dossierParlementaire: a, datasetLegislature: l, filePath: d };
|
|
841
854
|
}
|
|
842
|
-
function* ye(
|
|
855
|
+
function* ye(t, s, e = {}) {
|
|
843
856
|
for (const {
|
|
844
857
|
item: a,
|
|
845
858
|
datasetLegislature: l,
|
|
846
859
|
filePath: d
|
|
847
|
-
} of
|
|
848
|
-
s,
|
|
860
|
+
} of z(
|
|
849
861
|
t,
|
|
862
|
+
s,
|
|
850
863
|
S.agendas,
|
|
851
864
|
Z.toReunion,
|
|
852
865
|
[],
|
|
@@ -855,14 +868,14 @@ function* ye(s, t, e = {}) {
|
|
|
855
868
|
))
|
|
856
869
|
yield { reunion: a, datasetLegislature: l, filePath: d };
|
|
857
870
|
}
|
|
858
|
-
function* he(
|
|
871
|
+
function* he(t, s, e = {}) {
|
|
859
872
|
for (const {
|
|
860
873
|
item: a,
|
|
861
874
|
datasetLegislature: l,
|
|
862
875
|
filePath: d
|
|
863
|
-
} of
|
|
864
|
-
s,
|
|
876
|
+
} of z(
|
|
865
877
|
t,
|
|
878
|
+
s,
|
|
866
879
|
S.scrutins,
|
|
867
880
|
B.toScrutin,
|
|
868
881
|
[],
|
|
@@ -871,14 +884,14 @@ function* he(s, t, e = {}) {
|
|
|
871
884
|
))
|
|
872
885
|
yield { scrutin: a, datasetLegislature: l, filePath: d };
|
|
873
886
|
}
|
|
874
|
-
function* Se(
|
|
887
|
+
function* Se(t, s, e = {}) {
|
|
875
888
|
for (const {
|
|
876
889
|
item: a,
|
|
877
890
|
datasetLegislature: l,
|
|
878
891
|
filePath: d
|
|
879
|
-
} of
|
|
880
|
-
s,
|
|
892
|
+
} of z(
|
|
881
893
|
t,
|
|
894
|
+
s,
|
|
882
895
|
S.questions,
|
|
883
896
|
J.toQuestion,
|
|
884
897
|
[],
|
|
@@ -887,14 +900,14 @@ function* Se(s, t, e = {}) {
|
|
|
887
900
|
))
|
|
888
901
|
yield { question: a, datasetLegislature: l, filePath: d };
|
|
889
902
|
}
|
|
890
|
-
function* Ae(
|
|
903
|
+
function* Ae(t, s, e = {}) {
|
|
891
904
|
for (const {
|
|
892
905
|
item: a,
|
|
893
906
|
datasetLegislature: l,
|
|
894
907
|
filePath: d
|
|
895
|
-
} of
|
|
896
|
-
s,
|
|
908
|
+
} of z(
|
|
897
909
|
t,
|
|
910
|
+
s,
|
|
898
911
|
S.comptesRendusSeances,
|
|
899
912
|
N.toCompteRendu,
|
|
900
913
|
[],
|
|
@@ -903,39 +916,39 @@ function* Ae(s, t, e = {}) {
|
|
|
903
916
|
))
|
|
904
917
|
yield { compteRendu: a, datasetLegislature: l, filePath: d };
|
|
905
918
|
}
|
|
906
|
-
function* Fe(
|
|
907
|
-
const a = `Comptes_Rendus_Commissions_${ne(
|
|
919
|
+
function* Fe(t, s, { enriched: e = !1 } = {}) {
|
|
920
|
+
const a = `Comptes_Rendus_Commissions_${ne(s)}${e ? "_enrichi" : "_nettoye"}`, l = n.join(t, a);
|
|
908
921
|
if (i.existsSync(l))
|
|
909
922
|
for (const d of T(l))
|
|
910
923
|
try {
|
|
911
924
|
const _ = i.readFileSync(d, "utf-8");
|
|
912
925
|
yield {
|
|
913
926
|
compteRendu: JSON.parse(_),
|
|
914
|
-
datasetLegislature:
|
|
927
|
+
datasetLegislature: s,
|
|
915
928
|
filePath: d
|
|
916
929
|
};
|
|
917
930
|
} catch (_) {
|
|
918
931
|
console.warn(`Erreur lors de la lecture du fichier ${d} :`, _);
|
|
919
932
|
}
|
|
920
933
|
}
|
|
921
|
-
function* T(
|
|
922
|
-
if (i.existsSync(
|
|
923
|
-
for (const
|
|
924
|
-
const e = n.join(
|
|
925
|
-
|
|
934
|
+
function* T(t) {
|
|
935
|
+
if (i.existsSync(t))
|
|
936
|
+
for (const s of i.readdirSync(t, { withFileTypes: !0 })) {
|
|
937
|
+
const e = n.join(t, s.name);
|
|
938
|
+
s.isDirectory() ? yield* T(e) : s.isFile() && e.endsWith(".json") && (yield e);
|
|
926
939
|
}
|
|
927
940
|
}
|
|
928
|
-
function ve(
|
|
941
|
+
function ve(t, s, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
929
942
|
const d = {}, _ = {};
|
|
930
|
-
if (
|
|
943
|
+
if (s & I.ActeursEtOrganes)
|
|
931
944
|
for (const o of S.acteursEtOrganes) {
|
|
932
945
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
933
946
|
continue;
|
|
934
947
|
const m = n.join(
|
|
935
|
-
|
|
948
|
+
t,
|
|
936
949
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
937
950
|
);
|
|
938
|
-
for (const u of
|
|
951
|
+
for (const u of P(m, ["acteurs"])) {
|
|
939
952
|
if (!u[u.length - 1].endsWith(".json"))
|
|
940
953
|
continue;
|
|
941
954
|
const g = n.join(m, ...u);
|
|
@@ -945,7 +958,7 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
945
958
|
}), f = R.toActeur(A);
|
|
946
959
|
d[f.uid] === void 0 && (d[f.uid] = f);
|
|
947
960
|
}
|
|
948
|
-
for (const u of
|
|
961
|
+
for (const u of P(m, ["organes"])) {
|
|
949
962
|
if (!u[u.length - 1].endsWith(".json"))
|
|
950
963
|
continue;
|
|
951
964
|
const g = n.join(m, ...u);
|
|
@@ -957,15 +970,15 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
957
970
|
}
|
|
958
971
|
}
|
|
959
972
|
const j = {}, h = {}, F = {};
|
|
960
|
-
if (
|
|
973
|
+
if (s & I.Agendas)
|
|
961
974
|
for (const o of S.agendas) {
|
|
962
975
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
963
976
|
continue;
|
|
964
977
|
const m = n.join(
|
|
965
|
-
|
|
978
|
+
t,
|
|
966
979
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
967
980
|
);
|
|
968
|
-
for (const u of
|
|
981
|
+
for (const u of P(m)) {
|
|
969
982
|
if (!u[u.length - 1].endsWith(".json"))
|
|
970
983
|
continue;
|
|
971
984
|
const g = n.join(m, ...u);
|
|
@@ -974,9 +987,9 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
974
987
|
encoding: "utf8"
|
|
975
988
|
}), f = Z.toReunion(A);
|
|
976
989
|
j[f.uid] === void 0 && (j[f.uid] = f);
|
|
977
|
-
const
|
|
978
|
-
let U = h[
|
|
979
|
-
U === void 0 && (U = h[
|
|
990
|
+
const L = f.timestampDebut.toISOString().split("T")[0];
|
|
991
|
+
let U = h[L];
|
|
992
|
+
U === void 0 && (U = h[L] = []), U.push(f);
|
|
980
993
|
const C = f.odj;
|
|
981
994
|
if (C !== void 0)
|
|
982
995
|
for (const H of C.pointsOdj || [])
|
|
@@ -987,15 +1000,15 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
987
1000
|
}
|
|
988
1001
|
}
|
|
989
1002
|
const v = {};
|
|
990
|
-
if (
|
|
1003
|
+
if (s & I.Amendements)
|
|
991
1004
|
for (const o of S.amendements) {
|
|
992
1005
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
993
1006
|
continue;
|
|
994
1007
|
const m = n.join(
|
|
995
|
-
|
|
1008
|
+
t,
|
|
996
1009
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
997
1010
|
);
|
|
998
|
-
for (const u of
|
|
1011
|
+
for (const u of P(m)) {
|
|
999
1012
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1000
1013
|
continue;
|
|
1001
1014
|
const g = n.join(m, ...u);
|
|
@@ -1006,16 +1019,16 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1006
1019
|
v[f.uid] === void 0 && (v[f.uid] = f);
|
|
1007
1020
|
}
|
|
1008
1021
|
}
|
|
1009
|
-
const b = {},
|
|
1010
|
-
if (
|
|
1022
|
+
const b = {}, x = {}, D = {}, O = {};
|
|
1023
|
+
if (s & I.DossiersLegislatifs)
|
|
1011
1024
|
for (const o of S.dossiersLegislatifs) {
|
|
1012
1025
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
1013
1026
|
continue;
|
|
1014
1027
|
const m = n.join(
|
|
1015
|
-
|
|
1028
|
+
t,
|
|
1016
1029
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
1017
1030
|
);
|
|
1018
|
-
for (const u of
|
|
1031
|
+
for (const u of P(m, ["documents"])) {
|
|
1019
1032
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1020
1033
|
continue;
|
|
1021
1034
|
const g = n.join(m, ...u);
|
|
@@ -1025,22 +1038,22 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1025
1038
|
}), f = q.toDocument(A);
|
|
1026
1039
|
b[f.uid] === void 0 && (b[f.uid] = f);
|
|
1027
1040
|
}
|
|
1028
|
-
for (const u of
|
|
1041
|
+
for (const u of P(m, ["dossiers"])) {
|
|
1029
1042
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1030
1043
|
continue;
|
|
1031
1044
|
const g = n.join(m, ...u);
|
|
1032
1045
|
l && console.log(`Loading file: ${g}…`);
|
|
1033
1046
|
const A = i.readFileSync(g, {
|
|
1034
1047
|
encoding: "utf8"
|
|
1035
|
-
}), f = q.toDossierParlementaire(A),
|
|
1036
|
-
|
|
1048
|
+
}), f = q.toDossierParlementaire(A), L = f.titreDossier;
|
|
1049
|
+
L.senatChemin && x[L.senatChemin] === void 0 && (x[L.senatChemin] = f), L.titreChemin && D[L.titreChemin] === void 0 && (D[L.titreChemin] = f), O[f.uid] === void 0 && (O[f.uid] = f);
|
|
1037
1050
|
}
|
|
1038
1051
|
}
|
|
1039
1052
|
let X = {};
|
|
1040
|
-
if (
|
|
1053
|
+
if (s & I.Photos) {
|
|
1041
1054
|
{
|
|
1042
1055
|
const o = n.join(
|
|
1043
|
-
|
|
1056
|
+
t,
|
|
1044
1057
|
`photos_deputes_${// TODO: Handle Legislature.All.
|
|
1045
1058
|
e === r.All ? r.DixSept : e}`,
|
|
1046
1059
|
"deputes.json"
|
|
@@ -1053,7 +1066,7 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1053
1066
|
}
|
|
1054
1067
|
{
|
|
1055
1068
|
const o = n.join(
|
|
1056
|
-
|
|
1069
|
+
t,
|
|
1057
1070
|
"photos_senateurs",
|
|
1058
1071
|
"senateurs.json"
|
|
1059
1072
|
);
|
|
@@ -1065,15 +1078,15 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1065
1078
|
}
|
|
1066
1079
|
}
|
|
1067
1080
|
const V = {};
|
|
1068
|
-
if (
|
|
1081
|
+
if (s & I.Scrutins)
|
|
1069
1082
|
for (const o of S.scrutins) {
|
|
1070
1083
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
1071
1084
|
continue;
|
|
1072
1085
|
const m = n.join(
|
|
1073
|
-
|
|
1086
|
+
t,
|
|
1074
1087
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
1075
1088
|
);
|
|
1076
|
-
for (const u of
|
|
1089
|
+
for (const u of P(m)) {
|
|
1077
1090
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1078
1091
|
continue;
|
|
1079
1092
|
const g = n.join(m, ...u);
|
|
@@ -1084,16 +1097,16 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1084
1097
|
V[f.uid] === void 0 && (V[f.uid] = f);
|
|
1085
1098
|
}
|
|
1086
1099
|
}
|
|
1087
|
-
const
|
|
1088
|
-
if (
|
|
1100
|
+
const $ = {};
|
|
1101
|
+
if (s & I.Questions)
|
|
1089
1102
|
for (const o of S.questions) {
|
|
1090
1103
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
1091
1104
|
continue;
|
|
1092
1105
|
const m = n.join(
|
|
1093
|
-
|
|
1106
|
+
t,
|
|
1094
1107
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
1095
1108
|
);
|
|
1096
|
-
for (const u of
|
|
1109
|
+
for (const u of P(m)) {
|
|
1097
1110
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1098
1111
|
continue;
|
|
1099
1112
|
const g = n.join(m, ...u);
|
|
@@ -1101,19 +1114,19 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1101
1114
|
const A = i.readFileSync(g, {
|
|
1102
1115
|
encoding: "utf8"
|
|
1103
1116
|
}), f = J.toQuestion(A);
|
|
1104
|
-
|
|
1117
|
+
$[f.uid] === void 0 && ($[f.uid] = f);
|
|
1105
1118
|
}
|
|
1106
1119
|
}
|
|
1107
1120
|
const p = {};
|
|
1108
|
-
if (
|
|
1121
|
+
if (s & I.ComptesRendusSeances)
|
|
1109
1122
|
for (const o of S.comptesRendusSeances) {
|
|
1110
1123
|
if (o.ignoreForWeb || e !== r.All && o.legislature !== r.All && e !== o.legislature)
|
|
1111
1124
|
continue;
|
|
1112
1125
|
const m = n.join(
|
|
1113
|
-
|
|
1126
|
+
t,
|
|
1114
1127
|
o.filename.replace(/\.json$/, a ? "_enrichi" : "_nettoye")
|
|
1115
1128
|
);
|
|
1116
|
-
for (const u of
|
|
1129
|
+
for (const u of P(m)) {
|
|
1117
1130
|
if (!u[u.length - 1].endsWith(".json"))
|
|
1118
1131
|
continue;
|
|
1119
1132
|
const g = n.join(m, ...u);
|
|
@@ -1128,7 +1141,7 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1128
1141
|
acteurByUid: d,
|
|
1129
1142
|
amendementByUid: v,
|
|
1130
1143
|
documentByUid: b,
|
|
1131
|
-
dossierParlementaireBySenatChemin:
|
|
1144
|
+
dossierParlementaireBySenatChemin: x,
|
|
1132
1145
|
dossierParlementaireByTitreChemin: D,
|
|
1133
1146
|
dossierParlementaireByUid: O,
|
|
1134
1147
|
organeByUid: _,
|
|
@@ -1137,18 +1150,18 @@ function ve(s, t, e, { enriched: a = !1, log: l = !1 } = {}) {
|
|
|
1137
1150
|
reunionsByDay: h,
|
|
1138
1151
|
reunionsByDossierUid: F,
|
|
1139
1152
|
scrutinByUid: V,
|
|
1140
|
-
questionByUid:
|
|
1153
|
+
questionByUid: $,
|
|
1141
1154
|
compteRenduByUid: p
|
|
1142
1155
|
};
|
|
1143
1156
|
}
|
|
1144
|
-
function Ie(
|
|
1157
|
+
function Ie(t, s, e, { log: a = !1 } = {}) {
|
|
1145
1158
|
const l = {}, d = {};
|
|
1146
|
-
if (
|
|
1159
|
+
if (s & I.ActeursEtOrganes)
|
|
1147
1160
|
for (const p of S.acteursEtOrganes) {
|
|
1148
1161
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1149
1162
|
continue;
|
|
1150
1163
|
const o = n.join(
|
|
1151
|
-
|
|
1164
|
+
t,
|
|
1152
1165
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1153
1166
|
);
|
|
1154
1167
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1159,12 +1172,12 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1159
1172
|
d[c.uid] === void 0 && (d[c.uid] = c);
|
|
1160
1173
|
}
|
|
1161
1174
|
const _ = {}, j = {}, h = {};
|
|
1162
|
-
if (
|
|
1175
|
+
if (s & I.Agendas)
|
|
1163
1176
|
for (const p of S.agendas) {
|
|
1164
1177
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1165
1178
|
continue;
|
|
1166
1179
|
const o = n.join(
|
|
1167
|
-
|
|
1180
|
+
t,
|
|
1168
1181
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1169
1182
|
);
|
|
1170
1183
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1176,20 +1189,20 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1176
1189
|
A === void 0 && (A = j[g] = []), A.push(c);
|
|
1177
1190
|
const f = c.odj;
|
|
1178
1191
|
if (f !== void 0)
|
|
1179
|
-
for (const
|
|
1180
|
-
for (const U of
|
|
1192
|
+
for (const L of f.pointsOdj || [])
|
|
1193
|
+
for (const U of L.dossiersLegislatifsRefs || []) {
|
|
1181
1194
|
let C = h[U];
|
|
1182
1195
|
C === void 0 && (C = h[U] = []), C.push(c);
|
|
1183
1196
|
}
|
|
1184
1197
|
}
|
|
1185
1198
|
}
|
|
1186
1199
|
const F = {};
|
|
1187
|
-
if (
|
|
1200
|
+
if (s & I.Amendements)
|
|
1188
1201
|
for (const p of S.amendements) {
|
|
1189
1202
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1190
1203
|
continue;
|
|
1191
1204
|
const o = n.join(
|
|
1192
|
-
|
|
1205
|
+
t,
|
|
1193
1206
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1194
1207
|
);
|
|
1195
1208
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1198,13 +1211,13 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1198
1211
|
for (const g of c.amendements)
|
|
1199
1212
|
F[g.uid] === void 0 && (F[g.uid] = g);
|
|
1200
1213
|
}
|
|
1201
|
-
const v = {}, b = {},
|
|
1202
|
-
if (
|
|
1214
|
+
const v = {}, b = {}, x = {}, D = {};
|
|
1215
|
+
if (s & I.DossiersLegislatifs)
|
|
1203
1216
|
for (const p of S.dossiersLegislatifs) {
|
|
1204
1217
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1205
1218
|
continue;
|
|
1206
1219
|
const o = n.join(
|
|
1207
|
-
|
|
1220
|
+
t,
|
|
1208
1221
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1209
1222
|
);
|
|
1210
1223
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1213,15 +1226,15 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1213
1226
|
v[c.uid] === void 0 && (v[c.uid] = c);
|
|
1214
1227
|
for (const c of u.dossiersParlementaires) {
|
|
1215
1228
|
const g = c.titreDossier;
|
|
1216
|
-
g.senatChemin && b[g.senatChemin] === void 0 && (b[g.senatChemin] = c), g.titreChemin &&
|
|
1229
|
+
g.senatChemin && b[g.senatChemin] === void 0 && (b[g.senatChemin] = c), g.titreChemin && x[g.titreChemin] === void 0 && (x[g.titreChemin] = c), D[c.uid] === void 0 && (D[c.uid] = c);
|
|
1217
1230
|
}
|
|
1218
1231
|
}
|
|
1219
1232
|
const O = {};
|
|
1220
|
-
if (
|
|
1233
|
+
if (s & I.Photos) {
|
|
1221
1234
|
const p = {};
|
|
1222
1235
|
{
|
|
1223
1236
|
const o = n.join(
|
|
1224
|
-
|
|
1237
|
+
t,
|
|
1225
1238
|
`photos_deputes_${// TODO: Handle Legislature.All.
|
|
1226
1239
|
e === r.All ? r.DixSept : e}`,
|
|
1227
1240
|
"deputes.json"
|
|
@@ -1234,7 +1247,7 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1234
1247
|
}
|
|
1235
1248
|
{
|
|
1236
1249
|
const o = n.join(
|
|
1237
|
-
|
|
1250
|
+
t,
|
|
1238
1251
|
"photos_senateurs",
|
|
1239
1252
|
"senateurs.json"
|
|
1240
1253
|
);
|
|
@@ -1246,12 +1259,12 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1246
1259
|
}
|
|
1247
1260
|
}
|
|
1248
1261
|
const X = {};
|
|
1249
|
-
if (
|
|
1262
|
+
if (s & I.Scrutins)
|
|
1250
1263
|
for (const p of S.scrutins) {
|
|
1251
1264
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1252
1265
|
continue;
|
|
1253
1266
|
const o = n.join(
|
|
1254
|
-
|
|
1267
|
+
t,
|
|
1255
1268
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1256
1269
|
);
|
|
1257
1270
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1260,12 +1273,12 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1260
1273
|
X[c.uid] === void 0 && (X[c.uid] = c);
|
|
1261
1274
|
}
|
|
1262
1275
|
const V = {};
|
|
1263
|
-
if (
|
|
1276
|
+
if (s & I.Questions)
|
|
1264
1277
|
for (const p of S.questions) {
|
|
1265
1278
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1266
1279
|
continue;
|
|
1267
1280
|
const o = n.join(
|
|
1268
|
-
|
|
1281
|
+
t,
|
|
1269
1282
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1270
1283
|
);
|
|
1271
1284
|
a && console.log(`Loading file: ${o}`);
|
|
@@ -1273,26 +1286,26 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1273
1286
|
for (const c of u.questions)
|
|
1274
1287
|
V[c.uid] === void 0 && (V[c.uid] = c);
|
|
1275
1288
|
}
|
|
1276
|
-
const
|
|
1277
|
-
if (
|
|
1289
|
+
const $ = {};
|
|
1290
|
+
if (s & I.ComptesRendusSeances)
|
|
1278
1291
|
for (const p of S.comptesRendusSeances) {
|
|
1279
1292
|
if (p.ignoreForWeb || e !== r.All && p.legislature !== r.All && e !== p.legislature)
|
|
1280
1293
|
continue;
|
|
1281
1294
|
const o = n.join(
|
|
1282
|
-
|
|
1295
|
+
t,
|
|
1283
1296
|
p.filename.replace(/\.json$/, "_nettoye.json")
|
|
1284
1297
|
);
|
|
1285
1298
|
a && console.log(`Loading file: ${o}`);
|
|
1286
1299
|
const m = i.readFileSync(o, { encoding: "utf8" }), u = N.toComptesRendus(m);
|
|
1287
1300
|
for (const c of u.comptesRendus)
|
|
1288
|
-
|
|
1301
|
+
$[c.uid] === void 0 && ($[c.uid] = c);
|
|
1289
1302
|
}
|
|
1290
1303
|
return {
|
|
1291
1304
|
acteurByUid: l,
|
|
1292
1305
|
amendementByUid: F,
|
|
1293
1306
|
documentByUid: v,
|
|
1294
1307
|
dossierParlementaireBySenatChemin: b,
|
|
1295
|
-
dossierParlementaireByTitreChemin:
|
|
1308
|
+
dossierParlementaireByTitreChemin: x,
|
|
1296
1309
|
dossierParlementaireByUid: D,
|
|
1297
1310
|
organeByUid: d,
|
|
1298
1311
|
photoByUid: O,
|
|
@@ -1301,11 +1314,11 @@ function Ie(s, t, e, { log: a = !1 } = {}) {
|
|
|
1301
1314
|
reunionsByDossierUid: h,
|
|
1302
1315
|
scrutinByUid: X,
|
|
1303
1316
|
questionByUid: V,
|
|
1304
|
-
compteRenduByUid:
|
|
1317
|
+
compteRenduByUid: $
|
|
1305
1318
|
};
|
|
1306
1319
|
}
|
|
1307
|
-
function be(
|
|
1308
|
-
const a = n.join(
|
|
1320
|
+
function be(t, s, e) {
|
|
1321
|
+
const a = n.join(t, "Documents"), l = oe(a, s), d = n.join(l, "index.json");
|
|
1309
1322
|
if (!i.pathExistsSync(d))
|
|
1310
1323
|
return;
|
|
1311
1324
|
const _ = i.readJsonSync(d);
|
|
@@ -1314,36 +1327,36 @@ function be(s, t, e) {
|
|
|
1314
1327
|
if (h !== void 0)
|
|
1315
1328
|
return { format: j, path: n.join(l, h), url: F };
|
|
1316
1329
|
}
|
|
1317
|
-
function De(
|
|
1330
|
+
function De(t, s, { log: e = !1 } = {}) {
|
|
1318
1331
|
const a = n.join(
|
|
1319
|
-
|
|
1332
|
+
t,
|
|
1320
1333
|
`photos_deputes_${// TODO: Handle Legislature.All.
|
|
1321
|
-
|
|
1334
|
+
s === r.All ? r.DixSept : s}`,
|
|
1322
1335
|
"deputes.json"
|
|
1323
1336
|
);
|
|
1324
1337
|
e && console.log(`Loading file: ${a}`);
|
|
1325
1338
|
const l = i.readFileSync(a, { encoding: "utf8" });
|
|
1326
1339
|
return JSON.parse(l);
|
|
1327
1340
|
}
|
|
1328
|
-
function Xe(
|
|
1341
|
+
function Xe(t, { log: s = !1 } = {}) {
|
|
1329
1342
|
const e = n.join(
|
|
1330
|
-
|
|
1343
|
+
t,
|
|
1331
1344
|
"photos_senateurs",
|
|
1332
1345
|
"senateurs.json"
|
|
1333
1346
|
);
|
|
1334
|
-
|
|
1347
|
+
s && console.log(`Loading file: ${e}`);
|
|
1335
1348
|
const a = i.readFileSync(e, { encoding: "utf8" });
|
|
1336
1349
|
return JSON.parse(a);
|
|
1337
1350
|
}
|
|
1338
|
-
function oe(
|
|
1339
|
-
const e =
|
|
1351
|
+
function oe(t, s) {
|
|
1352
|
+
const e = s.match(Y);
|
|
1340
1353
|
Q.notStrictEqual(
|
|
1341
1354
|
e,
|
|
1342
1355
|
null,
|
|
1343
|
-
`Unexpected structure for document UID: ${
|
|
1356
|
+
`Unexpected structure for document UID: ${s}`
|
|
1344
1357
|
);
|
|
1345
1358
|
const a = e.groups, l = n.join(
|
|
1346
|
-
|
|
1359
|
+
t,
|
|
1347
1360
|
a.documentType ?? a.documentType2
|
|
1348
1361
|
), d = n.join(l, a.chambre ?? a.chambre2), _ = n.join(
|
|
1349
1362
|
d,
|
|
@@ -1353,70 +1366,70 @@ function oe(s, t) {
|
|
|
1353
1366
|
a.legislature ?? a.legislature2
|
|
1354
1367
|
), h = a.etat;
|
|
1355
1368
|
if (h === void 0)
|
|
1356
|
-
return i.ensureDirSync(j), n.join(j,
|
|
1369
|
+
return i.ensureDirSync(j), n.join(j, s);
|
|
1357
1370
|
const F = n.join(j, h);
|
|
1358
1371
|
let v = "000000" + (a.numero ?? a.numero2);
|
|
1359
1372
|
v = v.substring(v.length - 6);
|
|
1360
1373
|
const b = n.join(F, v.substring(0, 3));
|
|
1361
|
-
return i.ensureDirSync(b), n.join(b,
|
|
1374
|
+
return i.ensureDirSync(b), n.join(b, s);
|
|
1362
1375
|
}
|
|
1363
|
-
function Ve(
|
|
1364
|
-
return E(
|
|
1376
|
+
function Ve(t, s) {
|
|
1377
|
+
return E(t, s, te);
|
|
1365
1378
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const e = G.exec(
|
|
1379
|
+
function $e(t, s) {
|
|
1380
|
+
const e = G.exec(s);
|
|
1368
1381
|
Q.notStrictEqual(
|
|
1369
1382
|
e,
|
|
1370
1383
|
null,
|
|
1371
|
-
`Unexpected structure for reunion UID: ${
|
|
1384
|
+
`Unexpected structure for reunion UID: ${s}`
|
|
1372
1385
|
);
|
|
1373
|
-
const a = n.join(
|
|
1386
|
+
const a = n.join(t, e[1]), l = n.join(a, e[2]), d = n.join(l, e[3]), _ = n.join(d, e[4]), j = n.join(_, e[5]);
|
|
1374
1387
|
let h = "000000000" + e[6];
|
|
1375
1388
|
h = h.substring(h.length - 9);
|
|
1376
1389
|
const F = n.join(j, h.substring(0, 3)), v = n.join(F, h.substring(3, 3));
|
|
1377
|
-
return i.ensureDirSync(v), n.join(v,
|
|
1390
|
+
return i.ensureDirSync(v), n.join(v, s);
|
|
1378
1391
|
}
|
|
1379
|
-
function
|
|
1380
|
-
const e = K.exec(
|
|
1392
|
+
function Le(t, s) {
|
|
1393
|
+
const e = K.exec(s);
|
|
1381
1394
|
Q.notStrictEqual(
|
|
1382
1395
|
e,
|
|
1383
1396
|
null,
|
|
1384
|
-
`Unexpected structure for scrutin UID: ${
|
|
1397
|
+
`Unexpected structure for scrutin UID: ${s}`
|
|
1385
1398
|
);
|
|
1386
|
-
const a = n.join(
|
|
1399
|
+
const a = n.join(t, e[1]), l = n.join(a, e[2]), d = n.join(l, e[3]);
|
|
1387
1400
|
let _ = "000000" + e[4];
|
|
1388
1401
|
_ = _.substring(_.length - 6);
|
|
1389
1402
|
const j = n.join(d, _.substring(0, 3));
|
|
1390
|
-
return i.ensureDirSync(j), n.join(j,
|
|
1403
|
+
return i.ensureDirSync(j), n.join(j, s);
|
|
1391
1404
|
}
|
|
1392
|
-
function
|
|
1393
|
-
return E(
|
|
1405
|
+
function xe(t, s) {
|
|
1406
|
+
return E(t, s, se);
|
|
1394
1407
|
}
|
|
1395
|
-
function
|
|
1396
|
-
const e = ee.exec(
|
|
1408
|
+
function Pe(t, s) {
|
|
1409
|
+
const e = ee.exec(s);
|
|
1397
1410
|
Q.notStrictEqual(
|
|
1398
1411
|
e,
|
|
1399
1412
|
null,
|
|
1400
|
-
`Unexpected structure for object with UID: ${
|
|
1413
|
+
`Unexpected structure for object with UID: ${s}`
|
|
1401
1414
|
);
|
|
1402
|
-
const a = n.join(
|
|
1415
|
+
const a = n.join(t, e[2]), l = n.join(a, e[3]), d = n.join(l, e[4]), _ = n.join(d, e[5]);
|
|
1403
1416
|
let j = "000000000" + e[7];
|
|
1404
1417
|
j = j.substring(j.length - 9);
|
|
1405
1418
|
const h = n.join(_, j.substring(0, 3)), F = n.join(h, j.substring(3, 3));
|
|
1406
|
-
return i.ensureDirSync(F), n.join(F,
|
|
1419
|
+
return i.ensureDirSync(F), n.join(F, s);
|
|
1407
1420
|
}
|
|
1408
|
-
function E(
|
|
1409
|
-
const a = e.exec(
|
|
1421
|
+
function E(t, s, e) {
|
|
1422
|
+
const a = e.exec(s);
|
|
1410
1423
|
Q.notStrictEqual(
|
|
1411
1424
|
a,
|
|
1412
1425
|
null,
|
|
1413
|
-
`Unexpected structure for object with UID: ${
|
|
1426
|
+
`Unexpected structure for object with UID: ${s}`
|
|
1414
1427
|
);
|
|
1415
|
-
const l = n.join(
|
|
1428
|
+
const l = n.join(t, a[1]), d = n.join(l, a[2]);
|
|
1416
1429
|
let _ = "000000" + a[3];
|
|
1417
1430
|
_ = _.substring(_.length - 6);
|
|
1418
1431
|
const j = n.join(d, _.substring(0, 3));
|
|
1419
|
-
return i.ensureDirSync(j), n.join(j,
|
|
1432
|
+
return i.ensureDirSync(j), n.join(j, s);
|
|
1420
1433
|
}
|
|
1421
1434
|
export {
|
|
1422
1435
|
I as EnabledDatasets,
|
|
@@ -1435,11 +1448,11 @@ export {
|
|
|
1435
1448
|
be as loadAssembleeDocumentFile,
|
|
1436
1449
|
De as loadAssembleePhotosDeputes,
|
|
1437
1450
|
Xe as loadAssembleePhotosSenateurs,
|
|
1438
|
-
|
|
1451
|
+
Pe as pathFromCompteRenduUid,
|
|
1439
1452
|
oe as pathFromDocumentUid,
|
|
1440
1453
|
Ve as pathFromDossierParlementaireUid,
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1454
|
+
xe as pathFromQuestionUid,
|
|
1455
|
+
$e as pathFromReunionUid,
|
|
1456
|
+
Le as pathFromScrutinUid,
|
|
1457
|
+
P as walkDir
|
|
1445
1458
|
};
|
package/lib/parsers.js
CHANGED
|
@@ -2023,7 +2023,7 @@ function bs(e, u) {
|
|
|
2023
2023
|
var Fu;
|
|
2024
2024
|
const Ke = (
|
|
2025
2025
|
// @ts-expect-error `hasOwn` is a standard object method
|
|
2026
|
-
(Fu = Object.hasOwn) !== null && Fu !== void 0 ? Fu : (
|
|
2026
|
+
(Fu = Object.hasOwn) !== null && Fu !== void 0 ? Fu : (e, u) => Object.prototype.hasOwnProperty.call(e, u)
|
|
2027
2027
|
), je = /\s+/, Zu = "data-", gt = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, Es = /^{[^]*}$|^\[[^]*]$/;
|
|
2028
2028
|
function Tu(e, u, t) {
|
|
2029
2029
|
var a;
|
|
@@ -5,7 +5,8 @@ type CommonOptions = {
|
|
|
5
5
|
legislature: number;
|
|
6
6
|
fetchDocuments?: boolean;
|
|
7
7
|
parseDocuments?: boolean;
|
|
8
|
-
|
|
8
|
+
fetchVideos?: boolean;
|
|
9
|
+
onlyRecent?: number;
|
|
9
10
|
};
|
|
10
11
|
export declare function downloadAndParse(document: Document, datasetDir: string, options: any): Promise<void>;
|
|
11
12
|
export declare function downloadAndParseVideosAndCR(reunion: Reunion, datasetCleanDir: string, options: CommonOptions): Promise<void>;
|
|
@@ -2,9 +2,7 @@ import { Reunion } from '../types/agendas';
|
|
|
2
2
|
type CommonOptions = {
|
|
3
3
|
dataDir?: string;
|
|
4
4
|
legislature: number;
|
|
5
|
-
|
|
6
|
-
parseDocuments?: boolean;
|
|
7
|
-
fullCompteRenduCommissions?: boolean;
|
|
5
|
+
"only-recent"?: number;
|
|
8
6
|
};
|
|
9
7
|
export declare function downloadAndParseVideos(reunion: Reunion, datasetCleanDir: string, options: CommonOptions): Promise<void>;
|
|
10
8
|
/**
|
|
@@ -60,6 +60,11 @@ export declare const notFoundOption: {
|
|
|
60
60
|
name: string;
|
|
61
61
|
type: BooleanConstructor;
|
|
62
62
|
};
|
|
63
|
+
export declare const onlyRecentOption: {
|
|
64
|
+
help: string;
|
|
65
|
+
name: string;
|
|
66
|
+
type: NumberConstructor;
|
|
67
|
+
};
|
|
63
68
|
export declare const cloneOption: {
|
|
64
69
|
alias: string;
|
|
65
70
|
help: string;
|
|
@@ -85,7 +90,7 @@ export declare const pullOption: {
|
|
|
85
90
|
name: string;
|
|
86
91
|
type: BooleanConstructor;
|
|
87
92
|
};
|
|
88
|
-
export declare const
|
|
93
|
+
export declare const fetchVideosOption: {
|
|
89
94
|
help: string;
|
|
90
95
|
name: string;
|
|
91
96
|
type: BooleanConstructor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tricoteuses/assemblee",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Retrieve, clean up & handle French Assemblée nationale's open data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Assemblée nationale",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"js-yaml": "^4.0.0",
|
|
95
95
|
"node-html-parser": "^7.0.1",
|
|
96
96
|
"node-stream-zip": "^1.11.6",
|
|
97
|
+
"p-limit": "^7.2.0",
|
|
97
98
|
"sharp": "^0.34.2"
|
|
98
99
|
},
|
|
99
100
|
"devDependencies": {
|