@tricoteuses/senat 2.2.2 → 2.3.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/loaders.d.ts +11 -5
- package/lib/loaders.js +24 -14
- package/lib/model/dosleg.d.ts +16 -12
- package/lib/model/dosleg.js +12 -4
- package/package.json +1 -1
package/lib/loaders.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface RapportMetadata {
|
|
|
34
34
|
url_html: URL;
|
|
35
35
|
url_pdf: URL;
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
37
|
+
export interface DossierLegislatifDocumentResult {
|
|
38
38
|
signet_dossier: string;
|
|
39
39
|
url_dossier_senat: string;
|
|
40
40
|
url_dossier_assemblee_nationale: string | null;
|
|
@@ -42,9 +42,10 @@ export interface DossierLegislatifTexteResult {
|
|
|
42
42
|
libelle_lecture: string;
|
|
43
43
|
libelle_organisme: string | null;
|
|
44
44
|
numero: string | null;
|
|
45
|
+
id: string | null;
|
|
45
46
|
url: string;
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
origine?: string | null | undefined;
|
|
48
|
+
type: string;
|
|
48
49
|
date: string;
|
|
49
50
|
session: string | null;
|
|
50
51
|
auteurs: {
|
|
@@ -52,13 +53,18 @@ export interface DossierLegislatifTexteResult {
|
|
|
52
53
|
nom_usuel: string;
|
|
53
54
|
matricule: string | null;
|
|
54
55
|
}[];
|
|
56
|
+
organismes?: {
|
|
57
|
+
libelle: string;
|
|
58
|
+
}[] | undefined;
|
|
55
59
|
}
|
|
56
60
|
export declare function iterFilePaths(dirPath: string): Generator<string>;
|
|
57
61
|
export declare function iterLoadSenatAmendements(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<AmendementResult>>;
|
|
58
62
|
export declare function iterLoadSenatDossiersLegislatifs(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DossierLegislatifResult>>;
|
|
59
|
-
export declare function iterLoadSenatDossiersLegislatifsTexteUrls(dataDir: string, session: number | undefined): Generator<IterItem<TexteMetadata>>;
|
|
60
63
|
export declare function iterLoadSenatDossiersLegislatifsRapportUrls(dataDir: string, session: number | undefined): Generator<IterItem<RapportMetadata>>;
|
|
61
|
-
export declare function
|
|
64
|
+
export declare function iterLoadSenatDossiersLegislatifsTexteUrls(dataDir: string, session: number | undefined): Generator<IterItem<TexteMetadata>>;
|
|
65
|
+
export declare function iterLoadSenatDossiersLegislatifsDocuments(dataDir: string, session: number | undefined, documentType: "textes" | "rapports", options?: {}): Generator<IterItem<DossierLegislatifDocumentResult>>;
|
|
66
|
+
export declare function iterLoadSenatDossiersLegislatifsRapports(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DossierLegislatifDocumentResult>>;
|
|
67
|
+
export declare function iterLoadSenatDossiersLegislatifsTextes(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DossierLegislatifDocumentResult>>;
|
|
62
68
|
export declare function loadSenatTexteContent(dataDir: string, textePathFromDataset: string): IterItem<FlatTexte | null>;
|
|
63
69
|
export declare function iterLoadSenatEvenements(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<AgendaEvent>>;
|
|
64
70
|
export declare function iterLoadSenatCirconscriptions(dataDir: string, options?: {}): Generator<IterItem<CirconscriptionResult>>;
|
package/lib/loaders.js
CHANGED
|
@@ -59,8 +59,8 @@ export function* iterLoadSenatDossiersLegislatifs(dataDir, session, options = {}
|
|
|
59
59
|
yield dossierLegislatifItem;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
export function*
|
|
63
|
-
let itemsDir = path.join(dataDir,
|
|
62
|
+
export function* iterLoadSenatDossiersLegislatifsRapportUrls(dataDir, session) {
|
|
63
|
+
let itemsDir = path.join(dataDir, RAPPORT_FOLDER);
|
|
64
64
|
if (session) {
|
|
65
65
|
itemsDir = path.join(itemsDir, session.toString());
|
|
66
66
|
}
|
|
@@ -75,8 +75,8 @@ export function* iterLoadSenatDossiersLegislatifsTexteUrls(dataDir, session) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
export function*
|
|
79
|
-
let itemsDir = path.join(dataDir,
|
|
78
|
+
export function* iterLoadSenatDossiersLegislatifsTexteUrls(dataDir, session) {
|
|
79
|
+
let itemsDir = path.join(dataDir, TEXTE_FOLDER, DATA_ORIGINAL_FOLDER);
|
|
80
80
|
if (session) {
|
|
81
81
|
itemsDir = path.join(itemsDir, session.toString());
|
|
82
82
|
}
|
|
@@ -91,34 +91,44 @@ export function* iterLoadSenatDossiersLegislatifsRapportUrls(dataDir, session) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
export function*
|
|
94
|
+
export function* iterLoadSenatDossiersLegislatifsDocuments(dataDir, session, documentType, options = {}) {
|
|
95
95
|
for (const { item: dossierLegislatif } of iterLoadSenatDossiersLegislatifs(dataDir, session, options)) {
|
|
96
96
|
for (const lecture of dossierLegislatif.lectures) {
|
|
97
97
|
const lecturesSenat = lecture.lectures_assemblee.filter((lectureAssemblee) => lectureAssemblee.assemblee === "Sénat");
|
|
98
98
|
for (const lectureSenat of lecturesSenat) {
|
|
99
|
-
for (const
|
|
100
|
-
const
|
|
99
|
+
for (const document of lectureSenat[documentType]) {
|
|
100
|
+
const enrichedDocument = {
|
|
101
101
|
signet_dossier: dossierLegislatif.signet,
|
|
102
102
|
url_dossier_senat: dossierLegislatif.url,
|
|
103
103
|
url_dossier_assemblee_nationale: dossierLegislatif.url_dossier_assemblee_nationale,
|
|
104
104
|
type_lecture: lecture.type_lecture,
|
|
105
105
|
libelle_lecture: lecture.libelle,
|
|
106
106
|
libelle_organisme: lectureSenat.libelle_organisme,
|
|
107
|
-
...
|
|
107
|
+
...document,
|
|
108
108
|
};
|
|
109
|
-
const
|
|
110
|
-
item:
|
|
109
|
+
const documentItem = {
|
|
110
|
+
item: enrichedDocument,
|
|
111
111
|
};
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
|
|
112
|
+
if (document.url) {
|
|
113
|
+
const documentName = path.parse(document.url).name;
|
|
114
|
+
documentItem.filePathFromDataset = path.join(`${document.session ?? UNDEFINED_SESSION}`, documentName, `${documentName}.pdf`);
|
|
115
115
|
}
|
|
116
|
-
yield
|
|
116
|
+
yield documentItem;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
export function* iterLoadSenatDossiersLegislatifsRapports(dataDir, session, options = {}) {
|
|
123
|
+
for (const iterItem of iterLoadSenatDossiersLegislatifsDocuments(dataDir, session, "rapports", options)) {
|
|
124
|
+
yield iterItem;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function* iterLoadSenatDossiersLegislatifsTextes(dataDir, session, options = {}) {
|
|
128
|
+
for (const iterItem of iterLoadSenatDossiersLegislatifsDocuments(dataDir, session, "textes", options)) {
|
|
129
|
+
yield iterItem;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
122
132
|
export function loadSenatTexteContent(dataDir, textePathFromDataset) {
|
|
123
133
|
const parsedTextePath = path.parse(textePathFromDataset);
|
|
124
134
|
const jsonTexteName = `${parsedTextePath.name}.json`;
|
package/lib/model/dosleg.d.ts
CHANGED
|
@@ -107,22 +107,24 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
|
|
|
107
107
|
textes: {
|
|
108
108
|
url: string;
|
|
109
109
|
date: string;
|
|
110
|
+
id: string | null;
|
|
111
|
+
type: string;
|
|
112
|
+
session: string | null;
|
|
110
113
|
auteurs: {
|
|
111
114
|
prenom: string | null;
|
|
112
115
|
nom_usuel: string;
|
|
113
116
|
matricule: string | null;
|
|
114
117
|
}[];
|
|
115
118
|
numero: string | null;
|
|
116
|
-
|
|
117
|
-
origine_texte: string;
|
|
118
|
-
type_texte: string;
|
|
119
|
-
session: string | null;
|
|
119
|
+
origine: string;
|
|
120
120
|
}[];
|
|
121
121
|
rapports: {
|
|
122
|
-
date_depot: string;
|
|
123
122
|
url: string;
|
|
123
|
+
date: string;
|
|
124
124
|
numero: string | null;
|
|
125
|
-
|
|
125
|
+
id: string | null;
|
|
126
|
+
type: string;
|
|
127
|
+
session: string;
|
|
126
128
|
auteurs: {
|
|
127
129
|
prenom: string | null;
|
|
128
130
|
nom_usuel: string;
|
|
@@ -173,22 +175,24 @@ export declare function findAll(): AsyncIterableIterator<{
|
|
|
173
175
|
textes: {
|
|
174
176
|
url: string;
|
|
175
177
|
date: string;
|
|
178
|
+
id: string | null;
|
|
179
|
+
type: string;
|
|
180
|
+
session: string | null;
|
|
176
181
|
auteurs: {
|
|
177
182
|
prenom: string | null;
|
|
178
183
|
nom_usuel: string;
|
|
179
184
|
matricule: string | null;
|
|
180
185
|
}[];
|
|
181
186
|
numero: string | null;
|
|
182
|
-
|
|
183
|
-
origine_texte: string;
|
|
184
|
-
type_texte: string;
|
|
185
|
-
session: string | null;
|
|
187
|
+
origine: string;
|
|
186
188
|
}[];
|
|
187
189
|
rapports: {
|
|
188
|
-
date_depot: string;
|
|
189
190
|
url: string;
|
|
191
|
+
date: string;
|
|
190
192
|
numero: string | null;
|
|
191
|
-
|
|
193
|
+
id: string | null;
|
|
194
|
+
type: string;
|
|
195
|
+
session: string;
|
|
192
196
|
auteurs: {
|
|
193
197
|
prenom: string | null;
|
|
194
198
|
nom_usuel: string;
|
package/lib/model/dosleg.js
CHANGED
|
@@ -40,7 +40,13 @@ function rapports(lectureAssembleeId) {
|
|
|
40
40
|
.where("lecassrap.lecassidt", "=", lectureAssembleeId)
|
|
41
41
|
.select(({ eb, ref, val }) => [
|
|
42
42
|
"rap.rapnum as numero",
|
|
43
|
-
|
|
43
|
+
eb
|
|
44
|
+
.case()
|
|
45
|
+
.when("rap.typurl", "=", "I")
|
|
46
|
+
.then(removeSubstring(ref("rap.rapurl"), val(".html")))
|
|
47
|
+
.else(null)
|
|
48
|
+
.end()
|
|
49
|
+
.as("id"),
|
|
44
50
|
eb
|
|
45
51
|
.case()
|
|
46
52
|
.when("rap.typurl", "=", "I")
|
|
@@ -48,7 +54,9 @@ function rapports(lectureAssembleeId) {
|
|
|
48
54
|
.else(rtrim(ref("rap.rapurl")))
|
|
49
55
|
.end()
|
|
50
56
|
.as("url"),
|
|
51
|
-
|
|
57
|
+
rtrim(ref("denrap.libdenrap")).as("type"),
|
|
58
|
+
toDateString(ref("rap.date_depot")).as("date"),
|
|
59
|
+
"sesann as session",
|
|
52
60
|
auteursRapport(ref("rap.rapcod")).as("auteurs"),
|
|
53
61
|
organismesRapport(ref("rap.rapcod")).as("organismes"),
|
|
54
62
|
]));
|
|
@@ -87,8 +95,8 @@ function textes(lectureAssembleeId) {
|
|
|
87
95
|
.else(rtrim(ref("texte.texurl")))
|
|
88
96
|
.end()
|
|
89
97
|
.as("url"),
|
|
90
|
-
rtrim(ref("oritxt.oritxtlib")).as("
|
|
91
|
-
rtrim(ref("typtxt.typtxtlib")).as("
|
|
98
|
+
rtrim(ref("oritxt.oritxtlib")).as("origine"),
|
|
99
|
+
rtrim(ref("typtxt.typtxtlib")).as("type"),
|
|
92
100
|
toDateString(ref("texte.txtoritxtdat")).as("date"),
|
|
93
101
|
"sesann as session",
|
|
94
102
|
auteursTexte(ref("texte.texcod")).as("auteurs"),
|