@tricoteuses/senat 3.1.20 → 3.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +32 -32
- package/README.md +326 -326
- package/lib/src/other_types/collaborateurs.d.ts +5 -0
- package/lib/src/other_types/manifest.d.ts +11 -0
- package/lib/src/parsers/collaborateurs.d.ts +44 -0
- package/lib/src/parsers/collaborateurs.js +157 -0
- package/lib/src/scripts/retrieve_agenda.js +38 -4
- package/lib/src/scripts/retrieve_collaborateurs.js +166 -0
- package/lib/src/scripts/shared/incremental_import_sql.js +859 -859
- package/lib/src/scripts/shared/schema_version.js +84 -84
- package/lib/src/scripts/shared/staging_metadata_sql.js +214 -214
- package/lib/src/scripts/validate_prefixed_tables.js +12 -12
- package/lib/src/server/ameli.js +11 -11
- package/lib/src/server/conversion_textes.js +106 -106
- package/lib/src/server/debats.js +10 -10
- package/lib/src/server/documents.js +22 -22
- package/lib/src/server/dosleg.js +33 -33
- package/lib/src/server/questions.js +10 -10
- package/lib/src/server/scrutins.js +3 -3
- package/lib/src/server/sens.js +19 -19
- package/lib/src/utils/manifest.d.ts +6 -0
- package/lib/src/utils/manifest.js +37 -0
- package/lib/src/utils/reunion_deletion.d.ts +2 -0
- package/lib/src/utils/reunion_deletion.js +27 -0
- package/lib/src/videos/match.js +4 -4
- package/lib/tests/collaborateurs.test.js +115 -0
- package/package.json +117 -117
- package/lib/src/config.d.ts +0 -21
- package/lib/src/config.js +0 -27
- package/lib/src/conversion_textes.d.ts +0 -11
- package/lib/src/conversion_textes.js +0 -316
- package/lib/src/databases.d.ts +0 -2
- package/lib/src/databases.js +0 -26
- package/lib/src/datasets.d.ts +0 -34
- package/lib/src/datasets.js +0 -233
- package/lib/src/git.d.ts +0 -26
- package/lib/src/git.js +0 -217
- package/lib/src/loaders.d.ts +0 -52
- package/lib/src/loaders.js +0 -254
- package/lib/src/model/agenda.d.ts +0 -6
- package/lib/src/model/agenda.js +0 -148
- package/lib/src/model/ameli.d.ts +0 -55
- package/lib/src/model/ameli.js +0 -148
- package/lib/src/model/commission.d.ts +0 -18
- package/lib/src/model/commission.js +0 -269
- package/lib/src/model/debats.d.ts +0 -67
- package/lib/src/model/debats.js +0 -95
- package/lib/src/model/documents.d.ts +0 -12
- package/lib/src/model/documents.js +0 -141
- package/lib/src/model/dosleg.d.ts +0 -7
- package/lib/src/model/dosleg.js +0 -326
- package/lib/src/model/index.d.ts +0 -7
- package/lib/src/model/index.js +0 -7
- package/lib/src/model/questions.d.ts +0 -45
- package/lib/src/model/questions.js +0 -89
- package/lib/src/model/scrutins.d.ts +0 -13
- package/lib/src/model/scrutins.js +0 -114
- package/lib/src/model/seance.d.ts +0 -3
- package/lib/src/model/seance.js +0 -267
- package/lib/src/model/sens.d.ts +0 -182
- package/lib/src/model/sens.js +0 -485
- package/lib/src/model/util.d.ts +0 -9
- package/lib/src/model/util.js +0 -38
- package/lib/src/raw_types/ameli.d.ts +0 -914
- package/lib/src/raw_types/ameli.js +0 -5
- package/lib/src/raw_types/debats.d.ts +0 -207
- package/lib/src/raw_types/debats.js +0 -5
- package/lib/src/raw_types/dosleg.d.ts +0 -1619
- package/lib/src/raw_types/dosleg.js +0 -5
- package/lib/src/raw_types/questions.d.ts +0 -423
- package/lib/src/raw_types/questions.js +0 -5
- package/lib/src/raw_types/senat.d.ts +0 -11372
- package/lib/src/raw_types/senat.js +0 -5
- package/lib/src/raw_types/sens.d.ts +0 -8248
- package/lib/src/raw_types/sens.js +0 -5
- package/lib/src/raw_types_schemats/ameli.d.ts +0 -539
- package/lib/src/raw_types_schemats/ameli.js +0 -2
- package/lib/src/raw_types_schemats/debats.d.ts +0 -127
- package/lib/src/raw_types_schemats/debats.js +0 -2
- package/lib/src/raw_types_schemats/dosleg.d.ts +0 -977
- package/lib/src/raw_types_schemats/dosleg.js +0 -2
- package/lib/src/raw_types_schemats/questions.d.ts +0 -237
- package/lib/src/raw_types_schemats/questions.js +0 -2
- package/lib/src/raw_types_schemats/sens.d.ts +0 -6915
- package/lib/src/raw_types_schemats/sens.js +0 -2
- package/lib/src/scripts/test_iter_load.js +0 -12
- package/lib/src/types/agenda.d.ts +0 -45
- package/lib/src/types/ameli.d.ts +0 -5
- package/lib/src/types/compte_rendu.d.ts +0 -83
- package/lib/src/types/debats.d.ts +0 -2
- package/lib/src/types/debats.js +0 -1
- package/lib/src/types/dosleg.d.ts +0 -70
- package/lib/src/types/dosleg.js +0 -1
- package/lib/src/types/questions.d.ts +0 -2
- package/lib/src/types/questions.js +0 -1
- package/lib/src/types/sens.d.ts +0 -10
- package/lib/src/types/sens.js +0 -1
- package/lib/src/types/sessions.d.ts +0 -6
- package/lib/src/types/sessions.js +0 -19
- package/lib/src/types/texte.d.ts +0 -72
- package/lib/src/types/texte.js +0 -15
- package/lib/src/validators/config.d.ts +0 -9
- package/lib/src/validators/config.js +0 -10
- /package/lib/src/{scripts/test_iter_load.d.ts → other_types/collaborateurs.js} +0 -0
- /package/lib/src/{types/agenda.js → other_types/manifest.js} +0 -0
- /package/lib/src/{types/ameli.js → scripts/retrieve_collaborateurs.d.ts} +0 -0
- /package/lib/{src/types/compte_rendu.js → tests/collaborateurs.test.d.ts} +0 -0
package/lib/src/server/ameli.js
CHANGED
|
@@ -94,17 +94,17 @@ export async function* findAllAmendements(fromSession) {
|
|
|
94
94
|
"avigvt.lib as avis_gouvernement",
|
|
95
95
|
eb.fn.coalesce("sor.lib", "irr.libirr").as("sort"),
|
|
96
96
|
"amd.rev as revision",
|
|
97
|
-
sql `
|
|
98
|
-
(
|
|
99
|
-
case
|
|
100
|
-
when ${eb.ref("amd.num")} like '%COM%' then 'https://www.senat.fr/amendements/commissions/'
|
|
101
|
-
else 'https://www.senat.fr/amendements/'
|
|
102
|
-
end ||
|
|
103
|
-
${eb.ref("ses.ann")}::text || '-' ||
|
|
104
|
-
(${eb.ref("ses.ann")}::integer + 1)::text || '/' ||
|
|
105
|
-
${eb.ref("txt_ameli.numabs")} || '/Amdt_' ||
|
|
106
|
-
${eb.ref("amd.num")} || '.html'
|
|
107
|
-
)
|
|
97
|
+
sql `
|
|
98
|
+
(
|
|
99
|
+
case
|
|
100
|
+
when ${eb.ref("amd.num")} like '%COM%' then 'https://www.senat.fr/amendements/commissions/'
|
|
101
|
+
else 'https://www.senat.fr/amendements/'
|
|
102
|
+
end ||
|
|
103
|
+
${eb.ref("ses.ann")}::text || '-' ||
|
|
104
|
+
(${eb.ref("ses.ann")}::integer + 1)::text || '/' ||
|
|
105
|
+
${eb.ref("txt_ameli.numabs")} || '/Amdt_' ||
|
|
106
|
+
${eb.ref("amd.num")} || '.html'
|
|
107
|
+
)
|
|
108
108
|
`.as("url"),
|
|
109
109
|
"grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
110
110
|
sql `rtrim(${eb.ref("com_ameli.lil")})`.as("au_nom_de_commission"),
|
|
@@ -82,119 +82,119 @@ export async function convertSenatXmlToHtml(texteXml, outputFilePath) {
|
|
|
82
82
|
}
|
|
83
83
|
const metadata = extractMetadata(xmlDoc);
|
|
84
84
|
const xmlBody = xmlDoc.querySelector("body");
|
|
85
|
-
const style = `
|
|
86
|
-
body {
|
|
87
|
-
font-family: "URW Bookman", "Bookman Old Style", serif;
|
|
88
|
-
max-width: 800px;
|
|
89
|
-
margin: 40px auto;
|
|
90
|
-
line-height: 1.5;
|
|
91
|
-
color: #333;
|
|
92
|
-
}
|
|
93
|
-
.header {
|
|
94
|
-
text-align: center;
|
|
95
|
-
margin-bottom: 40px;
|
|
96
|
-
border-bottom: 2px solid #333;
|
|
97
|
-
padding-bottom: 20px;
|
|
98
|
-
}
|
|
99
|
-
.header-top {
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
font-size: 1.2em;
|
|
102
|
-
margin-bottom: 10px;
|
|
103
|
-
}
|
|
104
|
-
.header-session {
|
|
105
|
-
text-transform: uppercase;
|
|
106
|
-
font-size: 0.9em;
|
|
107
|
-
margin-bottom: 5px;
|
|
108
|
-
}
|
|
109
|
-
.header-date {
|
|
110
|
-
font-size: 0.9em;
|
|
111
|
-
margin-bottom: 5px;
|
|
112
|
-
}
|
|
113
|
-
.header-number {
|
|
114
|
-
font-weight: bold;
|
|
115
|
-
font-size: 1.1em;
|
|
116
|
-
margin-bottom: 20px;
|
|
117
|
-
}
|
|
118
|
-
.header-type {
|
|
119
|
-
font-weight: bold;
|
|
120
|
-
font-size: 1.5em;
|
|
121
|
-
margin-top: 20px;
|
|
122
|
-
}
|
|
123
|
-
.header-authors {
|
|
124
|
-
margin-top: 20px;
|
|
125
|
-
font-style: italic;
|
|
126
|
-
}
|
|
127
|
-
.header-commission {
|
|
128
|
-
margin-top: 15px;
|
|
129
|
-
font-size: 0.9em;
|
|
130
|
-
}
|
|
131
|
-
h1 {
|
|
132
|
-
text-align: center;
|
|
133
|
-
font-size: 1.8em;
|
|
134
|
-
margin-top: 10px;
|
|
135
|
-
}
|
|
136
|
-
p {
|
|
137
|
-
margin: 0.6em 0;
|
|
138
|
-
}
|
|
139
|
-
p.has-alinea {
|
|
140
|
-
position: relative;
|
|
141
|
-
padding-left: 2.5em;
|
|
142
|
-
}
|
|
143
|
-
.alinea {
|
|
144
|
-
position: absolute;
|
|
145
|
-
left: 0;
|
|
146
|
-
top: 0.15em;
|
|
147
|
-
display: inline-flex;
|
|
148
|
-
align-items: center;
|
|
149
|
-
justify-content: center;
|
|
150
|
-
min-width: 1.5em;
|
|
151
|
-
height: 1.5em;
|
|
152
|
-
padding: 0 0.3em;
|
|
153
|
-
margin-right: 0.3em;
|
|
154
|
-
font-size: 0.75em;
|
|
155
|
-
font-weight: bold;
|
|
156
|
-
color: #555;
|
|
157
|
-
background-color: #f0f0f0;
|
|
158
|
-
border: 1px solid #ccc;
|
|
159
|
-
border-radius: 1em;
|
|
160
|
-
}
|
|
161
|
-
.num {
|
|
162
|
-
font-weight: bold;
|
|
163
|
-
margin-right: 0.2em;
|
|
164
|
-
}
|
|
165
|
-
.article {
|
|
166
|
-
margin-top: 2em;
|
|
167
|
-
}
|
|
168
|
-
.article h3 {
|
|
169
|
-
border-bottom: 1px solid #eee;
|
|
170
|
-
padding-bottom: 5px;
|
|
171
|
-
}
|
|
85
|
+
const style = `
|
|
86
|
+
body {
|
|
87
|
+
font-family: "URW Bookman", "Bookman Old Style", serif;
|
|
88
|
+
max-width: 800px;
|
|
89
|
+
margin: 40px auto;
|
|
90
|
+
line-height: 1.5;
|
|
91
|
+
color: #333;
|
|
92
|
+
}
|
|
93
|
+
.header {
|
|
94
|
+
text-align: center;
|
|
95
|
+
margin-bottom: 40px;
|
|
96
|
+
border-bottom: 2px solid #333;
|
|
97
|
+
padding-bottom: 20px;
|
|
98
|
+
}
|
|
99
|
+
.header-top {
|
|
100
|
+
font-weight: bold;
|
|
101
|
+
font-size: 1.2em;
|
|
102
|
+
margin-bottom: 10px;
|
|
103
|
+
}
|
|
104
|
+
.header-session {
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
font-size: 0.9em;
|
|
107
|
+
margin-bottom: 5px;
|
|
108
|
+
}
|
|
109
|
+
.header-date {
|
|
110
|
+
font-size: 0.9em;
|
|
111
|
+
margin-bottom: 5px;
|
|
112
|
+
}
|
|
113
|
+
.header-number {
|
|
114
|
+
font-weight: bold;
|
|
115
|
+
font-size: 1.1em;
|
|
116
|
+
margin-bottom: 20px;
|
|
117
|
+
}
|
|
118
|
+
.header-type {
|
|
119
|
+
font-weight: bold;
|
|
120
|
+
font-size: 1.5em;
|
|
121
|
+
margin-top: 20px;
|
|
122
|
+
}
|
|
123
|
+
.header-authors {
|
|
124
|
+
margin-top: 20px;
|
|
125
|
+
font-style: italic;
|
|
126
|
+
}
|
|
127
|
+
.header-commission {
|
|
128
|
+
margin-top: 15px;
|
|
129
|
+
font-size: 0.9em;
|
|
130
|
+
}
|
|
131
|
+
h1 {
|
|
132
|
+
text-align: center;
|
|
133
|
+
font-size: 1.8em;
|
|
134
|
+
margin-top: 10px;
|
|
135
|
+
}
|
|
136
|
+
p {
|
|
137
|
+
margin: 0.6em 0;
|
|
138
|
+
}
|
|
139
|
+
p.has-alinea {
|
|
140
|
+
position: relative;
|
|
141
|
+
padding-left: 2.5em;
|
|
142
|
+
}
|
|
143
|
+
.alinea {
|
|
144
|
+
position: absolute;
|
|
145
|
+
left: 0;
|
|
146
|
+
top: 0.15em;
|
|
147
|
+
display: inline-flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
min-width: 1.5em;
|
|
151
|
+
height: 1.5em;
|
|
152
|
+
padding: 0 0.3em;
|
|
153
|
+
margin-right: 0.3em;
|
|
154
|
+
font-size: 0.75em;
|
|
155
|
+
font-weight: bold;
|
|
156
|
+
color: #555;
|
|
157
|
+
background-color: #f0f0f0;
|
|
158
|
+
border: 1px solid #ccc;
|
|
159
|
+
border-radius: 1em;
|
|
160
|
+
}
|
|
161
|
+
.num {
|
|
162
|
+
font-weight: bold;
|
|
163
|
+
margin-right: 0.2em;
|
|
164
|
+
}
|
|
165
|
+
.article {
|
|
166
|
+
margin-top: 2em;
|
|
167
|
+
}
|
|
168
|
+
.article h3 {
|
|
169
|
+
border-bottom: 1px solid #eee;
|
|
170
|
+
padding-bottom: 5px;
|
|
171
|
+
}
|
|
172
172
|
`;
|
|
173
|
-
const htmlDocTemplate = `<!DOCTYPE html>
|
|
174
|
-
<html lang="fr">
|
|
175
|
-
<head>
|
|
176
|
-
<meta charset="utf-8">
|
|
177
|
-
<title>${metadata.title || "Document Sénat"}</title>
|
|
178
|
-
<style>${style}</style>
|
|
179
|
-
</head>
|
|
180
|
-
<body>
|
|
181
|
-
<div class="header">
|
|
182
|
-
<div class="header-top">SÉNAT</div>
|
|
183
|
-
<div class="header-session">SESSION ORDINAIRE DE ${metadata.session || "...."}</div>
|
|
184
|
-
${metadata.date ? `<div class="header-date">Enregistré à la Présidence du Sénat le ${metadata.date}</div>` : ""}
|
|
185
|
-
<div class="header-number">N° ${metadata.number || "...."}</div>
|
|
186
|
-
<div class="header-type">${metadata.type || ""}</div>
|
|
187
|
-
<div class="header-authors">${metadata.authors || ""}</div>
|
|
173
|
+
const htmlDocTemplate = `<!DOCTYPE html>
|
|
174
|
+
<html lang="fr">
|
|
175
|
+
<head>
|
|
176
|
+
<meta charset="utf-8">
|
|
177
|
+
<title>${metadata.title || "Document Sénat"}</title>
|
|
178
|
+
<style>${style}</style>
|
|
179
|
+
</head>
|
|
180
|
+
<body>
|
|
181
|
+
<div class="header">
|
|
182
|
+
<div class="header-top">SÉNAT</div>
|
|
183
|
+
<div class="header-session">SESSION ORDINAIRE DE ${metadata.session || "...."}</div>
|
|
184
|
+
${metadata.date ? `<div class="header-date">Enregistré à la Présidence du Sénat le ${metadata.date}</div>` : ""}
|
|
185
|
+
<div class="header-number">N° ${metadata.number || "...."}</div>
|
|
186
|
+
<div class="header-type">${metadata.type || ""}</div>
|
|
187
|
+
<div class="header-authors">${metadata.authors || ""}</div>
|
|
188
188
|
${metadata.commission
|
|
189
189
|
? [
|
|
190
190
|
`<div class="header-commission">Envoyée à la ${metadata.commission.toLowerCase()},`,
|
|
191
191
|
"sous réserve de la constitution éventuelle d'une commission spéciale dans les conditions prévues",
|
|
192
192
|
"par le Règlement.</div>",
|
|
193
193
|
].join(" ")
|
|
194
|
-
: ""}
|
|
195
|
-
</div>
|
|
196
|
-
<h1>${metadata.title || ""}</h1>
|
|
197
|
-
</body>
|
|
194
|
+
: ""}
|
|
195
|
+
</div>
|
|
196
|
+
<h1>${metadata.title || ""}</h1>
|
|
197
|
+
</body>
|
|
198
198
|
</html>`;
|
|
199
199
|
const { document: htmlDoc } = new JSDOM(htmlDocTemplate).window;
|
|
200
200
|
const body = htmlDoc.body;
|
package/lib/src/server/debats.js
CHANGED
|
@@ -35,11 +35,11 @@ export async function* findAll() {
|
|
|
35
35
|
"intpjl.intfon as fonction_intervenant",
|
|
36
36
|
"intpjl.inturl as url",
|
|
37
37
|
"intpjl.intana as analyse",
|
|
38
|
-
sql `json_build_object(
|
|
39
|
-
'code', auteur.autcod,
|
|
40
|
-
'nom', auteur.nomuse,
|
|
41
|
-
'prenom', auteur.prenom,
|
|
42
|
-
'matricule', auteur.autmat
|
|
38
|
+
sql `json_build_object(
|
|
39
|
+
'code', auteur.autcod,
|
|
40
|
+
'nom', auteur.nomuse,
|
|
41
|
+
'prenom', auteur.prenom,
|
|
42
|
+
'matricule', auteur.autmat
|
|
43
43
|
)`.as("auteur"),
|
|
44
44
|
])
|
|
45
45
|
.whereRef("intpjl.secdiscle", "=", "secdis.secdiscle")
|
|
@@ -68,11 +68,11 @@ export async function* findAll() {
|
|
|
68
68
|
"intdivers.intfon as fonction_intervenant",
|
|
69
69
|
"intdivers.inturl as url",
|
|
70
70
|
"intdivers.intana as analyse",
|
|
71
|
-
sql `json_build_object(
|
|
72
|
-
'code', auteur.autcod,
|
|
73
|
-
'nom', auteur.nomuse,
|
|
74
|
-
'prenom', auteur.prenom,
|
|
75
|
-
'matricule', auteur.autmat
|
|
71
|
+
sql `json_build_object(
|
|
72
|
+
'code', auteur.autcod,
|
|
73
|
+
'nom', auteur.nomuse,
|
|
74
|
+
'prenom', auteur.prenom,
|
|
75
|
+
'matricule', auteur.autmat
|
|
76
76
|
)`.as("auteur"),
|
|
77
77
|
])
|
|
78
78
|
.whereRef("intdivers.secdiverscle", "=", "secdivers.secdiverscle")
|
|
@@ -14,18 +14,18 @@ export async function* findAllTextes() {
|
|
|
14
14
|
"loi.signet as signet_dossier",
|
|
15
15
|
"texte.texnum as numero",
|
|
16
16
|
"texte.orgcod as code_organisme",
|
|
17
|
-
sql `
|
|
18
|
-
case
|
|
19
|
-
when ${eb.ref("texte.texurl")} is not null then
|
|
20
|
-
regexp_replace(regexp_replace(trim(${eb.ref("texte.texurl")}), '#+$', ''), '^(.*/)?(.*?)(\\.html)?$', '\\2')
|
|
21
|
-
else null
|
|
22
|
-
end
|
|
17
|
+
sql `
|
|
18
|
+
case
|
|
19
|
+
when ${eb.ref("texte.texurl")} is not null then
|
|
20
|
+
regexp_replace(regexp_replace(trim(${eb.ref("texte.texurl")}), '#+$', ''), '^(.*/)?(.*?)(\\.html)?$', '\\2')
|
|
21
|
+
else null
|
|
22
|
+
end
|
|
23
23
|
`.as("id"),
|
|
24
|
-
sql `
|
|
25
|
-
case
|
|
26
|
-
when ${eb.ref("texte.typurl")} = 'I' then regexp_replace('https://www.senat.fr/leg/' || rtrim(${eb.ref("texte.texurl")}), '#+$', '')
|
|
27
|
-
else regexp_replace(rtrim(${eb.ref("texte.texurl")}), '#+$', '')
|
|
28
|
-
end
|
|
24
|
+
sql `
|
|
25
|
+
case
|
|
26
|
+
when ${eb.ref("texte.typurl")} = 'I' then regexp_replace('https://www.senat.fr/leg/' || rtrim(${eb.ref("texte.texurl")}), '#+$', '')
|
|
27
|
+
else regexp_replace(rtrim(${eb.ref("texte.texurl")}), '#+$', '')
|
|
28
|
+
end
|
|
29
29
|
`.as("url"),
|
|
30
30
|
sql `rtrim(${eb.ref("oritxt.oritxtlib")})`.as("origine"),
|
|
31
31
|
"oritxt.oriordre as ordre_origine",
|
|
@@ -75,18 +75,18 @@ export async function* findAllRapports() {
|
|
|
75
75
|
"loi.signet as signet_dossier",
|
|
76
76
|
"rap.rapnum as numero",
|
|
77
77
|
"raporg.orgcod as code_organisme",
|
|
78
|
-
sql `
|
|
79
|
-
case
|
|
80
|
-
when ${eb.ref("rap.rapurl")} is not null then
|
|
81
|
-
regexp_replace(regexp_replace(trim(${eb.ref("rap.rapurl")}), '#+$', ''), '^(.*/)?(.*?)(\\.html)?$', '\\2')
|
|
82
|
-
else null
|
|
83
|
-
end
|
|
78
|
+
sql `
|
|
79
|
+
case
|
|
80
|
+
when ${eb.ref("rap.rapurl")} is not null then
|
|
81
|
+
regexp_replace(regexp_replace(trim(${eb.ref("rap.rapurl")}), '#+$', ''), '^(.*/)?(.*?)(\\.html)?$', '\\2')
|
|
82
|
+
else null
|
|
83
|
+
end
|
|
84
84
|
`.as("id"),
|
|
85
|
-
sql `
|
|
86
|
-
case
|
|
87
|
-
when ${eb.ref("rap.typurl")} = 'I' then regexp_replace('https://www.senat.fr/rap/' || rtrim(${eb.ref("rap.rapurl")}), '#+$', '')
|
|
88
|
-
else regexp_replace(rtrim(${eb.ref("rap.rapurl")}), '#+$', '')
|
|
89
|
-
end
|
|
85
|
+
sql `
|
|
86
|
+
case
|
|
87
|
+
when ${eb.ref("rap.typurl")} = 'I' then regexp_replace('https://www.senat.fr/rap/' || rtrim(${eb.ref("rap.rapurl")}), '#+$', '')
|
|
88
|
+
else regexp_replace(rtrim(${eb.ref("rap.rapurl")}), '#+$', '')
|
|
89
|
+
end
|
|
90
90
|
`.as("url"),
|
|
91
91
|
sql `rtrim(${eb.ref("denrap.libdenrap")})`.as("type"),
|
|
92
92
|
sql `rtrim(rtrim(${eb.ref("rap.raptil")}))`.as("titre"),
|
package/lib/src/server/dosleg.js
CHANGED
|
@@ -39,13 +39,13 @@ export async function* findAllDossiers() {
|
|
|
39
39
|
sql `to_char(${eb.ref("loi.proaccoppdat")}, 'YYYY-MM-DD')`.as("date_opposition_procedure_acceleree"),
|
|
40
40
|
sql `to_char(${eb.ref("loi.retproaccdat")}, 'YYYY-MM-DD')`.as("date_retrait_procedure_acceleree"),
|
|
41
41
|
sql `to_char(${eb.ref("loi.date_loi")}, 'YYYY-MM-DD')`.as("date_promulgation"),
|
|
42
|
-
sql `
|
|
43
|
-
case
|
|
44
|
-
when ${eb.ref("loi.loititjo")} is not null
|
|
45
|
-
then rtrim(${eb.ref("typloi.typloiden")})
|
|
46
|
-
|| ' ' || rtrim(${eb.ref("loi.loititjo")})
|
|
47
|
-
else ''
|
|
48
|
-
end
|
|
42
|
+
sql `
|
|
43
|
+
case
|
|
44
|
+
when ${eb.ref("loi.loititjo")} is not null
|
|
45
|
+
then rtrim(${eb.ref("typloi.typloiden")})
|
|
46
|
+
|| ' ' || rtrim(${eb.ref("loi.loititjo")})
|
|
47
|
+
else ''
|
|
48
|
+
end
|
|
49
49
|
`.as("titre_JO"),
|
|
50
50
|
sql `to_char(${eb.ref("loi.loidatjo")}, 'YYYY-MM-DD')`.as("date_publication_JO"),
|
|
51
51
|
"loi.loinumjo as numero_JO",
|
|
@@ -121,20 +121,20 @@ export async function* findAllDossiers() {
|
|
|
121
121
|
.select((eb4) => [
|
|
122
122
|
"texte.texnum as numero",
|
|
123
123
|
"texte.orgcod as code_organisme",
|
|
124
|
-
sql `
|
|
125
|
-
case
|
|
126
|
-
when texte.texurl is not null then
|
|
127
|
-
regexp_replace(
|
|
128
|
-
regexp_replace(trim(texte.texurl), '#+$', ''),
|
|
129
|
-
'^(.*/)?(.*?)(\.html)?$', '\\2')
|
|
130
|
-
else null
|
|
131
|
-
end
|
|
124
|
+
sql `
|
|
125
|
+
case
|
|
126
|
+
when texte.texurl is not null then
|
|
127
|
+
regexp_replace(
|
|
128
|
+
regexp_replace(trim(texte.texurl), '#+$', ''),
|
|
129
|
+
'^(.*/)?(.*?)(\.html)?$', '\\2')
|
|
130
|
+
else null
|
|
131
|
+
end
|
|
132
132
|
`.as("id"),
|
|
133
|
-
sql `
|
|
134
|
-
case
|
|
135
|
-
when texte.typurl = 'I' then regexp_replace('https://www.senat.fr/leg/' || rtrim(texte.texurl), '#+$', '')
|
|
136
|
-
else regexp_replace(rtrim(texte.texurl), '#+$', '')
|
|
137
|
-
end
|
|
133
|
+
sql `
|
|
134
|
+
case
|
|
135
|
+
when texte.typurl = 'I' then regexp_replace('https://www.senat.fr/leg/' || rtrim(texte.texurl), '#+$', '')
|
|
136
|
+
else regexp_replace(rtrim(texte.texurl), '#+$', '')
|
|
137
|
+
end
|
|
138
138
|
`.as("url"),
|
|
139
139
|
sql `rtrim(oritxt.oritxtlib)`.as("origine"),
|
|
140
140
|
"oritxt.oriordre as ordre_origine",
|
|
@@ -186,20 +186,20 @@ export async function* findAllDossiers() {
|
|
|
186
186
|
.select((eb4) => [
|
|
187
187
|
"rap.rapnum as numero",
|
|
188
188
|
"raporg.orgcod as code_organisme",
|
|
189
|
-
sql `
|
|
190
|
-
case
|
|
191
|
-
when rap.rapurl is not null then
|
|
192
|
-
regexp_replace(
|
|
193
|
-
regexp_replace(trim(rap.rapurl), '#+$', ''),
|
|
194
|
-
'^(.*/)?(.*?)(\.html)?$', '\\2')
|
|
195
|
-
else null
|
|
196
|
-
end
|
|
189
|
+
sql `
|
|
190
|
+
case
|
|
191
|
+
when rap.rapurl is not null then
|
|
192
|
+
regexp_replace(
|
|
193
|
+
regexp_replace(trim(rap.rapurl), '#+$', ''),
|
|
194
|
+
'^(.*/)?(.*?)(\.html)?$', '\\2')
|
|
195
|
+
else null
|
|
196
|
+
end
|
|
197
197
|
`.as("id"),
|
|
198
|
-
sql `
|
|
199
|
-
case
|
|
200
|
-
when rap.typurl = 'I' then regexp_replace('https://www.senat.fr/rap/' || rtrim(rap.rapurl), '#+$', '')
|
|
201
|
-
else regexp_replace(rtrim(rap.rapurl), '#+$', '')
|
|
202
|
-
end
|
|
198
|
+
sql `
|
|
199
|
+
case
|
|
200
|
+
when rap.typurl = 'I' then regexp_replace('https://www.senat.fr/rap/' || rtrim(rap.rapurl), '#+$', '')
|
|
201
|
+
else regexp_replace(rtrim(rap.rapurl), '#+$', '')
|
|
202
|
+
end
|
|
203
203
|
`.as("url"),
|
|
204
204
|
sql `rtrim(denrap.libdenrap)`.as("type"),
|
|
205
205
|
sql `rtrim(rtrim(rap.raptil))`.as("titre"),
|
|
@@ -50,16 +50,16 @@ export async function* findAll() {
|
|
|
50
50
|
"etatquestion.etaquecod as etat_code",
|
|
51
51
|
sql `${eb.ref("etatquestion.etaquenumtri")}::text`.as("etat_tri"),
|
|
52
52
|
// Thèmes (extraits par regexp depuis la colonne themes)
|
|
53
|
-
sql `(
|
|
54
|
-
select coalesce(json_agg(theme_rows.libelle order by theme_rows.theme_order nulls last), '[]'::json)
|
|
55
|
-
from (
|
|
56
|
-
select
|
|
57
|
-
the.thelib as libelle,
|
|
58
|
-
the.thenouidt as theme_order
|
|
59
|
-
from regexp_matches(coalesce(${eb.ref("tam_questions.themes")}, ''), '#(\\d+)', 'g') as matches(match)
|
|
60
|
-
join senat.questions_the as the on the.thenouidt::text = matches.match[1]
|
|
61
|
-
order by the.thenouidt asc
|
|
62
|
-
) as theme_rows
|
|
53
|
+
sql `(
|
|
54
|
+
select coalesce(json_agg(theme_rows.libelle order by theme_rows.theme_order nulls last), '[]'::json)
|
|
55
|
+
from (
|
|
56
|
+
select
|
|
57
|
+
the.thelib as libelle,
|
|
58
|
+
the.thenouidt as theme_order
|
|
59
|
+
from regexp_matches(coalesce(${eb.ref("tam_questions.themes")}, ''), '#(\\d+)', 'g') as matches(match)
|
|
60
|
+
join senat.questions_the as the on the.thenouidt::text = matches.match[1]
|
|
61
|
+
order by the.thenouidt asc
|
|
62
|
+
) as theme_rows
|
|
63
63
|
)`.as("themes"),
|
|
64
64
|
// Réponses
|
|
65
65
|
jsonArrayFrom(eb
|
|
@@ -72,9 +72,9 @@ export async function* findAllScrutins(fromSession) {
|
|
|
72
72
|
"posvot.posvotlib",
|
|
73
73
|
"stavot.stavotlib",
|
|
74
74
|
"memgrppol.grppolcod",
|
|
75
|
-
sql `row_number() over (
|
|
76
|
-
partition by votsen.senmat, votsen.scrnum, votsen.sesann
|
|
77
|
-
order by memgrppol.memgrppoldatdeb desc nulls last
|
|
75
|
+
sql `row_number() over (
|
|
76
|
+
partition by votsen.senmat, votsen.scrnum, votsen.sesann
|
|
77
|
+
order by memgrppol.memgrppoldatdeb desc nulls last
|
|
78
78
|
)`.as("vote_rank"),
|
|
79
79
|
])
|
|
80
80
|
.whereRef("votsen.scrnum", "=", "scr.scrnum")
|
package/lib/src/server/sens.js
CHANGED
|
@@ -82,9 +82,9 @@ export async function* findAll() {
|
|
|
82
82
|
.select([
|
|
83
83
|
sql `to_char(fonmemcom.fonmemcomdatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
84
84
|
sql `to_char(fonmemcom.fonmemcomdatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
85
|
-
sql `coalesce(
|
|
86
|
-
nullif(trim(foncom.foncomlib), ''),
|
|
87
|
-
nullif(trim(foncom.foncomlil), ''),
|
|
85
|
+
sql `coalesce(
|
|
86
|
+
nullif(trim(foncom.foncomlib), ''),
|
|
87
|
+
nullif(trim(foncom.foncomlil), ''),
|
|
88
88
|
nullif(trim(foncom.foncomlic), ''))`.as("libelle"),
|
|
89
89
|
"fonmemcom.fonmemcomdatdeb as order_date",
|
|
90
90
|
])
|
|
@@ -117,9 +117,9 @@ export async function* findAll() {
|
|
|
117
117
|
.select([
|
|
118
118
|
sql `to_char(fonmemdelega.fonmemdeldatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
119
119
|
sql `to_char(fonmemdelega.fonmemdeldatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
120
|
-
sql `coalesce(
|
|
121
|
-
nullif(trim(fondelega.fondellib), ''),
|
|
122
|
-
nullif(trim(fondelega.fondellil), ''),
|
|
120
|
+
sql `coalesce(
|
|
121
|
+
nullif(trim(fondelega.fondellib), ''),
|
|
122
|
+
nullif(trim(fondelega.fondellil), ''),
|
|
123
123
|
nullif(trim(fondelega.fondellic), ''))`.as("libelle"),
|
|
124
124
|
"fonmemdelega.fonmemdeldatdeb as order_date",
|
|
125
125
|
])
|
|
@@ -152,9 +152,9 @@ export async function* findAll() {
|
|
|
152
152
|
.select([
|
|
153
153
|
sql `to_char(fonmemgrppol.fonmemgrppoldatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
154
154
|
sql `to_char(fonmemgrppol.fonmemgrppoldatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
155
|
-
sql `coalesce(
|
|
156
|
-
nullif(trim(fongrppol.fongrppollib), ''),
|
|
157
|
-
nullif(trim(fongrppol.fongrppollil), ''),
|
|
155
|
+
sql `coalesce(
|
|
156
|
+
nullif(trim(fongrppol.fongrppollib), ''),
|
|
157
|
+
nullif(trim(fongrppol.fongrppollil), ''),
|
|
158
158
|
nullif(trim(fongrppol.fongrppollic), ''))`.as("libelle"),
|
|
159
159
|
"fonmemgrppol.fonmemgrppoldatdeb as order_date",
|
|
160
160
|
])
|
|
@@ -186,9 +186,9 @@ export async function* findAll() {
|
|
|
186
186
|
.select([
|
|
187
187
|
sql `to_char(fonmemorg.fonmemorgdatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
188
188
|
sql `to_char(fonmemorg.fonmemorgdatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
189
|
-
sql `coalesce(
|
|
190
|
-
nullif(trim(fonorg.fonorglib), ''),
|
|
191
|
-
nullif(trim(fonorg.fonorglil), ''),
|
|
189
|
+
sql `coalesce(
|
|
190
|
+
nullif(trim(fonorg.fonorglib), ''),
|
|
191
|
+
nullif(trim(fonorg.fonorglil), ''),
|
|
192
192
|
nullif(trim(fonorg.fonorglic), ''))`.as("libelle"),
|
|
193
193
|
"fonmemorg.fonmemorgdatdeb as order_date",
|
|
194
194
|
])
|
|
@@ -237,9 +237,9 @@ export async function* findAll() {
|
|
|
237
237
|
.select([
|
|
238
238
|
sql `to_char(fonmemgrpsen.fonmemgrpsendatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
239
239
|
sql `to_char(fonmemgrpsen.fonmemgrpsendatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
240
|
-
sql `coalesce(
|
|
241
|
-
nullif(trim(fongrpsen.fongrpsenlib), ''),
|
|
242
|
-
nullif(trim(fongrpsen.fongrpsenlil), ''),
|
|
240
|
+
sql `coalesce(
|
|
241
|
+
nullif(trim(fongrpsen.fongrpsenlib), ''),
|
|
242
|
+
nullif(trim(fongrpsen.fongrpsenlil), ''),
|
|
243
243
|
nullif(trim(fongrpsen.fongrpsenlic), ''))`.as("libelle"),
|
|
244
244
|
"fonmemgrpsen.fonmemgrpsendatdeb as order_date",
|
|
245
245
|
])
|
|
@@ -255,10 +255,10 @@ export async function* findAll() {
|
|
|
255
255
|
.select([
|
|
256
256
|
sql `to_char(senbur.senburdatdeb, 'YYYY-MM-DD')`.as("date_debut"),
|
|
257
257
|
sql `to_char(senbur.senburdatfin, 'YYYY-MM-DD')`.as("date_fin"),
|
|
258
|
-
sql `coalesce(
|
|
259
|
-
nullif(btrim(bur.burlib), ''),
|
|
260
|
-
nullif(btrim(bur.burlil), ''),
|
|
261
|
-
nullif(btrim(bur.burlic), '')
|
|
258
|
+
sql `coalesce(
|
|
259
|
+
nullif(btrim(bur.burlib), ''),
|
|
260
|
+
nullif(btrim(bur.burlil), ''),
|
|
261
|
+
nullif(btrim(bur.burlic), '')
|
|
262
262
|
)`.as("libelle"),
|
|
263
263
|
"senbur.senburdatdeb as order_date",
|
|
264
264
|
])
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AgendaManifest, ManifestChanges } from "../other_types/manifest.js";
|
|
2
|
+
export declare function getManifestDir(transformedAgendaSessionDir: string): string;
|
|
3
|
+
export declare function getManifestPath(transformedAgendaSessionDir: string, date: string): string;
|
|
4
|
+
export declare function loadPreviousManifest(transformedAgendaSessionDir: string, date: string): AgendaManifest | null;
|
|
5
|
+
export declare function saveManifest(transformedAgendaSessionDir: string, manifest: AgendaManifest): void;
|
|
6
|
+
export declare function detectChanges(previousUids: string[], currentUids: string[]): ManifestChanges;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export function getManifestDir(transformedAgendaSessionDir) {
|
|
4
|
+
return path.join(transformedAgendaSessionDir, ".manifests");
|
|
5
|
+
}
|
|
6
|
+
export function getManifestPath(transformedAgendaSessionDir, date) {
|
|
7
|
+
const manifestDir = getManifestDir(transformedAgendaSessionDir);
|
|
8
|
+
return path.join(manifestDir, `${date}.manifest.json`);
|
|
9
|
+
}
|
|
10
|
+
export function loadPreviousManifest(transformedAgendaSessionDir, date) {
|
|
11
|
+
const manifestPath = getManifestPath(transformedAgendaSessionDir, date);
|
|
12
|
+
if (!fs.existsSync(manifestPath)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
return fs.readJSONSync(manifestPath);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.warn(`Failed to load manifest ${manifestPath}:`, error);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function saveManifest(transformedAgendaSessionDir, manifest) {
|
|
24
|
+
const manifestDir = getManifestDir(transformedAgendaSessionDir);
|
|
25
|
+
fs.ensureDirSync(manifestDir);
|
|
26
|
+
const manifestPath = getManifestPath(transformedAgendaSessionDir, manifest.date);
|
|
27
|
+
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
|
28
|
+
}
|
|
29
|
+
export function detectChanges(previousUids, currentUids) {
|
|
30
|
+
const prevSet = new Set(previousUids);
|
|
31
|
+
const currSet = new Set(currentUids);
|
|
32
|
+
return {
|
|
33
|
+
new: currentUids.filter((uid) => !prevSet.has(uid)),
|
|
34
|
+
deleted: previousUids.filter((uid) => !currSet.has(uid)),
|
|
35
|
+
kept: currentUids.filter((uid) => prevSet.has(uid)),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export function deleteReunionFile(transformedAgendaSessionDir, uid) {
|
|
4
|
+
const reunionPath = path.join(transformedAgendaSessionDir, `${uid}.json`);
|
|
5
|
+
if (!fs.existsSync(reunionPath)) {
|
|
6
|
+
console.warn(` ⚠ Reunion file not found: ${uid}`);
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
fs.removeSync(reunionPath);
|
|
11
|
+
console.log(` ✓ Deleted reunion file: ${uid}`);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(` ✗ Failed to delete reunion ${uid}:`, error);
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function deleteReunionFiles(transformedAgendaSessionDir, uids) {
|
|
20
|
+
let count = 0;
|
|
21
|
+
for (const uid of uids) {
|
|
22
|
+
if (deleteReunionFile(transformedAgendaSessionDir, uid)) {
|
|
23
|
+
count++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return count;
|
|
27
|
+
}
|