@tricoteuses/assemblee 2.4.1 → 2.4.2
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/file_systems-CzTtoLWb.js +33 -0
- package/lib/git.js +121 -0
- package/lib/loaders.d.ts +10 -0
- package/lib/loaders.js +286 -283
- package/lib/scripts/retrieve_documents.d.ts +2 -1
- package/package.json +6 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import c from "fs-extra";
|
|
2
|
+
import { glob as f } from "glob";
|
|
3
|
+
import r from "node:path";
|
|
4
|
+
function* l(i, o = []) {
|
|
5
|
+
const t = r.join(i, ...o);
|
|
6
|
+
if (c.existsSync(t))
|
|
7
|
+
for (const s of c.readdirSync(t)) {
|
|
8
|
+
if (s[0] === ".")
|
|
9
|
+
continue;
|
|
10
|
+
const e = r.join(t, s), n = [...o, s];
|
|
11
|
+
c.statSync(e).isDirectory() ? yield* l(i, n) : yield n;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class a {
|
|
15
|
+
constructor(o) {
|
|
16
|
+
this.message = o;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function g(i) {
|
|
20
|
+
let o = [];
|
|
21
|
+
function t(s) {
|
|
22
|
+
if (f.hasMagic(s)) {
|
|
23
|
+
const e = f.globSync(s, { cwd: process.cwd() });
|
|
24
|
+
e.length > 0 && (o = o.concat(e));
|
|
25
|
+
} else if (o.push(s), !c.existsSync(s))
|
|
26
|
+
throw new a(`${s} file does not exist`);
|
|
27
|
+
}
|
|
28
|
+
return i.forEach(t), o;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
g,
|
|
32
|
+
l as w
|
|
33
|
+
};
|
package/lib/git.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import l from "fs-extra";
|
|
2
|
+
import { execSync as r } from "node:child_process";
|
|
3
|
+
import $ from "node:path";
|
|
4
|
+
import { g as p } from "./file_systems-CzTtoLWb.js";
|
|
5
|
+
const a = 50 * 1024 * 1024;
|
|
6
|
+
function v(e, c) {
|
|
7
|
+
r("git add .", {
|
|
8
|
+
cwd: e,
|
|
9
|
+
env: process.env,
|
|
10
|
+
encoding: "utf-8",
|
|
11
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
12
|
+
maxBuffer: a
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
return r(`git commit -m "${c}" --quiet`, {
|
|
16
|
+
cwd: e,
|
|
17
|
+
env: process.env,
|
|
18
|
+
encoding: "utf-8",
|
|
19
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
20
|
+
}), !0;
|
|
21
|
+
} catch (t) {
|
|
22
|
+
if (t.stdout === null || !/nothing to commit/.test(t.stdout))
|
|
23
|
+
throw console.error(t.output), t;
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function E(e, c, t) {
|
|
28
|
+
let n = 0;
|
|
29
|
+
if (v(e, c))
|
|
30
|
+
for (const s of t || [])
|
|
31
|
+
try {
|
|
32
|
+
r(`git push ${s} master`, {
|
|
33
|
+
cwd: e,
|
|
34
|
+
env: process.env,
|
|
35
|
+
encoding: "utf-8",
|
|
36
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
37
|
+
});
|
|
38
|
+
} catch (i) {
|
|
39
|
+
console.error(i.output), n = i.status;
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
n = 10;
|
|
43
|
+
return n;
|
|
44
|
+
}
|
|
45
|
+
function P(e) {
|
|
46
|
+
return r("git reset --hard origin/master", {
|
|
47
|
+
cwd: e,
|
|
48
|
+
env: process.env,
|
|
49
|
+
encoding: "utf-8",
|
|
50
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
51
|
+
}), r("git pull --rebase", {
|
|
52
|
+
cwd: e,
|
|
53
|
+
env: process.env,
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
56
|
+
}), !0;
|
|
57
|
+
}
|
|
58
|
+
function H(e, c, t) {
|
|
59
|
+
e !== void 0 && r(`git clone ${e}/${c}.git`, {
|
|
60
|
+
cwd: t,
|
|
61
|
+
env: process.env,
|
|
62
|
+
encoding: "utf-8",
|
|
63
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function o(e, c, t) {
|
|
67
|
+
try {
|
|
68
|
+
t && console.log(`git -C ${e} ${c}`);
|
|
69
|
+
const n = r(`git ${c}`, {
|
|
70
|
+
cwd: e,
|
|
71
|
+
maxBuffer: a
|
|
72
|
+
}).toString().trim();
|
|
73
|
+
return t && console.log(n), n;
|
|
74
|
+
} catch (n) {
|
|
75
|
+
for (const s of ["stdout", "stderr"])
|
|
76
|
+
console.error(`${s}: ${n[s]}`);
|
|
77
|
+
throw n;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function d(e, c, t) {
|
|
81
|
+
try {
|
|
82
|
+
t && console.log(`git -C ${e} ${c}`);
|
|
83
|
+
const n = r(`git ${c}`, {
|
|
84
|
+
cwd: e,
|
|
85
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
+
maxBuffer: a
|
|
87
|
+
}).toString().trim();
|
|
88
|
+
return t && console.log(n), !0;
|
|
89
|
+
} catch (n) {
|
|
90
|
+
if (n.status != 0) return !1;
|
|
91
|
+
throw n;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function S(e, c, t) {
|
|
95
|
+
const n = o(e, "rev-parse --abbrev-ref HEAD"), s = "uid", i = process.cwd();
|
|
96
|
+
process.chdir(e);
|
|
97
|
+
for (const f of c) {
|
|
98
|
+
const u = `${f}/uid`;
|
|
99
|
+
l.ensureDirSync(u);
|
|
100
|
+
for (const g of p([`${f}/**/*.json`])) {
|
|
101
|
+
const h = $.basename(g);
|
|
102
|
+
l.renameSync(g, `${u}/${h}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
process.chdir(i), d(e, `rev-parse remotes/origin/${s}`) ? (o(e, `branch --force ${s} origin/${s}`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : d(e, `rev-parse refs/heads/${s}`) ? (o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : (o(e, `branch --force ${s} master`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset"), o(e, "rm -r ."));
|
|
106
|
+
for (const f of c) {
|
|
107
|
+
const u = `${f}/uid`;
|
|
108
|
+
o(e, `add ${u}`);
|
|
109
|
+
}
|
|
110
|
+
let m = !1;
|
|
111
|
+
return d(e, "diff --quiet --cached") || (o(e, "commit -m 'Update'"), m = !0), o(e, `symbolic-ref HEAD refs/heads/${n}`), o(e, `reset ${t ? "" : "--hard"}`), m;
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
H as clone,
|
|
115
|
+
v as commit,
|
|
116
|
+
E as commitAndPush,
|
|
117
|
+
P as resetAndPull,
|
|
118
|
+
o as run,
|
|
119
|
+
d as test,
|
|
120
|
+
S as uidBranchUpdate
|
|
121
|
+
};
|
package/lib/loaders.d.ts
CHANGED
|
@@ -57,42 +57,52 @@ export interface Data {
|
|
|
57
57
|
export declare function iterLoadAssembleeActeurs(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
58
58
|
acteur: Acteur;
|
|
59
59
|
datasetLegislature: Legislature;
|
|
60
|
+
filePath: string;
|
|
60
61
|
}, void, unknown>;
|
|
61
62
|
export declare function iterLoadAssembleeOrganes(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
62
63
|
organe: Organe;
|
|
63
64
|
datasetLegislature: Legislature;
|
|
65
|
+
filePath: string;
|
|
64
66
|
}, void, unknown>;
|
|
65
67
|
export declare function iterLoadAssembleeAmendements(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
66
68
|
amendement: Amendement;
|
|
67
69
|
datasetLegislature: Legislature;
|
|
70
|
+
filePath: string;
|
|
68
71
|
}, void, unknown>;
|
|
69
72
|
export declare function iterLoadAssembleeDocuments(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
70
73
|
document: Document;
|
|
71
74
|
datasetLegislature: Legislature;
|
|
75
|
+
filePath: string;
|
|
72
76
|
}, void, unknown>;
|
|
73
77
|
export declare function iterLoadAssembleeDossiersParlementaires(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
74
78
|
dossierParlementaire: DossierParlementaire;
|
|
75
79
|
datasetLegislature: Legislature;
|
|
80
|
+
filePath: string;
|
|
76
81
|
}, void, unknown>;
|
|
77
82
|
export declare function iterLoadAssembleeReunions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
78
83
|
reunion: Reunion;
|
|
79
84
|
datasetLegislature: Legislature;
|
|
85
|
+
filePath: string;
|
|
80
86
|
}, void, unknown>;
|
|
81
87
|
export declare function iterLoadAssembleeScrutins(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
82
88
|
scrutin: Scrutin;
|
|
83
89
|
datasetLegislature: Legislature;
|
|
90
|
+
filePath: string;
|
|
84
91
|
}, void, unknown>;
|
|
85
92
|
export declare function iterLoadAssembleeQuestions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
86
93
|
question: Question;
|
|
87
94
|
datasetLegislature: Legislature;
|
|
95
|
+
filePath: string;
|
|
88
96
|
}, void, unknown>;
|
|
89
97
|
export declare function iterLoadAssembleeComptesRendus(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
90
98
|
compteRendu: CompteRendu;
|
|
91
99
|
datasetLegislature: Legislature;
|
|
100
|
+
filePath: string;
|
|
92
101
|
}, void, unknown>;
|
|
93
102
|
export declare function iterLoadAssembleeComptesRendusCommissions(dataDir: string, legislature: Legislature): Generator<{
|
|
94
103
|
compteRendu: CompteRendu;
|
|
95
104
|
datasetLegislature: Legislature;
|
|
105
|
+
filePath: string;
|
|
96
106
|
}, void, unknown>;
|
|
97
107
|
export declare function loadAssembleeData(dataDir: string, enabledDatasets: EnabledDatasets, legislature: Legislature, { log }?: {
|
|
98
108
|
log?: boolean | undefined;
|
package/lib/loaders.js
CHANGED
|
@@ -3,14 +3,14 @@ import i from "fs-extra";
|
|
|
3
3
|
import n from "node:path";
|
|
4
4
|
import "node:crypto";
|
|
5
5
|
import { L as a, a1 as R, a2 as Z, a3 as q, a4 as B, a5 as J, a6 as N, Y as H, $ as Y, a0 as G, X as K, Z as ee, _ as te } from "./uids-DaRrTkI-.js";
|
|
6
|
-
import "
|
|
7
|
-
import { C as
|
|
6
|
+
import { w as L } from "./file_systems-CzTtoLWb.js";
|
|
7
|
+
import { C as w } from "./amendements-40Z7OJLT.js";
|
|
8
8
|
var v = /* @__PURE__ */ ((s) => (s[s.None = 0] = "None", s[s.ActeursEtOrganes = 1] = "ActeursEtOrganes", s[s.Agendas = 2] = "Agendas", s[s.Amendements = 4] = "Amendements", s[s.DossiersLegislatifs = 8] = "DossiersLegislatifs", s[s.Photos = 16] = "Photos", s[s.Scrutins = 32] = "Scrutins", s[s.Questions = 64] = "Questions", s[s.ComptesRendusSeances = 128] = "ComptesRendusSeances", s[s.All = 255] = "All", s))(v || {});
|
|
9
9
|
function y(s, t) {
|
|
10
10
|
const e = n.join(t, s.filename);
|
|
11
11
|
i.existsSync(e) && i.removeSync(e), i.existsSync(n.join(t, "json")) ? i.moveSync(n.join(t, "json"), e) : i.mkdirSync(e);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const S = {
|
|
14
14
|
acteursEtOrganes: [
|
|
15
15
|
{
|
|
16
16
|
// AMO10 (XVII)
|
|
@@ -688,18 +688,7 @@ const h = {
|
|
|
688
688
|
url: "https://data.assemblee-nationale.fr/static/openData/repository/16/vp/syceronbrut/syseron.xml.zip"
|
|
689
689
|
}
|
|
690
690
|
]
|
|
691
|
-
}
|
|
692
|
-
function* L(s, t = []) {
|
|
693
|
-
const e = n.join(s, ...t);
|
|
694
|
-
if (i.existsSync(e))
|
|
695
|
-
for (const o of i.readdirSync(e)) {
|
|
696
|
-
if (o[0] === ".")
|
|
697
|
-
continue;
|
|
698
|
-
const d = n.join(e, o), g = [...t, o];
|
|
699
|
-
i.statSync(d).isDirectory() ? yield* L(s, g) : yield g;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
const W = [
|
|
691
|
+
}, W = [
|
|
703
692
|
1e3,
|
|
704
693
|
"M",
|
|
705
694
|
900,
|
|
@@ -738,23 +727,27 @@ function se(s) {
|
|
|
738
727
|
t += W[e + 1], s -= W[e];
|
|
739
728
|
return t;
|
|
740
729
|
}
|
|
741
|
-
function*
|
|
730
|
+
function* P(s, t, e, r, d, f = "json", { noValidation: _ = !1, log: g = !1 } = {}) {
|
|
742
731
|
const j = /* @__PURE__ */ new Set();
|
|
743
732
|
for (const A of e) {
|
|
744
733
|
if (A.ignoreForWeb || !ne(t, A))
|
|
745
734
|
continue;
|
|
746
|
-
const F = new RegExp(`\\.${
|
|
735
|
+
const F = new RegExp(`\\.${f}$`), I = n.join(
|
|
747
736
|
s,
|
|
748
737
|
A.filename.replace(F, "_nettoye")
|
|
749
738
|
);
|
|
750
|
-
for (const
|
|
751
|
-
if (!
|
|
739
|
+
for (const D of L(I, d)) {
|
|
740
|
+
if (!D[D.length - 1].endsWith(".json"))
|
|
752
741
|
continue;
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
let
|
|
756
|
-
const V = _ ? JSON.parse(
|
|
757
|
-
j.has(V.uid) || (j.add(V.uid), yield {
|
|
742
|
+
const x = n.join(I, ...D);
|
|
743
|
+
g && console.log(`Loading file: ${x}…`);
|
|
744
|
+
let X = i.readFileSync(x, { encoding: "utf8" });
|
|
745
|
+
const V = _ ? JSON.parse(X) : r(X);
|
|
746
|
+
j.has(V.uid) || (j.add(V.uid), yield {
|
|
747
|
+
datasetLegislature: A.legislature,
|
|
748
|
+
filePath: x,
|
|
749
|
+
item: V
|
|
750
|
+
}, X = null);
|
|
758
751
|
}
|
|
759
752
|
}
|
|
760
753
|
j.clear();
|
|
@@ -765,151 +758,161 @@ function ne(s, t) {
|
|
|
765
758
|
}
|
|
766
759
|
function* me(s, t, e = {}) {
|
|
767
760
|
for (const {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
761
|
+
datasetLegislature: r,
|
|
762
|
+
item: d,
|
|
763
|
+
filePath: f
|
|
764
|
+
} of P(
|
|
771
765
|
s,
|
|
772
766
|
t,
|
|
773
|
-
|
|
767
|
+
S.acteursEtOrganes,
|
|
774
768
|
R.toActeur,
|
|
775
769
|
["acteurs"],
|
|
776
770
|
"json",
|
|
777
771
|
e
|
|
778
772
|
))
|
|
779
|
-
yield { acteur:
|
|
773
|
+
yield { acteur: d, datasetLegislature: r, filePath: f };
|
|
780
774
|
}
|
|
781
775
|
function* fe(s, t, e = {}) {
|
|
782
776
|
for (const {
|
|
783
|
-
item:
|
|
784
|
-
datasetLegislature: d
|
|
785
|
-
|
|
777
|
+
item: r,
|
|
778
|
+
datasetLegislature: d,
|
|
779
|
+
filePath: f
|
|
780
|
+
} of P(
|
|
786
781
|
s,
|
|
787
782
|
t,
|
|
788
|
-
|
|
783
|
+
S.acteursEtOrganes,
|
|
789
784
|
R.toOrgane,
|
|
790
785
|
["organes"],
|
|
791
786
|
"json",
|
|
792
787
|
e
|
|
793
788
|
))
|
|
794
|
-
yield { organe:
|
|
789
|
+
yield { organe: r, datasetLegislature: d, filePath: f };
|
|
795
790
|
}
|
|
796
791
|
function* pe(s, t, e = {}) {
|
|
797
792
|
for (const {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
793
|
+
datasetLegislature: r,
|
|
794
|
+
item: d,
|
|
795
|
+
filePath: f
|
|
796
|
+
} of P(
|
|
801
797
|
s,
|
|
802
798
|
t,
|
|
803
|
-
|
|
804
|
-
|
|
799
|
+
S.amendements,
|
|
800
|
+
w.toAmendement,
|
|
805
801
|
[],
|
|
806
802
|
"json",
|
|
807
803
|
e
|
|
808
804
|
))
|
|
809
|
-
yield { amendement:
|
|
805
|
+
yield { amendement: d, datasetLegislature: r, filePath: f };
|
|
810
806
|
}
|
|
811
807
|
function* ge(s, t, e = {}) {
|
|
812
808
|
for (const {
|
|
813
|
-
item:
|
|
814
|
-
datasetLegislature: d
|
|
815
|
-
|
|
809
|
+
item: r,
|
|
810
|
+
datasetLegislature: d,
|
|
811
|
+
filePath: f
|
|
812
|
+
} of P(
|
|
816
813
|
s,
|
|
817
814
|
t,
|
|
818
|
-
|
|
815
|
+
S.dossiersLegislatifs,
|
|
819
816
|
q.toDocument,
|
|
820
817
|
["documents"],
|
|
821
818
|
"json",
|
|
822
819
|
e
|
|
823
820
|
))
|
|
824
|
-
yield { document:
|
|
821
|
+
yield { document: r, datasetLegislature: d, filePath: f };
|
|
825
822
|
}
|
|
826
823
|
function* _e(s, t, e = {}) {
|
|
827
824
|
for (const {
|
|
828
|
-
item:
|
|
829
|
-
datasetLegislature: d
|
|
830
|
-
|
|
825
|
+
item: r,
|
|
826
|
+
datasetLegislature: d,
|
|
827
|
+
filePath: f
|
|
828
|
+
} of P(
|
|
831
829
|
s,
|
|
832
830
|
t,
|
|
833
|
-
|
|
831
|
+
S.dossiersLegislatifs,
|
|
834
832
|
q.toDossierParlementaire,
|
|
835
833
|
["dossiers"],
|
|
836
834
|
"json",
|
|
837
835
|
e
|
|
838
836
|
))
|
|
839
|
-
yield { dossierParlementaire:
|
|
837
|
+
yield { dossierParlementaire: r, datasetLegislature: d, filePath: f };
|
|
840
838
|
}
|
|
841
839
|
function* je(s, t, e = {}) {
|
|
842
840
|
for (const {
|
|
843
|
-
item:
|
|
844
|
-
datasetLegislature: d
|
|
845
|
-
|
|
841
|
+
item: r,
|
|
842
|
+
datasetLegislature: d,
|
|
843
|
+
filePath: f
|
|
844
|
+
} of P(
|
|
846
845
|
s,
|
|
847
846
|
t,
|
|
848
|
-
|
|
847
|
+
S.agendas,
|
|
849
848
|
Z.toReunion,
|
|
850
849
|
[],
|
|
851
850
|
"json",
|
|
852
851
|
e
|
|
853
852
|
))
|
|
854
|
-
yield { reunion:
|
|
853
|
+
yield { reunion: r, datasetLegislature: d, filePath: f };
|
|
855
854
|
}
|
|
856
855
|
function* ye(s, t, e = {}) {
|
|
857
856
|
for (const {
|
|
858
|
-
item:
|
|
859
|
-
datasetLegislature: d
|
|
860
|
-
|
|
857
|
+
item: r,
|
|
858
|
+
datasetLegislature: d,
|
|
859
|
+
filePath: f
|
|
860
|
+
} of P(
|
|
861
861
|
s,
|
|
862
862
|
t,
|
|
863
|
-
|
|
863
|
+
S.scrutins,
|
|
864
864
|
B.toScrutin,
|
|
865
865
|
[],
|
|
866
866
|
"json",
|
|
867
867
|
e
|
|
868
868
|
))
|
|
869
|
-
yield { scrutin:
|
|
869
|
+
yield { scrutin: r, datasetLegislature: d, filePath: f };
|
|
870
870
|
}
|
|
871
|
-
function*
|
|
871
|
+
function* he(s, t, e = {}) {
|
|
872
872
|
for (const {
|
|
873
|
-
item:
|
|
874
|
-
datasetLegislature: d
|
|
875
|
-
|
|
873
|
+
item: r,
|
|
874
|
+
datasetLegislature: d,
|
|
875
|
+
filePath: f
|
|
876
|
+
} of P(
|
|
876
877
|
s,
|
|
877
878
|
t,
|
|
878
|
-
|
|
879
|
+
S.questions,
|
|
879
880
|
J.toQuestion,
|
|
880
881
|
[],
|
|
881
882
|
"json",
|
|
882
883
|
e
|
|
883
884
|
))
|
|
884
|
-
yield { question:
|
|
885
|
+
yield { question: r, datasetLegislature: d, filePath: f };
|
|
885
886
|
}
|
|
886
|
-
function*
|
|
887
|
+
function* Se(s, t, e = {}) {
|
|
887
888
|
for (const {
|
|
888
|
-
item:
|
|
889
|
-
datasetLegislature: d
|
|
890
|
-
|
|
889
|
+
item: r,
|
|
890
|
+
datasetLegislature: d,
|
|
891
|
+
filePath: f
|
|
892
|
+
} of P(
|
|
891
893
|
s,
|
|
892
894
|
t,
|
|
893
|
-
|
|
895
|
+
S.comptesRendusSeances,
|
|
894
896
|
N.toCompteRendu,
|
|
895
897
|
[],
|
|
896
898
|
"xml",
|
|
897
899
|
e
|
|
898
900
|
))
|
|
899
|
-
yield { compteRendu:
|
|
901
|
+
yield { compteRendu: r, datasetLegislature: d, filePath: f };
|
|
900
902
|
}
|
|
901
903
|
function* Ae(s, t) {
|
|
902
|
-
const e = `Comptes_Rendus_Commissions_${se(t)}_nettoye`,
|
|
903
|
-
if (i.existsSync(
|
|
904
|
-
for (const d of T(
|
|
904
|
+
const e = `Comptes_Rendus_Commissions_${se(t)}_nettoye`, r = n.join(s, e);
|
|
905
|
+
if (i.existsSync(r))
|
|
906
|
+
for (const d of T(r))
|
|
905
907
|
try {
|
|
906
|
-
const
|
|
908
|
+
const f = i.readFileSync(d, "utf-8");
|
|
907
909
|
yield {
|
|
908
|
-
compteRendu: JSON.parse(
|
|
909
|
-
datasetLegislature: t
|
|
910
|
+
compteRendu: JSON.parse(f),
|
|
911
|
+
datasetLegislature: t,
|
|
912
|
+
filePath: d
|
|
910
913
|
};
|
|
911
|
-
} catch (
|
|
912
|
-
console.warn(`Erreur lors de la lecture du fichier ${d} :`,
|
|
914
|
+
} catch (f) {
|
|
915
|
+
console.warn(`Erreur lors de la lecture du fichier ${d} :`, f);
|
|
913
916
|
}
|
|
914
917
|
}
|
|
915
918
|
function* T(s) {
|
|
@@ -919,203 +922,203 @@ function* T(s) {
|
|
|
919
922
|
t.isDirectory() ? yield* T(e) : t.isFile() && e.endsWith(".json") && (yield e);
|
|
920
923
|
}
|
|
921
924
|
}
|
|
922
|
-
function Fe(s, t, e, { log:
|
|
923
|
-
const d = {},
|
|
925
|
+
function Fe(s, t, e, { log: r = !1 } = {}) {
|
|
926
|
+
const d = {}, f = {};
|
|
924
927
|
if (t & v.ActeursEtOrganes)
|
|
925
|
-
for (const
|
|
926
|
-
if (
|
|
928
|
+
for (const o of S.acteursEtOrganes) {
|
|
929
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
927
930
|
continue;
|
|
928
931
|
const u = n.join(
|
|
929
932
|
s,
|
|
930
|
-
|
|
933
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
931
934
|
);
|
|
932
935
|
for (const c of L(u, ["acteurs"])) {
|
|
933
936
|
if (!c[c.length - 1].endsWith(".json"))
|
|
934
937
|
continue;
|
|
935
938
|
const l = n.join(u, ...c);
|
|
936
|
-
|
|
937
|
-
const
|
|
939
|
+
r && console.log(`Loading file: ${l}…`);
|
|
940
|
+
const p = i.readFileSync(l, {
|
|
938
941
|
encoding: "utf8"
|
|
939
|
-
}), m = R.toActeur(
|
|
942
|
+
}), m = R.toActeur(p);
|
|
940
943
|
d[m.uid] === void 0 && (d[m.uid] = m);
|
|
941
944
|
}
|
|
942
945
|
for (const c of L(u, ["organes"])) {
|
|
943
946
|
if (!c[c.length - 1].endsWith(".json"))
|
|
944
947
|
continue;
|
|
945
948
|
const l = n.join(u, ...c);
|
|
946
|
-
|
|
947
|
-
const
|
|
949
|
+
r && console.log(`Loading file: ${l}…`);
|
|
950
|
+
const p = i.readFileSync(l, {
|
|
948
951
|
encoding: "utf8"
|
|
949
|
-
}), m = R.toOrgane(
|
|
950
|
-
|
|
952
|
+
}), m = R.toOrgane(p);
|
|
953
|
+
f[m.uid] === void 0 && (f[m.uid] = m);
|
|
951
954
|
}
|
|
952
955
|
}
|
|
953
|
-
const _ = {},
|
|
956
|
+
const _ = {}, g = {}, j = {};
|
|
954
957
|
if (t & v.Agendas)
|
|
955
|
-
for (const
|
|
956
|
-
if (
|
|
958
|
+
for (const o of S.agendas) {
|
|
959
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
957
960
|
continue;
|
|
958
961
|
const u = n.join(
|
|
959
962
|
s,
|
|
960
|
-
|
|
963
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
961
964
|
);
|
|
962
965
|
for (const c of L(u)) {
|
|
963
966
|
if (!c[c.length - 1].endsWith(".json"))
|
|
964
967
|
continue;
|
|
965
968
|
const l = n.join(u, ...c);
|
|
966
|
-
|
|
967
|
-
const
|
|
969
|
+
r && console.log(`Loading file: ${l}…`);
|
|
970
|
+
const p = i.readFileSync(l, {
|
|
968
971
|
encoding: "utf8"
|
|
969
|
-
}), m = Z.toReunion(
|
|
972
|
+
}), m = Z.toReunion(p);
|
|
970
973
|
_[m.uid] === void 0 && (_[m.uid] = m);
|
|
971
974
|
const b = m.timestampDebut.toISOString().split("T")[0];
|
|
972
|
-
let
|
|
973
|
-
|
|
975
|
+
let $ = g[b];
|
|
976
|
+
$ === void 0 && ($ = g[b] = []), $.push(m);
|
|
974
977
|
const U = m.odj;
|
|
975
978
|
if (U !== void 0)
|
|
976
979
|
for (const C of U.pointsOdj || [])
|
|
977
|
-
for (const
|
|
978
|
-
let M = j[
|
|
979
|
-
M === void 0 && (M = j[
|
|
980
|
+
for (const k of C.dossiersLegislatifsRefs || []) {
|
|
981
|
+
let M = j[k];
|
|
982
|
+
M === void 0 && (M = j[k] = []), M.push(m);
|
|
980
983
|
}
|
|
981
984
|
}
|
|
982
985
|
}
|
|
983
986
|
const A = {};
|
|
984
987
|
if (t & v.Amendements)
|
|
985
|
-
for (const
|
|
986
|
-
if (
|
|
988
|
+
for (const o of S.amendements) {
|
|
989
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
987
990
|
continue;
|
|
988
991
|
const u = n.join(
|
|
989
992
|
s,
|
|
990
|
-
|
|
993
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
991
994
|
);
|
|
992
995
|
for (const c of L(u)) {
|
|
993
996
|
if (!c[c.length - 1].endsWith(".json"))
|
|
994
997
|
continue;
|
|
995
998
|
const l = n.join(u, ...c);
|
|
996
|
-
|
|
997
|
-
const
|
|
999
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1000
|
+
const p = i.readFileSync(l, {
|
|
998
1001
|
encoding: "utf8"
|
|
999
|
-
}), m =
|
|
1002
|
+
}), m = w.toAmendement(p);
|
|
1000
1003
|
A[m.uid] === void 0 && (A[m.uid] = m);
|
|
1001
1004
|
}
|
|
1002
1005
|
}
|
|
1003
|
-
const F = {}, I = {},
|
|
1006
|
+
const F = {}, I = {}, D = {}, z = {};
|
|
1004
1007
|
if (t & v.DossiersLegislatifs)
|
|
1005
|
-
for (const
|
|
1006
|
-
if (
|
|
1008
|
+
for (const o of S.dossiersLegislatifs) {
|
|
1009
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1007
1010
|
continue;
|
|
1008
1011
|
const u = n.join(
|
|
1009
1012
|
s,
|
|
1010
|
-
|
|
1013
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
1011
1014
|
);
|
|
1012
1015
|
for (const c of L(u, ["documents"])) {
|
|
1013
1016
|
if (!c[c.length - 1].endsWith(".json"))
|
|
1014
1017
|
continue;
|
|
1015
1018
|
const l = n.join(u, ...c);
|
|
1016
|
-
|
|
1017
|
-
const
|
|
1019
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1020
|
+
const p = i.readFileSync(l, {
|
|
1018
1021
|
encoding: "utf8"
|
|
1019
|
-
}), m = q.toDocument(
|
|
1022
|
+
}), m = q.toDocument(p);
|
|
1020
1023
|
F[m.uid] === void 0 && (F[m.uid] = m);
|
|
1021
1024
|
}
|
|
1022
1025
|
for (const c of L(u, ["dossiers"])) {
|
|
1023
1026
|
if (!c[c.length - 1].endsWith(".json"))
|
|
1024
1027
|
continue;
|
|
1025
1028
|
const l = n.join(u, ...c);
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1029
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1030
|
+
const p = i.readFileSync(l, {
|
|
1028
1031
|
encoding: "utf8"
|
|
1029
|
-
}), m = q.toDossierParlementaire(
|
|
1030
|
-
b.senatChemin && I[b.senatChemin] === void 0 && (I[b.senatChemin] = m), b.titreChemin &&
|
|
1032
|
+
}), m = q.toDossierParlementaire(p), b = m.titreDossier;
|
|
1033
|
+
b.senatChemin && I[b.senatChemin] === void 0 && (I[b.senatChemin] = m), b.titreChemin && D[b.titreChemin] === void 0 && (D[b.titreChemin] = m), z[m.uid] === void 0 && (z[m.uid] = m);
|
|
1031
1034
|
}
|
|
1032
1035
|
}
|
|
1033
|
-
let
|
|
1036
|
+
let x = {};
|
|
1034
1037
|
if (t & v.Photos) {
|
|
1035
1038
|
{
|
|
1036
|
-
const
|
|
1039
|
+
const o = n.join(
|
|
1037
1040
|
s,
|
|
1038
1041
|
`photos_deputes_${// TODO: Handle Legislature.All.
|
|
1039
1042
|
e === a.All ? a.DixSept : e}`,
|
|
1040
1043
|
"deputes.json"
|
|
1041
1044
|
);
|
|
1042
|
-
if (i.existsSync(
|
|
1043
|
-
|
|
1044
|
-
const u = i.readFileSync(
|
|
1045
|
-
Object.assign(
|
|
1046
|
-
} else
|
|
1045
|
+
if (i.existsSync(o)) {
|
|
1046
|
+
r && console.log(`Loading file: ${o}`);
|
|
1047
|
+
const u = i.readFileSync(o, { encoding: "utf8" });
|
|
1048
|
+
Object.assign(x, JSON.parse(u));
|
|
1049
|
+
} else r && console.log(`Ignoring missing file: ${o}`);
|
|
1047
1050
|
}
|
|
1048
1051
|
{
|
|
1049
|
-
const
|
|
1052
|
+
const o = n.join(
|
|
1050
1053
|
s,
|
|
1051
1054
|
"photos_senateurs",
|
|
1052
1055
|
"senateurs.json"
|
|
1053
1056
|
);
|
|
1054
|
-
if (i.existsSync(
|
|
1055
|
-
|
|
1056
|
-
const u = i.readFileSync(
|
|
1057
|
-
Object.assign(
|
|
1058
|
-
} else
|
|
1057
|
+
if (i.existsSync(o)) {
|
|
1058
|
+
r && console.log(`Loading file: ${o}`);
|
|
1059
|
+
const u = i.readFileSync(o, { encoding: "utf8" });
|
|
1060
|
+
Object.assign(x, JSON.parse(u));
|
|
1061
|
+
} else r && console.log(`Ignoring missing file: ${o}`);
|
|
1059
1062
|
}
|
|
1060
1063
|
}
|
|
1061
|
-
const
|
|
1064
|
+
const X = {};
|
|
1062
1065
|
if (t & v.Scrutins)
|
|
1063
|
-
for (const
|
|
1064
|
-
if (
|
|
1066
|
+
for (const o of S.scrutins) {
|
|
1067
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1065
1068
|
continue;
|
|
1066
1069
|
const u = n.join(
|
|
1067
1070
|
s,
|
|
1068
|
-
|
|
1071
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
1069
1072
|
);
|
|
1070
1073
|
for (const c of L(u)) {
|
|
1071
1074
|
if (!c[c.length - 1].endsWith(".json"))
|
|
1072
1075
|
continue;
|
|
1073
1076
|
const l = n.join(u, ...c);
|
|
1074
|
-
|
|
1075
|
-
const
|
|
1077
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1078
|
+
const p = i.readFileSync(l, {
|
|
1076
1079
|
encoding: "utf8"
|
|
1077
|
-
}), m = B.toScrutin(
|
|
1078
|
-
|
|
1080
|
+
}), m = B.toScrutin(p);
|
|
1081
|
+
X[m.uid] === void 0 && (X[m.uid] = m);
|
|
1079
1082
|
}
|
|
1080
1083
|
}
|
|
1081
1084
|
const V = {};
|
|
1082
1085
|
if (t & v.Questions)
|
|
1083
|
-
for (const
|
|
1084
|
-
if (
|
|
1086
|
+
for (const o of S.questions) {
|
|
1087
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1085
1088
|
continue;
|
|
1086
1089
|
const u = n.join(
|
|
1087
1090
|
s,
|
|
1088
|
-
|
|
1091
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
1089
1092
|
);
|
|
1090
1093
|
for (const c of L(u)) {
|
|
1091
1094
|
if (!c[c.length - 1].endsWith(".json"))
|
|
1092
1095
|
continue;
|
|
1093
1096
|
const l = n.join(u, ...c);
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1097
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1098
|
+
const p = i.readFileSync(l, {
|
|
1096
1099
|
encoding: "utf8"
|
|
1097
|
-
}), m = J.toQuestion(
|
|
1100
|
+
}), m = J.toQuestion(p);
|
|
1098
1101
|
V[m.uid] === void 0 && (V[m.uid] = m);
|
|
1099
1102
|
}
|
|
1100
1103
|
}
|
|
1101
|
-
const
|
|
1104
|
+
const O = {};
|
|
1102
1105
|
if (t & v.ComptesRendusSeances)
|
|
1103
|
-
for (const
|
|
1104
|
-
if (
|
|
1106
|
+
for (const o of S.comptesRendusSeances) {
|
|
1107
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1105
1108
|
continue;
|
|
1106
1109
|
const u = n.join(
|
|
1107
1110
|
s,
|
|
1108
|
-
|
|
1111
|
+
o.filename.replace(/\.json$/, "_nettoye")
|
|
1109
1112
|
);
|
|
1110
1113
|
for (const c of L(u)) {
|
|
1111
1114
|
if (!c[c.length - 1].endsWith(".json"))
|
|
1112
1115
|
continue;
|
|
1113
1116
|
const l = n.join(u, ...c);
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1117
|
+
r && console.log(`Loading file: ${l}…`);
|
|
1118
|
+
const p = i.readFileSync(l, {
|
|
1116
1119
|
encoding: "utf8"
|
|
1117
|
-
}), m = N.toCompteRendu(
|
|
1118
|
-
|
|
1120
|
+
}), m = N.toCompteRendu(p);
|
|
1121
|
+
O[m.uid] === void 0 && (O[m.uid] = m);
|
|
1119
1122
|
}
|
|
1120
1123
|
}
|
|
1121
1124
|
return {
|
|
@@ -1123,55 +1126,55 @@ function Fe(s, t, e, { log: o = !1 } = {}) {
|
|
|
1123
1126
|
amendementByUid: A,
|
|
1124
1127
|
documentByUid: F,
|
|
1125
1128
|
dossierParlementaireBySenatChemin: I,
|
|
1126
|
-
dossierParlementaireByTitreChemin:
|
|
1129
|
+
dossierParlementaireByTitreChemin: D,
|
|
1127
1130
|
dossierParlementaireByUid: z,
|
|
1128
|
-
organeByUid:
|
|
1129
|
-
photoByUid:
|
|
1131
|
+
organeByUid: f,
|
|
1132
|
+
photoByUid: x,
|
|
1130
1133
|
reunionByUid: _,
|
|
1131
|
-
reunionsByDay:
|
|
1134
|
+
reunionsByDay: g,
|
|
1132
1135
|
reunionsByDossierUid: j,
|
|
1133
|
-
scrutinByUid:
|
|
1136
|
+
scrutinByUid: X,
|
|
1134
1137
|
questionByUid: V,
|
|
1135
|
-
compteRenduByUid:
|
|
1138
|
+
compteRenduByUid: O
|
|
1136
1139
|
};
|
|
1137
1140
|
}
|
|
1138
|
-
function ve(s, t, e, { log:
|
|
1139
|
-
const d = {},
|
|
1141
|
+
function ve(s, t, e, { log: r = !1 } = {}) {
|
|
1142
|
+
const d = {}, f = {};
|
|
1140
1143
|
if (t & v.ActeursEtOrganes)
|
|
1141
|
-
for (const
|
|
1142
|
-
if (
|
|
1144
|
+
for (const o of S.acteursEtOrganes) {
|
|
1145
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1143
1146
|
continue;
|
|
1144
1147
|
const u = n.join(
|
|
1145
1148
|
s,
|
|
1146
|
-
|
|
1149
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1147
1150
|
);
|
|
1148
|
-
|
|
1149
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1150
|
-
for (const l of
|
|
1151
|
+
r && console.log(`Loading file: ${u}`);
|
|
1152
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = R.toActeursEtOrganes(c);
|
|
1153
|
+
for (const l of h.acteurs)
|
|
1151
1154
|
d[l.uid] === void 0 && (d[l.uid] = l);
|
|
1152
|
-
for (const l of
|
|
1153
|
-
|
|
1155
|
+
for (const l of h.organes)
|
|
1156
|
+
f[l.uid] === void 0 && (f[l.uid] = l);
|
|
1154
1157
|
}
|
|
1155
|
-
const _ = {},
|
|
1158
|
+
const _ = {}, g = {}, j = {};
|
|
1156
1159
|
if (t & v.Agendas)
|
|
1157
|
-
for (const
|
|
1158
|
-
if (
|
|
1160
|
+
for (const o of S.agendas) {
|
|
1161
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1159
1162
|
continue;
|
|
1160
1163
|
const u = n.join(
|
|
1161
1164
|
s,
|
|
1162
|
-
|
|
1165
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1163
1166
|
);
|
|
1164
|
-
|
|
1165
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1166
|
-
for (const l of
|
|
1167
|
+
r && console.log(`Loading file: ${u}`);
|
|
1168
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = Z.toAgendas(c);
|
|
1169
|
+
for (const l of h.reunions) {
|
|
1167
1170
|
_[l.uid] === void 0 && (_[l.uid] = l);
|
|
1168
|
-
const
|
|
1169
|
-
let m = p
|
|
1170
|
-
m === void 0 && (m = p
|
|
1171
|
+
const p = l.timestampDebut.toISOString().split("T")[0];
|
|
1172
|
+
let m = g[p];
|
|
1173
|
+
m === void 0 && (m = g[p] = []), m.push(l);
|
|
1171
1174
|
const b = l.odj;
|
|
1172
1175
|
if (b !== void 0)
|
|
1173
|
-
for (const
|
|
1174
|
-
for (const U of
|
|
1176
|
+
for (const $ of b.pointsOdj || [])
|
|
1177
|
+
for (const U of $.dossiersLegislatifsRefs || []) {
|
|
1175
1178
|
let C = j[U];
|
|
1176
1179
|
C === void 0 && (C = j[U] = []), C.push(l);
|
|
1177
1180
|
}
|
|
@@ -1179,40 +1182,40 @@ function ve(s, t, e, { log: o = !1 } = {}) {
|
|
|
1179
1182
|
}
|
|
1180
1183
|
const A = {};
|
|
1181
1184
|
if (t & v.Amendements)
|
|
1182
|
-
for (const
|
|
1183
|
-
if (
|
|
1185
|
+
for (const o of S.amendements) {
|
|
1186
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1184
1187
|
continue;
|
|
1185
1188
|
const u = n.join(
|
|
1186
1189
|
s,
|
|
1187
|
-
|
|
1190
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1188
1191
|
);
|
|
1189
|
-
|
|
1190
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1191
|
-
for (const l of
|
|
1192
|
-
for (const
|
|
1193
|
-
A[
|
|
1192
|
+
r && console.log(`Loading file: ${u}`);
|
|
1193
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = w.toAmendements(c);
|
|
1194
|
+
for (const l of h.textesLegislatifs)
|
|
1195
|
+
for (const p of l.amendements)
|
|
1196
|
+
A[p.uid] === void 0 && (A[p.uid] = p);
|
|
1194
1197
|
}
|
|
1195
|
-
const F = {}, I = {},
|
|
1198
|
+
const F = {}, I = {}, D = {}, z = {};
|
|
1196
1199
|
if (t & v.DossiersLegislatifs)
|
|
1197
|
-
for (const
|
|
1198
|
-
if (
|
|
1200
|
+
for (const o of S.dossiersLegislatifs) {
|
|
1201
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1199
1202
|
continue;
|
|
1200
1203
|
const u = n.join(
|
|
1201
1204
|
s,
|
|
1202
|
-
|
|
1205
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1203
1206
|
);
|
|
1204
|
-
|
|
1205
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1206
|
-
for (const l of
|
|
1207
|
+
r && console.log(`Loading file: ${u}`);
|
|
1208
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = q.toDossiersLegislatifs(c);
|
|
1209
|
+
for (const l of h.textesLegislatifs)
|
|
1207
1210
|
F[l.uid] === void 0 && (F[l.uid] = l);
|
|
1208
|
-
for (const l of
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
+
for (const l of h.dossiersParlementaires) {
|
|
1212
|
+
const p = l.titreDossier;
|
|
1213
|
+
p.senatChemin && I[p.senatChemin] === void 0 && (I[p.senatChemin] = l), p.titreChemin && D[p.titreChemin] === void 0 && (D[p.titreChemin] = l), z[l.uid] === void 0 && (z[l.uid] = l);
|
|
1211
1214
|
}
|
|
1212
1215
|
}
|
|
1213
|
-
const
|
|
1216
|
+
const x = {};
|
|
1214
1217
|
if (t & v.Photos) {
|
|
1215
|
-
const
|
|
1218
|
+
const o = {};
|
|
1216
1219
|
{
|
|
1217
1220
|
const u = n.join(
|
|
1218
1221
|
s,
|
|
@@ -1221,10 +1224,10 @@ function ve(s, t, e, { log: o = !1 } = {}) {
|
|
|
1221
1224
|
"deputes.json"
|
|
1222
1225
|
);
|
|
1223
1226
|
if (i.existsSync(u)) {
|
|
1224
|
-
|
|
1227
|
+
r && console.log(`Loading file: ${u}`);
|
|
1225
1228
|
const c = i.readFileSync(u, { encoding: "utf8" });
|
|
1226
|
-
Object.assign(
|
|
1227
|
-
} else
|
|
1229
|
+
Object.assign(o, JSON.parse(c));
|
|
1230
|
+
} else r && console.log(`Ignoring missing file: ${u}`);
|
|
1228
1231
|
}
|
|
1229
1232
|
{
|
|
1230
1233
|
const u = n.join(
|
|
@@ -1233,101 +1236,101 @@ function ve(s, t, e, { log: o = !1 } = {}) {
|
|
|
1233
1236
|
"senateurs.json"
|
|
1234
1237
|
);
|
|
1235
1238
|
if (i.existsSync(u)) {
|
|
1236
|
-
|
|
1239
|
+
r && console.log(`Loading file: ${u}`);
|
|
1237
1240
|
const c = i.readFileSync(u, { encoding: "utf8" });
|
|
1238
|
-
Object.assign(
|
|
1239
|
-
} else
|
|
1241
|
+
Object.assign(o, JSON.parse(c));
|
|
1242
|
+
} else r && console.log(`Ignoring missing file: ${u}`);
|
|
1240
1243
|
}
|
|
1241
1244
|
}
|
|
1242
|
-
const
|
|
1245
|
+
const X = {};
|
|
1243
1246
|
if (t & v.Scrutins)
|
|
1244
|
-
for (const
|
|
1245
|
-
if (
|
|
1247
|
+
for (const o of S.scrutins) {
|
|
1248
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1246
1249
|
continue;
|
|
1247
1250
|
const u = n.join(
|
|
1248
1251
|
s,
|
|
1249
|
-
|
|
1252
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1250
1253
|
);
|
|
1251
|
-
|
|
1252
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1253
|
-
for (const l of
|
|
1254
|
-
|
|
1254
|
+
r && console.log(`Loading file: ${u}`);
|
|
1255
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = B.toScrutins(c);
|
|
1256
|
+
for (const l of h.scrutins)
|
|
1257
|
+
X[l.uid] === void 0 && (X[l.uid] = l);
|
|
1255
1258
|
}
|
|
1256
1259
|
const V = {};
|
|
1257
1260
|
if (t & v.Questions)
|
|
1258
|
-
for (const
|
|
1259
|
-
if (
|
|
1261
|
+
for (const o of S.questions) {
|
|
1262
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1260
1263
|
continue;
|
|
1261
1264
|
const u = n.join(
|
|
1262
1265
|
s,
|
|
1263
|
-
|
|
1266
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1264
1267
|
);
|
|
1265
|
-
|
|
1266
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1267
|
-
for (const l of
|
|
1268
|
+
r && console.log(`Loading file: ${u}`);
|
|
1269
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = J.toQuestions(c);
|
|
1270
|
+
for (const l of h.questions)
|
|
1268
1271
|
V[l.uid] === void 0 && (V[l.uid] = l);
|
|
1269
1272
|
}
|
|
1270
|
-
const
|
|
1273
|
+
const O = {};
|
|
1271
1274
|
if (t & v.ComptesRendusSeances)
|
|
1272
|
-
for (const
|
|
1273
|
-
if (
|
|
1275
|
+
for (const o of S.comptesRendusSeances) {
|
|
1276
|
+
if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
|
|
1274
1277
|
continue;
|
|
1275
1278
|
const u = n.join(
|
|
1276
1279
|
s,
|
|
1277
|
-
|
|
1280
|
+
o.filename.replace(/\.json$/, "_nettoye.json")
|
|
1278
1281
|
);
|
|
1279
|
-
|
|
1280
|
-
const c = i.readFileSync(u, { encoding: "utf8" }),
|
|
1281
|
-
for (const l of
|
|
1282
|
-
|
|
1282
|
+
r && console.log(`Loading file: ${u}`);
|
|
1283
|
+
const c = i.readFileSync(u, { encoding: "utf8" }), h = N.toComptesRendus(c);
|
|
1284
|
+
for (const l of h.comptesRendus)
|
|
1285
|
+
O[l.uid] === void 0 && (O[l.uid] = l);
|
|
1283
1286
|
}
|
|
1284
1287
|
return {
|
|
1285
1288
|
acteurByUid: d,
|
|
1286
1289
|
amendementByUid: A,
|
|
1287
1290
|
documentByUid: F,
|
|
1288
1291
|
dossierParlementaireBySenatChemin: I,
|
|
1289
|
-
dossierParlementaireByTitreChemin:
|
|
1292
|
+
dossierParlementaireByTitreChemin: D,
|
|
1290
1293
|
dossierParlementaireByUid: z,
|
|
1291
|
-
organeByUid:
|
|
1292
|
-
photoByUid:
|
|
1294
|
+
organeByUid: f,
|
|
1295
|
+
photoByUid: x,
|
|
1293
1296
|
reunionByUid: _,
|
|
1294
|
-
reunionsByDay:
|
|
1297
|
+
reunionsByDay: g,
|
|
1295
1298
|
reunionsByDossierUid: j,
|
|
1296
|
-
scrutinByUid:
|
|
1299
|
+
scrutinByUid: X,
|
|
1297
1300
|
questionByUid: V,
|
|
1298
|
-
compteRenduByUid:
|
|
1301
|
+
compteRenduByUid: O
|
|
1299
1302
|
};
|
|
1300
1303
|
}
|
|
1301
1304
|
function Ie(s, t, e) {
|
|
1302
|
-
const
|
|
1303
|
-
if (!i.pathExistsSync(
|
|
1305
|
+
const r = n.join(s, "Documents"), d = ie(r, t), f = n.join(d, "index.json");
|
|
1306
|
+
if (!i.pathExistsSync(f))
|
|
1304
1307
|
return;
|
|
1305
|
-
const _ = i.readJsonSync(
|
|
1306
|
-
for (const
|
|
1307
|
-
for (const { filename: j, url: A } of _[
|
|
1308
|
+
const _ = i.readJsonSync(f);
|
|
1309
|
+
for (const g of e)
|
|
1310
|
+
for (const { filename: j, url: A } of _[g] ?? [])
|
|
1308
1311
|
if (j !== void 0)
|
|
1309
|
-
return { format:
|
|
1312
|
+
return { format: g, path: n.join(d, j), url: A };
|
|
1310
1313
|
}
|
|
1311
1314
|
function be(s, t, { log: e = !1 } = {}) {
|
|
1312
|
-
const
|
|
1315
|
+
const r = n.join(
|
|
1313
1316
|
s,
|
|
1314
1317
|
`photos_deputes_${// TODO: Handle Legislature.All.
|
|
1315
1318
|
t === a.All ? a.DixSept : t}`,
|
|
1316
1319
|
"deputes.json"
|
|
1317
1320
|
);
|
|
1318
|
-
e && console.log(`Loading file: ${
|
|
1319
|
-
const d = i.readFileSync(
|
|
1321
|
+
e && console.log(`Loading file: ${r}`);
|
|
1322
|
+
const d = i.readFileSync(r, { encoding: "utf8" });
|
|
1320
1323
|
return JSON.parse(d);
|
|
1321
1324
|
}
|
|
1322
|
-
function
|
|
1325
|
+
function De(s, { log: t = !1 } = {}) {
|
|
1323
1326
|
const e = n.join(
|
|
1324
1327
|
s,
|
|
1325
1328
|
"photos_senateurs",
|
|
1326
1329
|
"senateurs.json"
|
|
1327
1330
|
);
|
|
1328
1331
|
t && console.log(`Loading file: ${e}`);
|
|
1329
|
-
const
|
|
1330
|
-
return JSON.parse(
|
|
1332
|
+
const r = i.readFileSync(e, { encoding: "utf8" });
|
|
1333
|
+
return JSON.parse(r);
|
|
1331
1334
|
}
|
|
1332
1335
|
function ie(s, t) {
|
|
1333
1336
|
const e = t.match(H);
|
|
@@ -1336,25 +1339,25 @@ function ie(s, t) {
|
|
|
1336
1339
|
null,
|
|
1337
1340
|
`Unexpected structure for document UID: ${t}`
|
|
1338
1341
|
);
|
|
1339
|
-
const
|
|
1342
|
+
const r = e.groups, d = n.join(
|
|
1340
1343
|
s,
|
|
1341
|
-
|
|
1342
|
-
),
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
),
|
|
1344
|
+
r.documentType ?? r.documentType2
|
|
1345
|
+
), f = n.join(d, r.chambre ?? r.chambre2), _ = n.join(
|
|
1346
|
+
f,
|
|
1347
|
+
r.republique ?? r.republique2
|
|
1348
|
+
), g = n.join(
|
|
1346
1349
|
_,
|
|
1347
|
-
|
|
1348
|
-
), j =
|
|
1350
|
+
r.legislature ?? r.legislature2
|
|
1351
|
+
), j = r.etat;
|
|
1349
1352
|
if (j === void 0)
|
|
1350
|
-
return i.ensureDirSync(
|
|
1351
|
-
const A = n.join(
|
|
1352
|
-
let F = "000000" + (
|
|
1353
|
+
return i.ensureDirSync(g), n.join(g, t);
|
|
1354
|
+
const A = n.join(g, j);
|
|
1355
|
+
let F = "000000" + (r.numero ?? r.numero2);
|
|
1353
1356
|
F = F.substring(F.length - 6);
|
|
1354
1357
|
const I = n.join(A, F.substring(0, 3));
|
|
1355
1358
|
return i.ensureDirSync(I), n.join(I, t);
|
|
1356
1359
|
}
|
|
1357
|
-
function
|
|
1360
|
+
function Xe(s, t) {
|
|
1358
1361
|
return E(s, t, ee);
|
|
1359
1362
|
}
|
|
1360
1363
|
function Ve(s, t) {
|
|
@@ -1364,10 +1367,10 @@ function Ve(s, t) {
|
|
|
1364
1367
|
null,
|
|
1365
1368
|
`Unexpected structure for reunion UID: ${t}`
|
|
1366
1369
|
);
|
|
1367
|
-
const
|
|
1370
|
+
const r = n.join(s, e[1]), d = n.join(r, e[2]), f = n.join(d, e[3]), _ = n.join(f, e[4]), g = n.join(_, e[5]);
|
|
1368
1371
|
let j = "000000000" + e[6];
|
|
1369
1372
|
j = j.substring(j.length - 9);
|
|
1370
|
-
const A = n.join(
|
|
1373
|
+
const A = n.join(g, j.substring(0, 3)), F = n.join(A, j.substring(3, 3));
|
|
1371
1374
|
return i.ensureDirSync(F), n.join(F, t);
|
|
1372
1375
|
}
|
|
1373
1376
|
function Le(s, t) {
|
|
@@ -1377,61 +1380,61 @@ function Le(s, t) {
|
|
|
1377
1380
|
null,
|
|
1378
1381
|
`Unexpected structure for scrutin UID: ${t}`
|
|
1379
1382
|
);
|
|
1380
|
-
const
|
|
1383
|
+
const r = n.join(s, e[1]), d = n.join(r, e[2]), f = n.join(d, e[3]);
|
|
1381
1384
|
let _ = "000000" + e[4];
|
|
1382
1385
|
_ = _.substring(_.length - 6);
|
|
1383
|
-
const
|
|
1384
|
-
return i.ensureDirSync(
|
|
1386
|
+
const g = n.join(f, _.substring(0, 3));
|
|
1387
|
+
return i.ensureDirSync(g), n.join(g, t);
|
|
1385
1388
|
}
|
|
1386
1389
|
function xe(s, t) {
|
|
1387
1390
|
return E(s, t, te);
|
|
1388
1391
|
}
|
|
1389
|
-
function
|
|
1392
|
+
function Pe(s, t) {
|
|
1390
1393
|
const e = K.exec(t);
|
|
1391
1394
|
Q.notStrictEqual(
|
|
1392
1395
|
e,
|
|
1393
1396
|
null,
|
|
1394
1397
|
`Unexpected structure for object with UID: ${t}`
|
|
1395
1398
|
);
|
|
1396
|
-
const
|
|
1397
|
-
let
|
|
1398
|
-
|
|
1399
|
-
const j = n.join(_,
|
|
1399
|
+
const r = n.join(s, e[2]), d = n.join(r, e[3]), f = n.join(d, e[4]), _ = n.join(f, e[5]);
|
|
1400
|
+
let g = "000000000" + e[7];
|
|
1401
|
+
g = g.substring(g.length - 9);
|
|
1402
|
+
const j = n.join(_, g.substring(0, 3)), A = n.join(j, g.substring(3, 3));
|
|
1400
1403
|
return i.ensureDirSync(A), n.join(A, t);
|
|
1401
1404
|
}
|
|
1402
1405
|
function E(s, t, e) {
|
|
1403
|
-
const
|
|
1406
|
+
const r = e.exec(t);
|
|
1404
1407
|
Q.notStrictEqual(
|
|
1405
|
-
|
|
1408
|
+
r,
|
|
1406
1409
|
null,
|
|
1407
1410
|
`Unexpected structure for object with UID: ${t}`
|
|
1408
1411
|
);
|
|
1409
|
-
const d = n.join(s,
|
|
1410
|
-
let _ = "000000" +
|
|
1412
|
+
const d = n.join(s, r[1]), f = n.join(d, r[2]);
|
|
1413
|
+
let _ = "000000" + r[3];
|
|
1411
1414
|
_ = _.substring(_.length - 6);
|
|
1412
|
-
const
|
|
1413
|
-
return i.ensureDirSync(
|
|
1415
|
+
const g = n.join(f, _.substring(0, 3));
|
|
1416
|
+
return i.ensureDirSync(g), n.join(g, t);
|
|
1414
1417
|
}
|
|
1415
1418
|
export {
|
|
1416
1419
|
v as EnabledDatasets,
|
|
1417
1420
|
me as iterLoadAssembleeActeurs,
|
|
1418
1421
|
pe as iterLoadAssembleeAmendements,
|
|
1419
|
-
|
|
1422
|
+
Se as iterLoadAssembleeComptesRendus,
|
|
1420
1423
|
Ae as iterLoadAssembleeComptesRendusCommissions,
|
|
1421
1424
|
ge as iterLoadAssembleeDocuments,
|
|
1422
1425
|
_e as iterLoadAssembleeDossiersParlementaires,
|
|
1423
1426
|
fe as iterLoadAssembleeOrganes,
|
|
1424
|
-
|
|
1427
|
+
he as iterLoadAssembleeQuestions,
|
|
1425
1428
|
je as iterLoadAssembleeReunions,
|
|
1426
1429
|
ye as iterLoadAssembleeScrutins,
|
|
1427
1430
|
Fe as loadAssembleeData,
|
|
1428
1431
|
ve as loadAssembleeDataFromBigFiles,
|
|
1429
1432
|
Ie as loadAssembleeDocumentFile,
|
|
1430
1433
|
be as loadAssembleePhotosDeputes,
|
|
1431
|
-
|
|
1432
|
-
|
|
1434
|
+
De as loadAssembleePhotosSenateurs,
|
|
1435
|
+
Pe as pathFromCompteRenduUid,
|
|
1433
1436
|
ie as pathFromDocumentUid,
|
|
1434
|
-
|
|
1437
|
+
Xe as pathFromDossierParlementaireUid,
|
|
1435
1438
|
xe as pathFromQuestionUid,
|
|
1436
1439
|
Ve as pathFromReunionUid,
|
|
1437
1440
|
Le as pathFromScrutinUid,
|
|
@@ -7,6 +7,7 @@ type CommonOptions = {
|
|
|
7
7
|
parseDocuments?: boolean;
|
|
8
8
|
fullCompteRenduCommissions?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare function downloadAndParse(document: Document,
|
|
10
|
+
export declare function downloadAndParse(document: Document, datasetDir: string, options: any): Promise<void>;
|
|
11
11
|
export declare function downloadAndParseVideosAndCR(reunion: Reunion, datasetCleanDir: string, options: CommonOptions): Promise<void>;
|
|
12
|
+
export declare function parseDocument(document: Document, documentPath: string, options: any): Promise<void>;
|
|
12
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tricoteuses/assemblee",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Retrieve, clean up & handle French Assemblée nationale's open data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Assemblée nationale",
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"import": "./lib/cleaners.js",
|
|
41
41
|
"types": "./lib/cleaners/index.d.ts"
|
|
42
42
|
},
|
|
43
|
+
"./git": {
|
|
44
|
+
"typedoc": "./src/git.ts",
|
|
45
|
+
"import": "./lib/git.js",
|
|
46
|
+
"types": "./lib/git.d.ts"
|
|
47
|
+
},
|
|
43
48
|
"./loaders": {
|
|
44
49
|
"typedoc": "./src/loaders.ts",
|
|
45
50
|
"import": "./lib/loaders.js",
|