@tricoteuses/senat 2.22.16 → 2.23.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 +168 -0
- package/lib/aggregates.d.ts +52 -0
- package/lib/aggregates.js +930 -0
- package/lib/aggregates.mjs +713 -0
- package/lib/aggregates.ts +833 -0
- package/lib/config.d.ts +10 -0
- package/lib/config.js +16 -0
- package/lib/config.mjs +16 -0
- package/lib/config.ts +26 -0
- package/lib/databases.d.ts +2 -0
- package/lib/databases.js +26 -0
- package/lib/databases.mjs +57 -0
- package/lib/databases.ts +71 -0
- package/lib/datasets.d.ts +34 -0
- package/lib/datasets.js +233 -0
- package/lib/datasets.mjs +78 -0
- package/lib/datasets.ts +118 -0
- package/lib/fields.d.ts +10 -0
- package/lib/fields.js +68 -0
- package/lib/fields.mjs +22 -0
- package/lib/fields.ts +29 -0
- package/lib/git.d.ts +26 -0
- package/lib/git.js +167 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +1 -0
- package/lib/index.mjs +7 -0
- package/lib/index.ts +64 -0
- package/lib/inserters.d.ts +98 -0
- package/lib/inserters.js +500 -0
- package/lib/inserters.mjs +360 -0
- package/lib/inserters.ts +521 -0
- package/lib/legislatures.json +38 -0
- package/lib/loaders.d.ts +58 -0
- package/lib/loaders.js +286 -0
- package/lib/loaders.mjs +158 -0
- package/lib/loaders.ts +271 -0
- package/lib/model/agenda.d.ts +6 -0
- package/lib/model/agenda.js +148 -0
- package/lib/model/ameli.d.ts +51 -0
- package/lib/model/ameli.js +149 -0
- package/lib/model/ameli.mjs +84 -0
- package/lib/model/ameli.ts +100 -0
- package/lib/model/commission.d.ts +18 -0
- package/lib/model/commission.js +269 -0
- package/lib/model/debats.d.ts +67 -0
- package/lib/model/debats.js +95 -0
- package/lib/model/debats.mjs +43 -0
- package/lib/model/debats.ts +68 -0
- package/lib/model/documents.d.ts +12 -0
- package/lib/model/documents.js +151 -0
- package/lib/model/dosleg.d.ts +7 -0
- package/lib/model/dosleg.js +326 -0
- package/lib/model/dosleg.mjs +196 -0
- package/lib/model/dosleg.ts +240 -0
- package/lib/model/index.d.ts +7 -0
- package/lib/model/index.js +7 -0
- package/lib/model/index.mjs +5 -0
- package/lib/model/index.ts +15 -0
- package/lib/model/questions.d.ts +45 -0
- package/lib/model/questions.js +89 -0
- package/lib/model/questions.mjs +71 -0
- package/lib/model/questions.ts +93 -0
- package/lib/model/scrutins.d.ts +13 -0
- package/lib/model/scrutins.js +114 -0
- package/lib/model/seance.d.ts +3 -0
- package/lib/model/seance.js +267 -0
- package/lib/model/sens.d.ts +146 -0
- package/lib/model/sens.js +454 -0
- package/lib/model/sens.mjs +415 -0
- package/lib/model/sens.ts +516 -0
- package/lib/model/texte.d.ts +7 -0
- package/lib/model/texte.js +256 -0
- package/lib/model/texte.mjs +208 -0
- package/lib/model/texte.ts +229 -0
- package/lib/model/util.d.ts +9 -0
- package/lib/model/util.js +38 -0
- package/lib/model/util.mjs +19 -0
- package/lib/model/util.ts +32 -0
- package/lib/parsers/texte.d.ts +7 -0
- package/lib/parsers/texte.js +228 -0
- package/lib/raw_types/ameli.d.ts +914 -0
- package/lib/raw_types/ameli.js +5 -0
- package/lib/raw_types/ameli.mjs +163 -0
- package/lib/raw_types/debats.d.ts +207 -0
- package/lib/raw_types/debats.js +5 -0
- package/lib/raw_types/debats.mjs +58 -0
- package/lib/raw_types/dosleg.d.ts +1619 -0
- package/lib/raw_types/dosleg.js +5 -0
- package/lib/raw_types/dosleg.mjs +438 -0
- package/lib/raw_types/questions.d.ts +419 -0
- package/lib/raw_types/questions.js +5 -0
- package/lib/raw_types/questions.mjs +11 -0
- package/lib/raw_types/senat.d.ts +11368 -0
- package/lib/raw_types/senat.js +5 -0
- package/lib/raw_types/sens.d.ts +8248 -0
- package/lib/raw_types/sens.js +5 -0
- package/lib/raw_types/sens.mjs +508 -0
- package/lib/raw_types_kysely/ameli.d.ts +915 -0
- package/lib/raw_types_kysely/ameli.js +7 -0
- package/lib/raw_types_kysely/ameli.mjs +5 -0
- package/lib/raw_types_kysely/ameli.ts +951 -0
- package/lib/raw_types_kysely/debats.d.ts +207 -0
- package/lib/raw_types_kysely/debats.js +7 -0
- package/lib/raw_types_kysely/debats.mjs +5 -0
- package/lib/raw_types_kysely/debats.ts +222 -0
- package/lib/raw_types_kysely/dosleg.d.ts +3532 -0
- package/lib/raw_types_kysely/dosleg.js +7 -0
- package/lib/raw_types_kysely/dosleg.mjs +5 -0
- package/lib/raw_types_kysely/dosleg.ts +3621 -0
- package/lib/raw_types_kysely/questions.d.ts +414 -0
- package/lib/raw_types_kysely/questions.js +7 -0
- package/lib/raw_types_kysely/questions.mjs +5 -0
- package/lib/raw_types_kysely/questions.ts +426 -0
- package/lib/raw_types_kysely/sens.d.ts +4394 -0
- package/lib/raw_types_kysely/sens.js +7 -0
- package/lib/raw_types_kysely/sens.mjs +5 -0
- package/lib/raw_types_kysely/sens.ts +4499 -0
- package/lib/raw_types_schemats/ameli.d.ts +539 -0
- package/lib/raw_types_schemats/ameli.js +2 -0
- package/lib/raw_types_schemats/ameli.mjs +2 -0
- package/lib/raw_types_schemats/ameli.ts +601 -0
- package/lib/raw_types_schemats/debats.d.ts +127 -0
- package/lib/raw_types_schemats/debats.js +2 -0
- package/lib/raw_types_schemats/debats.mjs +2 -0
- package/lib/raw_types_schemats/debats.ts +145 -0
- package/lib/raw_types_schemats/dosleg.d.ts +977 -0
- package/lib/raw_types_schemats/dosleg.js +2 -0
- package/lib/raw_types_schemats/dosleg.mjs +2 -0
- package/lib/raw_types_schemats/dosleg.ts +2193 -0
- package/lib/raw_types_schemats/questions.d.ts +235 -0
- package/lib/raw_types_schemats/questions.js +2 -0
- package/lib/raw_types_schemats/questions.mjs +2 -0
- package/lib/raw_types_schemats/questions.ts +249 -0
- package/lib/raw_types_schemats/sens.d.ts +6915 -0
- package/lib/raw_types_schemats/sens.js +2 -0
- package/lib/raw_types_schemats/sens.mjs +2 -0
- package/lib/raw_types_schemats/sens.ts +2907 -0
- package/lib/scripts/convert_data.d.ts +1 -0
- package/lib/scripts/convert_data.js +354 -0
- package/lib/scripts/convert_data.mjs +181 -0
- package/lib/scripts/convert_data.ts +243 -0
- package/lib/scripts/data-download.d.ts +1 -0
- package/lib/scripts/data-download.js +12 -0
- package/lib/scripts/datautil.d.ts +8 -0
- package/lib/scripts/datautil.js +34 -0
- package/lib/scripts/datautil.mjs +16 -0
- package/lib/scripts/datautil.ts +19 -0
- package/lib/scripts/images/transparent_150x192.jpg +0 -0
- package/lib/scripts/images/transparent_155x225.jpg +0 -0
- package/lib/scripts/parse_textes.d.ts +1 -0
- package/lib/scripts/parse_textes.js +44 -0
- package/lib/scripts/parse_textes.mjs +46 -0
- package/lib/scripts/parse_textes.ts +65 -0
- package/lib/scripts/retrieve_agenda.d.ts +1 -0
- package/lib/scripts/retrieve_agenda.js +132 -0
- package/lib/scripts/retrieve_cr_commission.d.ts +1 -0
- package/lib/scripts/retrieve_cr_commission.js +364 -0
- package/lib/scripts/retrieve_cr_seance.d.ts +6 -0
- package/lib/scripts/retrieve_cr_seance.js +347 -0
- package/lib/scripts/retrieve_documents.d.ts +3 -0
- package/lib/scripts/retrieve_documents.js +219 -0
- package/lib/scripts/retrieve_documents.mjs +249 -0
- package/lib/scripts/retrieve_documents.ts +298 -0
- package/lib/scripts/retrieve_open_data.d.ts +1 -0
- package/lib/scripts/retrieve_open_data.js +315 -0
- package/lib/scripts/retrieve_open_data.mjs +217 -0
- package/lib/scripts/retrieve_open_data.ts +268 -0
- package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
- package/lib/scripts/retrieve_senateurs_photos.js +147 -0
- package/lib/scripts/retrieve_senateurs_photos.mjs +147 -0
- package/lib/scripts/retrieve_senateurs_photos.ts +177 -0
- package/lib/scripts/retrieve_videos.d.ts +1 -0
- package/lib/scripts/retrieve_videos.js +461 -0
- package/lib/scripts/shared/cli_helpers.d.ts +95 -0
- package/lib/scripts/shared/cli_helpers.js +91 -0
- package/lib/scripts/shared/cli_helpers.ts +36 -0
- package/lib/scripts/shared/util.d.ts +4 -0
- package/lib/scripts/shared/util.js +35 -0
- package/lib/scripts/shared/util.ts +33 -0
- package/lib/scripts/test_iter_load.d.ts +1 -0
- package/lib/scripts/test_iter_load.js +12 -0
- package/lib/src/config.d.ts +22 -0
- package/lib/src/config.js +17 -7
- package/lib/src/conversion_textes.js +5 -1
- package/lib/src/databases.d.ts +2 -1
- package/lib/src/databases_postgres.d.ts +4 -0
- package/lib/src/databases_postgres.js +23 -0
- package/lib/src/datasets.d.ts +4 -0
- package/lib/src/datasets.js +16 -2
- package/lib/src/git.d.ts +1 -0
- package/lib/src/git.js +45 -11
- package/lib/src/loaders.js +10 -4
- package/lib/src/model/agenda.js +2 -2
- package/lib/src/model/ameli.d.ts +64 -52
- package/lib/src/model/ameli.js +147 -145
- package/lib/src/model/ameli_postgres.d.ts +67 -0
- package/lib/src/model/ameli_postgres.js +150 -0
- package/lib/src/model/commission.d.ts +3 -2
- package/lib/src/model/commission.js +2 -2
- package/lib/src/model/debats.d.ts +38 -66
- package/lib/src/model/debats.js +110 -93
- package/lib/src/model/documents.d.ts +32 -12
- package/lib/src/model/documents.js +171 -130
- package/lib/src/model/dosleg.d.ts +142 -5
- package/lib/src/model/dosleg.js +298 -156
- package/lib/src/model/questions.d.ts +54 -45
- package/lib/src/model/questions.js +89 -87
- package/lib/src/model/scrutins.d.ts +48 -13
- package/lib/src/model/scrutins.js +118 -111
- package/lib/src/model/seance.js +3 -3
- package/lib/src/model/sens.d.ts +109 -179
- package/lib/src/model/sens.js +384 -484
- package/lib/src/model/util.d.ts +0 -8
- package/lib/src/model/util.js +0 -23
- package/lib/src/parsers/texte.js +7 -7
- package/lib/src/raw_types_schemats/ameli.d.ts +4 -2
- package/lib/src/raw_types_schemats/debats.d.ts +2 -2
- package/lib/src/raw_types_schemats/dosleg.d.ts +2 -2
- package/lib/src/raw_types_schemats/questions.d.ts +2 -2
- package/lib/src/raw_types_schemats/sens.d.ts +10 -4216
- package/lib/src/scripts/convert_data.js +7 -6
- package/lib/src/scripts/convert_xml_to_html.js +2 -2
- package/lib/src/scripts/data-download.js +3 -2
- package/lib/src/scripts/retrieve_agenda.js +21 -9
- package/lib/src/scripts/retrieve_cr_commission.js +17 -17
- package/lib/src/scripts/retrieve_cr_seance.d.ts +14 -1
- package/lib/src/scripts/retrieve_cr_seance.js +10 -11
- package/lib/src/scripts/retrieve_documents.d.ts +11 -2
- package/lib/src/scripts/retrieve_documents.js +25 -14
- package/lib/src/scripts/retrieve_open_data.js +400 -145
- package/lib/src/scripts/retrieve_senateurs_photos.js +25 -11
- package/lib/src/scripts/retrieve_videos.js +12 -11
- package/lib/src/scripts/shared/cli_helpers.d.ts +1 -6
- package/lib/src/scripts/shared/cli_helpers.js +9 -8
- package/lib/src/scripts/shared/incremental_import_sql.d.ts +2 -0
- package/lib/src/scripts/shared/incremental_import_sql.js +894 -0
- package/lib/src/scripts/shared/prefixed_tables.d.ts +7 -0
- package/lib/src/scripts/shared/prefixed_tables.js +30 -0
- package/lib/src/scripts/shared/schema_version.d.ts +3 -0
- package/lib/src/scripts/shared/schema_version.js +97 -0
- package/lib/src/scripts/shared/staging_import.d.ts +3 -0
- package/lib/src/scripts/shared/staging_import.js +80 -0
- package/lib/src/scripts/shared/staging_metadata_sql.d.ts +1 -0
- package/lib/src/scripts/shared/staging_metadata_sql.js +221 -0
- package/lib/src/scripts/validate_prefixed_tables.d.ts +1 -0
- package/lib/src/scripts/validate_prefixed_tables.js +102 -0
- package/lib/src/types/texte.d.ts +1 -1
- package/lib/src/utils/cr_spliting.d.ts +9 -6
- package/lib/src/utils/cr_spliting.js +6 -101
- package/lib/src/utils/reunion_odj_building.d.ts +7 -3
- package/lib/src/utils/reunion_parsing.d.ts +2 -1
- package/lib/src/utils/reunion_parsing.js +2 -2
- package/lib/src/videos/match.js +8 -5
- package/lib/src/videos/pipeline.d.ts +6 -2
- package/lib/src/videos/pipeline.js +21 -8
- package/lib/src/videos/search.js +6 -2
- package/lib/strings.d.ts +1 -0
- package/lib/strings.js +18 -0
- package/lib/strings.mjs +18 -0
- package/lib/strings.ts +26 -0
- package/lib/tests/incrementalImportSql.test.d.ts +1 -0
- package/lib/tests/incrementalImportSql.test.js +155 -0
- package/lib/tests/prefixedTables.test.d.ts +1 -0
- package/lib/tests/prefixedTables.test.js +29 -0
- package/lib/tests/schemaVersion.test.d.ts +1 -0
- package/lib/tests/schemaVersion.test.js +23 -0
- package/lib/tests/validatePrefixedTables.test.d.ts +1 -0
- package/lib/tests/validatePrefixedTables.test.js +14 -0
- package/lib/types/agenda.d.ts +44 -0
- package/lib/types/agenda.js +1 -0
- package/lib/types/ameli.d.ts +5 -0
- package/lib/types/ameli.js +1 -0
- package/lib/types/ameli.mjs +13 -0
- package/lib/types/ameli.ts +21 -0
- package/lib/types/compte_rendu.d.ts +83 -0
- package/lib/types/compte_rendu.js +1 -0
- package/lib/types/debats.d.ts +2 -0
- package/lib/types/debats.js +1 -0
- package/lib/types/debats.mjs +2 -0
- package/lib/types/debats.ts +6 -0
- package/lib/types/dosleg.d.ts +70 -0
- package/lib/types/dosleg.js +1 -0
- package/lib/types/dosleg.mjs +151 -0
- package/lib/types/dosleg.ts +284 -0
- package/lib/types/questions.d.ts +2 -0
- package/lib/types/questions.js +1 -0
- package/lib/types/questions.mjs +1 -0
- package/lib/types/questions.ts +3 -0
- package/lib/types/sens.d.ts +10 -0
- package/lib/types/sens.js +1 -0
- package/lib/types/sens.mjs +1 -0
- package/lib/types/sens.ts +12 -0
- package/lib/types/sessions.d.ts +5 -0
- package/lib/types/sessions.js +84 -0
- package/lib/types/sessions.mjs +43 -0
- package/lib/types/sessions.ts +42 -0
- package/lib/types/texte.d.ts +74 -0
- package/lib/types/texte.js +16 -0
- package/lib/types/texte.mjs +16 -0
- package/lib/types/texte.ts +76 -0
- package/lib/typings/windows-1252.d.js +2 -0
- package/lib/typings/windows-1252.d.mjs +2 -0
- package/lib/typings/windows-1252.d.ts +11 -0
- package/lib/utils/cr_spliting.d.ts +28 -0
- package/lib/utils/cr_spliting.js +265 -0
- package/lib/utils/date.d.ts +10 -0
- package/lib/utils/date.js +100 -0
- package/lib/utils/nvs-timecode.d.ts +7 -0
- package/lib/utils/nvs-timecode.js +79 -0
- package/lib/utils/reunion_grouping.d.ts +9 -0
- package/lib/utils/reunion_grouping.js +361 -0
- package/lib/utils/reunion_odj_building.d.ts +5 -0
- package/lib/utils/reunion_odj_building.js +154 -0
- package/lib/utils/reunion_parsing.d.ts +23 -0
- package/lib/utils/reunion_parsing.js +209 -0
- package/lib/utils/scoring.d.ts +14 -0
- package/lib/utils/scoring.js +147 -0
- package/lib/utils/string_cleaning.d.ts +7 -0
- package/lib/utils/string_cleaning.js +57 -0
- package/lib/validators/config.d.ts +9 -0
- package/lib/validators/config.js +10 -0
- package/lib/validators/config.mjs +54 -0
- package/lib/validators/config.ts +79 -0
- package/lib/validators/senat.d.ts +0 -0
- package/lib/validators/senat.js +28 -0
- package/lib/validators/senat.mjs +24 -0
- package/lib/validators/senat.ts +26 -0
- package/package.json +6 -10
package/lib/src/model/ameli.d.ts
CHANGED
|
@@ -1,55 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export interface AmendementAuteurRow {
|
|
2
|
+
group_politique_code: string | null;
|
|
3
|
+
groupe_politique_id: number | null;
|
|
4
|
+
groupe_politique_libelle: string | null;
|
|
5
|
+
groupe_politique_libelle_court: string | null;
|
|
6
|
+
homonyme: string | null;
|
|
7
|
+
matricule: string | null;
|
|
8
|
+
nom: string | null;
|
|
9
|
+
prenom: string | null;
|
|
10
|
+
qualite: string | null;
|
|
11
|
+
rang: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface AmendementResult {
|
|
14
|
+
accepte_gouvernement: string | null;
|
|
15
|
+
alinea: number | null;
|
|
16
16
|
auteur_est_gouvernement: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
group_politique_code: any;
|
|
27
|
-
groupe_politique_libelle_court: any;
|
|
28
|
-
groupe_politique_libelle: any;
|
|
29
|
-
}[];
|
|
30
|
-
}>;
|
|
31
|
-
export declare function findAllAmendements(fromSession?: number): AsyncIterableIterator<{
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
nature: string;
|
|
34
|
-
date_depot: string;
|
|
17
|
+
au_nom_de_commission: string | null;
|
|
18
|
+
au_nom_de_groupe_politique: string | null;
|
|
19
|
+
auteurs: AmendementAuteurRow[];
|
|
20
|
+
avis_commission: string | null;
|
|
21
|
+
avis_gouvernement: string | null;
|
|
22
|
+
code_commission: string | null;
|
|
23
|
+
date_depot: string | null;
|
|
24
|
+
discussion_commune_id: number | null;
|
|
25
|
+
dispositif: string | null;
|
|
35
26
|
etat: string;
|
|
36
|
-
|
|
27
|
+
etat_texte: string | null;
|
|
28
|
+
etat_texte_libelle: string | null;
|
|
29
|
+
id: number;
|
|
30
|
+
identique_id: number | null;
|
|
31
|
+
intitule_texte: string | null;
|
|
32
|
+
lecture: string | null;
|
|
33
|
+
motion_libelle: string | null;
|
|
34
|
+
nature: string;
|
|
35
|
+
nature_texte: string | null;
|
|
36
|
+
nature_texte_libelle: string | null;
|
|
37
|
+
numero: string;
|
|
38
|
+
numero_absolu: string | null;
|
|
39
|
+
numero_adoption_texte: string | null;
|
|
40
|
+
numero_texte: string | null;
|
|
41
|
+
objet: string | null;
|
|
42
|
+
observations: string | null;
|
|
43
|
+
observations_additionnelles: string | null;
|
|
44
|
+
ordre: number | null;
|
|
45
|
+
parent_id: number | null;
|
|
46
|
+
revision: string | null;
|
|
47
|
+
session: string;
|
|
48
|
+
session_libelle: string;
|
|
49
|
+
signet_dossier_legislatif: string | null;
|
|
50
|
+
sort: string | null;
|
|
51
|
+
scrutin_num: string | null;
|
|
52
|
+
subdivision_commission_id: number | null;
|
|
53
|
+
subdivision_dupliquee: string | null;
|
|
54
|
+
subdivision_libelle: string | null;
|
|
55
|
+
subdivision_libelle_court: string | null;
|
|
56
|
+
subdivision_mere_id: number | null;
|
|
57
|
+
subdivision_position_discussion: number | null;
|
|
58
|
+
subdivision_position_texte: number | null;
|
|
59
|
+
subdivision_signet: string | null;
|
|
60
|
+
subdivision_type: string | null;
|
|
61
|
+
texte_id: number | null;
|
|
62
|
+
type_rectification: string | null;
|
|
63
|
+
type_session: string | null;
|
|
64
|
+
type_texte: string | null;
|
|
37
65
|
url: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
auteur_est_gouvernement: boolean;
|
|
41
|
-
scrutin_num: any;
|
|
42
|
-
auteurs: {
|
|
43
|
-
prenom: any;
|
|
44
|
-
homonyme: any;
|
|
45
|
-
nom: any;
|
|
46
|
-
qualite: any;
|
|
47
|
-
rang: any;
|
|
48
|
-
matricule: any;
|
|
49
|
-
groupe_politique_id: any;
|
|
50
|
-
group_politique_code: any;
|
|
51
|
-
groupe_politique_libelle_court: any;
|
|
52
|
-
groupe_politique_libelle: any;
|
|
53
|
-
}[];
|
|
54
|
-
}>;
|
|
55
|
-
export {};
|
|
66
|
+
}
|
|
67
|
+
export declare function findAllAmendements(fromSession?: number): AsyncGenerator<AmendementResult, void, unknown>;
|
package/lib/src/model/ameli.js
CHANGED
|
@@ -1,148 +1,150 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function auteurs(amendementId) {
|
|
6
|
-
return jsonArrayFrom(dbSenat
|
|
7
|
-
.selectFrom("ameli.amdsen")
|
|
8
|
-
.leftJoin("ameli.sen_ameli", "ameli.amdsen.senid", "ameli.sen_ameli.entid")
|
|
9
|
-
.leftJoin("ameli.grppol_ameli", "ameli.amdsen.grpid", "ameli.grppol_ameli.entid")
|
|
10
|
-
.where("ameli.amdsen.amdid", "=", amendementId)
|
|
11
|
-
.select([
|
|
12
|
-
"ameli.amdsen.prenomuse as prenom",
|
|
13
|
-
"ameli.amdsen.hom as homonyme",
|
|
14
|
-
"ameli.amdsen.nomuse as nom",
|
|
15
|
-
"ameli.amdsen.qua as qualite",
|
|
16
|
-
"ameli.amdsen.rng as rang",
|
|
17
|
-
"ameli.sen_ameli.mat as matricule",
|
|
18
|
-
"ameli.amdsen.grpid as groupe_politique_id",
|
|
19
|
-
"ameli.grppol_ameli.cod as group_politique_code",
|
|
20
|
-
"ameli.grppol_ameli.libcou as groupe_politique_libelle_court",
|
|
21
|
-
"ameli.grppol_ameli.lilcou as groupe_politique_libelle",
|
|
22
|
-
])
|
|
23
|
-
.orderBy("ameli.amdsen.rng", "asc"));
|
|
24
|
-
}
|
|
25
|
-
function scrutin(amendementNum, sesann, lecassidt) {
|
|
26
|
-
return dbSenat
|
|
27
|
-
.selectFrom("dosleg.amescr")
|
|
28
|
-
.leftJoin("dosleg.scr", (join) => join
|
|
29
|
-
.onRef("dosleg.amescr.scrnum", "=", "dosleg.scr.scrnum")
|
|
30
|
-
.onRef("dosleg.amescr.sesann", "=", "dosleg.scr.sesann"))
|
|
31
|
-
.leftJoin("dosleg.date_seance", "dosleg.scr.code", "dosleg.date_seance.code")
|
|
32
|
-
.where("dosleg.amescr.amescrnum", "=", amendementNum)
|
|
33
|
-
.where("dosleg.amescr.sesann", "=", sesann)
|
|
34
|
-
.where("dosleg.date_seance.lecidt", "=", lecassidt)
|
|
35
|
-
.select(["dosleg.amescr.scrnum as scrutin_num"])
|
|
36
|
-
.limit(1)
|
|
37
|
-
.as("scrutin_num");
|
|
38
|
-
}
|
|
39
|
-
const findAllAmendementsQuery = dbSenat
|
|
40
|
-
.selectFrom("ameli.amd")
|
|
41
|
-
.leftJoin("ameli.sub", "ameli.amd.subid", "ameli.sub.id")
|
|
42
|
-
.leftJoin("ameli.typsub", "ameli.sub.typid", "ameli.typsub.id")
|
|
43
|
-
.leftJoin("ameli.typrect", "ameli.amd.typrectid", "ameli.typrect.id")
|
|
44
|
-
.leftJoin("ameli.txt_ameli", "ameli.amd.txtid", "ameli.txt_ameli.id")
|
|
45
|
-
.leftJoin("ameli.etatxt", "ameli.txt_ameli.txtetaid", "ameli.etatxt.id")
|
|
46
|
-
.leftJoin("ameli.ses", "ameli.txt_ameli.sesdepid", "ameli.ses.id")
|
|
47
|
-
.leftJoin("ameli.typses", "ameli.typses.id", "ameli.ses.typid")
|
|
48
|
-
.leftJoin("ameli.nat", "ameli.txt_ameli.natid", "ameli.nat.id")
|
|
49
|
-
.leftJoin("ameli.lec_ameli", "ameli.txt_ameli.lecid", "ameli.lec_ameli.id")
|
|
50
|
-
.leftJoin("dosleg.texte", (join) => join.onRef("ameli.ses.ann", "=", "dosleg.texte.sesann").onRef("ameli.txt_ameli.numabs", "=", "dosleg.texte.texnum"))
|
|
51
|
-
.leftJoin("dosleg.lecass", "dosleg.texte.lecassidt", "dosleg.lecass.lecassidt")
|
|
52
|
-
.leftJoin("ameli.mot", "ameli.amd.motid", "ameli.mot.id")
|
|
53
|
-
.leftJoin("ameli.avicom", "ameli.amd.avcid", "ameli.avicom.id")
|
|
54
|
-
.leftJoin("ameli.avigvt", "ameli.amd.avgid", "ameli.avigvt.id")
|
|
55
|
-
.leftJoin("ameli.sor", "ameli.amd.sorid", "ameli.sor.id")
|
|
56
|
-
.leftJoin("ameli.irr", "ameli.amd.irrid", "ameli.irr.id")
|
|
57
|
-
.leftJoin("ameli.grppol_ameli", "ameli.amd.nomentid", "ameli.grppol_ameli.entid")
|
|
58
|
-
.leftJoin("ameli.com_ameli", "ameli.amd.nomentid", "ameli.com_ameli.entid")
|
|
59
|
-
.leftJoin("ameli.cab", "ameli.amd.nomentid", "ameli.cab.entid")
|
|
60
|
-
.select(({ eb, ref, val }) => [
|
|
61
|
-
"ameli.ses.ann as session",
|
|
62
|
-
"ameli.ses.lil as session_libelle",
|
|
63
|
-
"ameli.typses.lib as type_session",
|
|
64
|
-
"ameli.txt_ameli.doslegsignet as signet_dossier_legislatif",
|
|
65
|
-
"ameli.nat.libcourt as nature_texte",
|
|
66
|
-
"ameli.nat.lib as nature_texte_libelle",
|
|
67
|
-
"ameli.txt_ameli.numabs as numero_texte",
|
|
68
|
-
"ameli.txt_ameli.numado as numero_adoption_texte",
|
|
69
|
-
"ameli.txt_ameli.int as intitule_texte",
|
|
70
|
-
"ameli.etatxt.lic as etat_texte",
|
|
71
|
-
"ameli.etatxt.lib as etat_texte_libelle",
|
|
72
|
-
"ameli.etatxt.txttyp as type_texte",
|
|
73
|
-
"ameli.lec_ameli.lib as lecture",
|
|
74
|
-
eb
|
|
75
|
-
.case()
|
|
76
|
-
.when("ameli.amd.typ", "=", "A")
|
|
77
|
-
.then(val("Amendement"))
|
|
78
|
-
.when("ameli.amd.typ", "=", "M")
|
|
79
|
-
.then(val("Motion"))
|
|
80
|
-
.when("ameli.amd.typ", "=", "S")
|
|
81
|
-
.then(val("Sous-amendement"))
|
|
82
|
-
.else("")
|
|
83
|
-
.end()
|
|
84
|
-
.as("nature"),
|
|
85
|
-
"ameli.amd.id as id",
|
|
86
|
-
"ameli.amd.amdperid as parent_id",
|
|
87
|
-
"ameli.amd.ideid as identique_id",
|
|
88
|
-
"ameli.amd.discomid as discussion_commune_id",
|
|
89
|
-
"ameli.amd.num as numero",
|
|
90
|
-
"ameli.amd.numabs as numero_absolu",
|
|
91
|
-
"ameli.amd.ord as ordre",
|
|
92
|
-
"ameli.amd.accgou as accepte_gouvernement",
|
|
93
|
-
"ameli.amd.txtid as texte_id",
|
|
94
|
-
"ameli.sub.lib as subdivision_libelle",
|
|
95
|
-
"ameli.sub.lic as subdivision_libelle_court",
|
|
96
|
-
"ameli.sub.pos as subdivision_position_texte",
|
|
97
|
-
"ameli.sub.posder as subdivision_position_discussion",
|
|
98
|
-
"ameli.sub.merid as subdivision_mere_id",
|
|
99
|
-
"ameli.sub.sig as subdivision_signet",
|
|
100
|
-
"ameli.sub.comdelid as subdivision_commission_id",
|
|
101
|
-
"ameli.sub.dupl as subdivision_dupliquee",
|
|
102
|
-
"ameli.typsub.lib as subdivision_type",
|
|
103
|
-
"ameli.amd.alinea as alinea",
|
|
104
|
-
"ameli.amd.obs as observations",
|
|
105
|
-
"ameli.amd.mot as observations_additionnelles",
|
|
106
|
-
toDateString(ref("ameli.amd.datdep")).as("date_depot"),
|
|
107
|
-
"ameli.amd.dis as dispositif",
|
|
108
|
-
"ameli.amd.obj as objet",
|
|
109
|
-
"ameli.typrect.lib as type_rectification",
|
|
110
|
-
"ameli.mot.lib as motion_libelle",
|
|
111
|
-
eb
|
|
112
|
-
.case()
|
|
113
|
-
.when("ameli.amd.etaid", "=", 7)
|
|
114
|
-
.then(val("Diffusé"))
|
|
115
|
-
.when("ameli.amd.etaid", "=", 8)
|
|
116
|
-
.then(val("Retiré avant réunion ou séance"))
|
|
117
|
-
.when("ameli.amd.etaid", "=", 9)
|
|
118
|
-
.then(val("Examiné en commission ou séance"))
|
|
119
|
-
.when("ameli.amd.etaid", "=", 10)
|
|
120
|
-
.then(val("Irrecevable"))
|
|
121
|
-
.when("ameli.amd.etaid", "=", 11)
|
|
122
|
-
.then(val("Irrecevable"))
|
|
123
|
-
.else("")
|
|
124
|
-
.end()
|
|
125
|
-
.as("etat"),
|
|
126
|
-
"ameli.avicom.lib as avis_commission",
|
|
127
|
-
"ameli.avigvt.lib as avis_gouvernement",
|
|
128
|
-
eb.fn.coalesce("ameli.sor.lib", "ameli.irr.libirr").as("sort"),
|
|
129
|
-
"ameli.amd.rev as revision",
|
|
130
|
-
concat(eb
|
|
131
|
-
.case()
|
|
132
|
-
.when("ameli.amd.num", "like", "%COM%")
|
|
133
|
-
.then(val("https://www.senat.fr/amendements/commissions/"))
|
|
134
|
-
.else(val("https://www.senat.fr/amendements/"))
|
|
135
|
-
.end(), ref("ameli.ses.ann"), val("-"), sql `(ameli.ses.ann + 1)`, val("/"), ref("ameli.txt_ameli.numabs"), val("/Amdt_"), ref("ameli.amd.num"), val(".html")).as("url"),
|
|
136
|
-
"ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
137
|
-
rtrim(ref("ameli.com_ameli.lil")).as("au_nom_de_commission"),
|
|
138
|
-
rtrim(ref("ameli.com_ameli.cod")).as("code_commission"),
|
|
139
|
-
eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
|
|
140
|
-
scrutin(ref("ameli.amd.num"), ref("ameli.ses.ann"), ref("dosleg.texte.lecassidt")),
|
|
141
|
-
auteurs(ref("ameli.amd.id")).as("auteurs"),
|
|
142
|
-
]);
|
|
143
|
-
export function findAllAmendements(fromSession) {
|
|
1
|
+
import { streamUnsafeQuery } from "../databases_postgres";
|
|
2
|
+
function buildFindAllAmendementsQuery(fromSession) {
|
|
3
|
+
const params = [];
|
|
4
|
+
const whereSession = fromSession === undefined ? "" : "where ses.ann >= $1";
|
|
144
5
|
if (fromSession !== undefined) {
|
|
145
|
-
|
|
6
|
+
params.push(fromSession);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
params,
|
|
10
|
+
query: `
|
|
11
|
+
select
|
|
12
|
+
ses.ann::text as session,
|
|
13
|
+
ses.lil as session_libelle,
|
|
14
|
+
typses.lib as type_session,
|
|
15
|
+
txt_ameli.doslegsignet as signet_dossier_legislatif,
|
|
16
|
+
nat.libcourt as nature_texte,
|
|
17
|
+
nat.lib as nature_texte_libelle,
|
|
18
|
+
txt_ameli.numabs as numero_texte,
|
|
19
|
+
txt_ameli.numado as numero_adoption_texte,
|
|
20
|
+
txt_ameli.int as intitule_texte,
|
|
21
|
+
etatxt.lic as etat_texte,
|
|
22
|
+
etatxt.lib as etat_texte_libelle,
|
|
23
|
+
etatxt.txttyp as type_texte,
|
|
24
|
+
lec_ameli.lib as lecture,
|
|
25
|
+
case amd.typ
|
|
26
|
+
when 'A' then 'Amendement'
|
|
27
|
+
when 'M' then 'Motion'
|
|
28
|
+
when 'S' then 'Sous-amendement'
|
|
29
|
+
else ''
|
|
30
|
+
end as nature,
|
|
31
|
+
amd.id,
|
|
32
|
+
amd.amdperid as parent_id,
|
|
33
|
+
amd.ideid as identique_id,
|
|
34
|
+
amd.discomid as discussion_commune_id,
|
|
35
|
+
amd.num as numero,
|
|
36
|
+
amd.numabs as numero_absolu,
|
|
37
|
+
amd.ord as ordre,
|
|
38
|
+
amd.accgou as accepte_gouvernement,
|
|
39
|
+
amd.txtid as texte_id,
|
|
40
|
+
sub.lib as subdivision_libelle,
|
|
41
|
+
sub.lic as subdivision_libelle_court,
|
|
42
|
+
sub.pos as subdivision_position_texte,
|
|
43
|
+
sub.posder as subdivision_position_discussion,
|
|
44
|
+
sub.merid as subdivision_mere_id,
|
|
45
|
+
sub.sig as subdivision_signet,
|
|
46
|
+
sub.comdelid as subdivision_commission_id,
|
|
47
|
+
sub.dupl as subdivision_dupliquee,
|
|
48
|
+
typsub.lib as subdivision_type,
|
|
49
|
+
amd.alinea,
|
|
50
|
+
amd.obs as observations,
|
|
51
|
+
amd.mot as observations_additionnelles,
|
|
52
|
+
to_char(amd.datdep, 'YYYY-MM-DD') as date_depot,
|
|
53
|
+
amd.dis as dispositif,
|
|
54
|
+
amd.obj as objet,
|
|
55
|
+
typrect.lib as type_rectification,
|
|
56
|
+
mot.lib as motion_libelle,
|
|
57
|
+
case amd.etaid
|
|
58
|
+
when 7 then 'Diffusé'
|
|
59
|
+
when 8 then 'Retiré avant réunion ou séance'
|
|
60
|
+
when 9 then 'Examiné en commission ou séance'
|
|
61
|
+
when 10 then 'Irrecevable'
|
|
62
|
+
when 11 then 'Irrecevable'
|
|
63
|
+
else ''
|
|
64
|
+
end as etat,
|
|
65
|
+
avicom.lib as avis_commission,
|
|
66
|
+
avigvt.lib as avis_gouvernement,
|
|
67
|
+
coalesce(sor.lib, irr.libirr) as sort,
|
|
68
|
+
amd.rev as revision,
|
|
69
|
+
(
|
|
70
|
+
case
|
|
71
|
+
when amd.num like '%COM%' then 'https://www.senat.fr/amendements/commissions/'
|
|
72
|
+
else 'https://www.senat.fr/amendements/'
|
|
73
|
+
end ||
|
|
74
|
+
ses.ann::text || '-' ||
|
|
75
|
+
(ses.ann + 1)::text || '/' ||
|
|
76
|
+
txt_ameli.numabs || '/Amdt_' ||
|
|
77
|
+
amd.num || '.html'
|
|
78
|
+
) as url,
|
|
79
|
+
grppol_ameli.lilcou as au_nom_de_groupe_politique,
|
|
80
|
+
rtrim(com_ameli.lil) as au_nom_de_commission,
|
|
81
|
+
rtrim(com_ameli.cod) as code_commission,
|
|
82
|
+
(cab.entid is not null) as auteur_est_gouvernement,
|
|
83
|
+
(
|
|
84
|
+
select amescr.scrnum::text
|
|
85
|
+
from senat.dosleg_amescr as amescr
|
|
86
|
+
left join senat.dosleg_scr as scr
|
|
87
|
+
on amescr.scrnum = scr.scrnum
|
|
88
|
+
and amescr.sesann = scr.sesann
|
|
89
|
+
left join senat.dosleg_date_seance as date_seance on scr.code = date_seance.code
|
|
90
|
+
where amescr.amescrnum = amd.num
|
|
91
|
+
and amescr.sesann = ses.ann
|
|
92
|
+
and date_seance.lecidt = texte.lecassidt
|
|
93
|
+
limit 1
|
|
94
|
+
) as scrutin_num,
|
|
95
|
+
(
|
|
96
|
+
select coalesce(json_agg(author_rows order by author_rows.rang nulls last), '[]'::json)
|
|
97
|
+
from (
|
|
98
|
+
select
|
|
99
|
+
amdsen.prenomuse as prenom,
|
|
100
|
+
amdsen.hom as homonyme,
|
|
101
|
+
amdsen.nomuse as nom,
|
|
102
|
+
amdsen.qua as qualite,
|
|
103
|
+
amdsen.rng::text as rang,
|
|
104
|
+
sen_ameli.mat as matricule,
|
|
105
|
+
amdsen.grpid as groupe_politique_id,
|
|
106
|
+
grppol_ameli.cod as group_politique_code,
|
|
107
|
+
grppol_ameli.libcou as groupe_politique_libelle_court,
|
|
108
|
+
grppol_ameli.lilcou as groupe_politique_libelle
|
|
109
|
+
from senat.ameli_amdsen as amdsen
|
|
110
|
+
left join senat.ameli_sen_ameli as sen_ameli on amdsen.senid = sen_ameli.entid
|
|
111
|
+
left join senat.ameli_grppol_ameli as grppol_ameli on amdsen.grpid = grppol_ameli.entid
|
|
112
|
+
where amdsen.amdid = amd.id
|
|
113
|
+
order by amdsen.rng asc
|
|
114
|
+
) as author_rows
|
|
115
|
+
) as auteurs
|
|
116
|
+
from senat.ameli_amd as amd
|
|
117
|
+
left join senat.ameli_sub as sub on amd.subid = sub.id
|
|
118
|
+
left join senat.ameli_typsub as typsub on sub.typid = typsub.id
|
|
119
|
+
left join senat.ameli_typrect as typrect on amd.typrectid = typrect.id
|
|
120
|
+
left join senat.ameli_txt_ameli as txt_ameli on amd.txtid = txt_ameli.id
|
|
121
|
+
left join senat.ameli_etatxt as etatxt on txt_ameli.txtetaid = etatxt.id
|
|
122
|
+
left join senat.ameli_ses as ses on txt_ameli.sesdepid = ses.id
|
|
123
|
+
left join senat.ameli_typses as typses on typses.id = ses.typid
|
|
124
|
+
left join senat.ameli_nat as nat on txt_ameli.natid = nat.id
|
|
125
|
+
left join senat.ameli_lec_ameli as lec_ameli on txt_ameli.lecid = lec_ameli.id
|
|
126
|
+
left join senat.dosleg_texte as texte
|
|
127
|
+
on ses.ann = texte.sesann
|
|
128
|
+
and txt_ameli.numabs = texte.texnum
|
|
129
|
+
left join senat.dosleg_lecass as lecass on texte.lecassidt = lecass.lecassidt
|
|
130
|
+
left join senat.ameli_mot as mot on amd.motid = mot.id
|
|
131
|
+
left join senat.ameli_avicom as avicom on amd.avcid = avicom.id
|
|
132
|
+
left join senat.ameli_avigvt as avigvt on amd.avgid = avigvt.id
|
|
133
|
+
left join senat.ameli_sor as sor on amd.sorid = sor.id
|
|
134
|
+
left join senat.ameli_irr as irr on amd.irrid = irr.id
|
|
135
|
+
left join senat.ameli_grppol_ameli as grppol_ameli on amd.nomentid = grppol_ameli.entid
|
|
136
|
+
left join senat.ameli_com_ameli as com_ameli on amd.nomentid = com_ameli.entid
|
|
137
|
+
left join senat.ameli_cab as cab on amd.nomentid = cab.entid
|
|
138
|
+
${whereSession}
|
|
139
|
+
`,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export async function* findAllAmendements(fromSession) {
|
|
143
|
+
const { query, params } = buildFindAllAmendementsQuery(fromSession);
|
|
144
|
+
for await (const row of streamUnsafeQuery(query, params)) {
|
|
145
|
+
yield {
|
|
146
|
+
...row,
|
|
147
|
+
auteurs: row.auteurs ?? [],
|
|
148
|
+
};
|
|
146
149
|
}
|
|
147
|
-
return findAllAmendementsQuery.stream();
|
|
148
150
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface AmendementAuteurRow {
|
|
2
|
+
group_politique_code: string | null;
|
|
3
|
+
groupe_politique_id: number | null;
|
|
4
|
+
groupe_politique_libelle: string | null;
|
|
5
|
+
groupe_politique_libelle_court: string | null;
|
|
6
|
+
homonyme: string | null;
|
|
7
|
+
matricule: string | null;
|
|
8
|
+
nom: string | null;
|
|
9
|
+
prenom: string | null;
|
|
10
|
+
qualite: string | null;
|
|
11
|
+
rang: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface AmendementPostgresResult {
|
|
14
|
+
accepte_gouvernement: string | null;
|
|
15
|
+
alinea: number | null;
|
|
16
|
+
auteur_est_gouvernement: boolean;
|
|
17
|
+
au_nom_de_commission: string | null;
|
|
18
|
+
au_nom_de_groupe_politique: string | null;
|
|
19
|
+
auteurs: AmendementAuteurRow[];
|
|
20
|
+
avis_commission: string | null;
|
|
21
|
+
avis_gouvernement: string | null;
|
|
22
|
+
code_commission: string | null;
|
|
23
|
+
date_depot: string | null;
|
|
24
|
+
discussion_commune_id: number | null;
|
|
25
|
+
dispositif: string | null;
|
|
26
|
+
etat: string;
|
|
27
|
+
etat_texte: string | null;
|
|
28
|
+
etat_texte_libelle: string | null;
|
|
29
|
+
id: number;
|
|
30
|
+
identique_id: number | null;
|
|
31
|
+
intitule_texte: string | null;
|
|
32
|
+
lecture: string | null;
|
|
33
|
+
motion_libelle: string | null;
|
|
34
|
+
nature: string;
|
|
35
|
+
nature_texte: string | null;
|
|
36
|
+
nature_texte_libelle: string | null;
|
|
37
|
+
numero: string;
|
|
38
|
+
numero_absolu: string | null;
|
|
39
|
+
numero_adoption_texte: string | null;
|
|
40
|
+
numero_texte: string | null;
|
|
41
|
+
objet: string | null;
|
|
42
|
+
observations: string | null;
|
|
43
|
+
observations_additionnelles: string | null;
|
|
44
|
+
ordre: number | null;
|
|
45
|
+
parent_id: number | null;
|
|
46
|
+
revision: string | null;
|
|
47
|
+
session: string;
|
|
48
|
+
session_libelle: string;
|
|
49
|
+
signet_dossier_legislatif: string | null;
|
|
50
|
+
sort: string | null;
|
|
51
|
+
scrutin_num: string | null;
|
|
52
|
+
subdivision_commission_id: number | null;
|
|
53
|
+
subdivision_dupliquee: string | null;
|
|
54
|
+
subdivision_libelle: string | null;
|
|
55
|
+
subdivision_libelle_court: string | null;
|
|
56
|
+
subdivision_mere_id: number | null;
|
|
57
|
+
subdivision_position_discussion: number | null;
|
|
58
|
+
subdivision_position_texte: number | null;
|
|
59
|
+
subdivision_signet: string | null;
|
|
60
|
+
subdivision_type: string | null;
|
|
61
|
+
texte_id: number | null;
|
|
62
|
+
type_rectification: string | null;
|
|
63
|
+
type_session: string | null;
|
|
64
|
+
type_texte: string | null;
|
|
65
|
+
url: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function findAllAmendementsPostgres(fromSession?: number): AsyncGenerator<AmendementPostgresResult, void, unknown>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { streamUnsafeQuery } from "../databases_postgres";
|
|
2
|
+
function buildFindAllAmendementsQuery(fromSession) {
|
|
3
|
+
const params = [];
|
|
4
|
+
const whereSession = fromSession === undefined ? "" : "where ameli.ses.ann >= $1";
|
|
5
|
+
if (fromSession !== undefined) {
|
|
6
|
+
params.push(String(fromSession));
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
params,
|
|
10
|
+
query: `
|
|
11
|
+
select
|
|
12
|
+
ameli.ses.ann::text as session,
|
|
13
|
+
ameli.ses.lil as session_libelle,
|
|
14
|
+
ameli.typses.lib as type_session,
|
|
15
|
+
ameli.txt_ameli.doslegsignet as signet_dossier_legislatif,
|
|
16
|
+
ameli.nat.libcourt as nature_texte,
|
|
17
|
+
ameli.nat.lib as nature_texte_libelle,
|
|
18
|
+
ameli.txt_ameli.numabs as numero_texte,
|
|
19
|
+
ameli.txt_ameli.numado as numero_adoption_texte,
|
|
20
|
+
ameli.txt_ameli.int as intitule_texte,
|
|
21
|
+
ameli.etatxt.lic as etat_texte,
|
|
22
|
+
ameli.etatxt.lib as etat_texte_libelle,
|
|
23
|
+
ameli.etatxt.txttyp as type_texte,
|
|
24
|
+
ameli.lec_ameli.lib as lecture,
|
|
25
|
+
case ameli.amd.typ
|
|
26
|
+
when 'A' then 'Amendement'
|
|
27
|
+
when 'M' then 'Motion'
|
|
28
|
+
when 'S' then 'Sous-amendement'
|
|
29
|
+
else ''
|
|
30
|
+
end as nature,
|
|
31
|
+
ameli.amd.id,
|
|
32
|
+
ameli.amd.amdperid as parent_id,
|
|
33
|
+
ameli.amd.ideid as identique_id,
|
|
34
|
+
ameli.amd.discomid as discussion_commune_id,
|
|
35
|
+
ameli.amd.num as numero,
|
|
36
|
+
ameli.amd.numabs as numero_absolu,
|
|
37
|
+
ameli.amd.ord as ordre,
|
|
38
|
+
ameli.amd.accgou as accepte_gouvernement,
|
|
39
|
+
ameli.amd.txtid as texte_id,
|
|
40
|
+
ameli.sub.lib as subdivision_libelle,
|
|
41
|
+
ameli.sub.lic as subdivision_libelle_court,
|
|
42
|
+
ameli.sub.pos as subdivision_position_texte,
|
|
43
|
+
ameli.sub.posder as subdivision_position_discussion,
|
|
44
|
+
ameli.sub.merid as subdivision_mere_id,
|
|
45
|
+
ameli.sub.sig as subdivision_signet,
|
|
46
|
+
ameli.sub.comdelid as subdivision_commission_id,
|
|
47
|
+
ameli.sub.dupl as subdivision_dupliquee,
|
|
48
|
+
ameli.typsub.lib as subdivision_type,
|
|
49
|
+
ameli.amd.alinea,
|
|
50
|
+
ameli.amd.obs as observations,
|
|
51
|
+
ameli.amd.mot as observations_additionnelles,
|
|
52
|
+
to_char(ameli.amd.datdep, 'YYYY-MM-DD') as date_depot,
|
|
53
|
+
ameli.amd.dis as dispositif,
|
|
54
|
+
ameli.amd.obj as objet,
|
|
55
|
+
ameli.typrect.lib as type_rectification,
|
|
56
|
+
ameli.mot.lib as motion_libelle,
|
|
57
|
+
case ameli.amd.etaid
|
|
58
|
+
when 7 then 'Diffusé'
|
|
59
|
+
when 8 then 'Retiré avant réunion ou séance'
|
|
60
|
+
when 9 then 'Examiné en commission ou séance'
|
|
61
|
+
when 10 then 'Irrecevable'
|
|
62
|
+
when 11 then 'Irrecevable'
|
|
63
|
+
else ''
|
|
64
|
+
end as etat,
|
|
65
|
+
ameli.avicom.lib as avis_commission,
|
|
66
|
+
ameli.avigvt.lib as avis_gouvernement,
|
|
67
|
+
coalesce(ameli.sor.lib, ameli.irr.libirr) as sort,
|
|
68
|
+
ameli.amd.rev as revision,
|
|
69
|
+
(
|
|
70
|
+
case
|
|
71
|
+
when ameli.amd.num like '%COM%' then 'https://www.senat.fr/amendements/commissions/'
|
|
72
|
+
else 'https://www.senat.fr/amendements/'
|
|
73
|
+
end ||
|
|
74
|
+
ameli.ses.ann::text || '-' ||
|
|
75
|
+
(ameli.ses.ann + 1)::text || '/' ||
|
|
76
|
+
ameli.txt_ameli.numabs || '/Amdt_' ||
|
|
77
|
+
ameli.amd.num || '.html'
|
|
78
|
+
) as url,
|
|
79
|
+
ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique,
|
|
80
|
+
rtrim(ameli.com_ameli.lil) as au_nom_de_commission,
|
|
81
|
+
rtrim(ameli.com_ameli.cod) as code_commission,
|
|
82
|
+
(ameli.cab.entid is not null) as auteur_est_gouvernement,
|
|
83
|
+
(
|
|
84
|
+
select dosleg.amescr.scrnum::text
|
|
85
|
+
from dosleg.amescr
|
|
86
|
+
left join dosleg.scr
|
|
87
|
+
on dosleg.amescr.scrnum = dosleg.scr.scrnum
|
|
88
|
+
and dosleg.amescr.sesann = dosleg.scr.sesann
|
|
89
|
+
left join dosleg.date_seance on dosleg.scr.code = dosleg.date_seance.code
|
|
90
|
+
where dosleg.amescr.amescrnum = ameli.amd.num
|
|
91
|
+
and dosleg.amescr.sesann = ameli.ses.ann
|
|
92
|
+
and dosleg.date_seance.lecidt = dosleg.texte.lecassidt
|
|
93
|
+
limit 1
|
|
94
|
+
) as scrutin_num,
|
|
95
|
+
(
|
|
96
|
+
select coalesce(json_agg(author_rows order by author_rows.rang nulls last), '[]'::json)
|
|
97
|
+
from (
|
|
98
|
+
select
|
|
99
|
+
ameli.amdsen.prenomuse as prenom,
|
|
100
|
+
ameli.amdsen.hom as homonyme,
|
|
101
|
+
ameli.amdsen.nomuse as nom,
|
|
102
|
+
ameli.amdsen.qua as qualite,
|
|
103
|
+
ameli.amdsen.rng::text as rang,
|
|
104
|
+
ameli.sen_ameli.mat as matricule,
|
|
105
|
+
ameli.amdsen.grpid as groupe_politique_id,
|
|
106
|
+
ameli.grppol_ameli.cod as group_politique_code,
|
|
107
|
+
ameli.grppol_ameli.libcou as groupe_politique_libelle_court,
|
|
108
|
+
ameli.grppol_ameli.lilcou as groupe_politique_libelle
|
|
109
|
+
from ameli.amdsen
|
|
110
|
+
left join ameli.sen_ameli on ameli.amdsen.senid = ameli.sen_ameli.entid
|
|
111
|
+
left join ameli.grppol_ameli on ameli.amdsen.grpid = ameli.grppol_ameli.entid
|
|
112
|
+
where ameli.amdsen.amdid = ameli.amd.id
|
|
113
|
+
order by ameli.amdsen.rng asc
|
|
114
|
+
) as author_rows
|
|
115
|
+
) as auteurs
|
|
116
|
+
from ameli.amd
|
|
117
|
+
left join ameli.sub on ameli.amd.subid = ameli.sub.id
|
|
118
|
+
left join ameli.typsub on ameli.sub.typid = ameli.typsub.id
|
|
119
|
+
left join ameli.typrect on ameli.amd.typrectid = ameli.typrect.id
|
|
120
|
+
left join ameli.txt_ameli on ameli.amd.txtid = ameli.txt_ameli.id
|
|
121
|
+
left join ameli.etatxt on ameli.txt_ameli.txtetaid = ameli.etatxt.id
|
|
122
|
+
left join ameli.ses on ameli.txt_ameli.sesdepid = ameli.ses.id
|
|
123
|
+
left join ameli.typses on ameli.typses.id = ameli.ses.typid
|
|
124
|
+
left join ameli.nat on ameli.txt_ameli.natid = ameli.nat.id
|
|
125
|
+
left join ameli.lec_ameli on ameli.txt_ameli.lecid = ameli.lec_ameli.id
|
|
126
|
+
left join dosleg.texte
|
|
127
|
+
on ameli.ses.ann::text = dosleg.texte.sesann
|
|
128
|
+
and ameli.txt_ameli.numabs = dosleg.texte.texnum
|
|
129
|
+
left join dosleg.lecass on dosleg.texte.lecassidt = dosleg.lecass.lecassidt
|
|
130
|
+
left join ameli.mot on ameli.amd.motid = ameli.mot.id
|
|
131
|
+
left join ameli.avicom on ameli.amd.avcid = ameli.avicom.id
|
|
132
|
+
left join ameli.avigvt on ameli.amd.avgid = ameli.avigvt.id
|
|
133
|
+
left join ameli.sor on ameli.amd.sorid = ameli.sor.id
|
|
134
|
+
left join ameli.irr on ameli.amd.irrid = ameli.irr.id
|
|
135
|
+
left join ameli.grppol_ameli on ameli.amd.nomentid = ameli.grppol_ameli.entid
|
|
136
|
+
left join ameli.com_ameli on ameli.amd.nomentid = ameli.com_ameli.entid
|
|
137
|
+
left join ameli.cab on ameli.amd.nomentid = ameli.cab.entid
|
|
138
|
+
${whereSession}
|
|
139
|
+
`,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export async function* findAllAmendementsPostgres(fromSession) {
|
|
143
|
+
const { query, params } = buildFindAllAmendementsQuery(fromSession);
|
|
144
|
+
for await (const row of streamUnsafeQuery(query, params)) {
|
|
145
|
+
yield {
|
|
146
|
+
...row,
|
|
147
|
+
auteurs: row.auteurs ?? [],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as cheerio from "cheerio";
|
|
2
|
+
import type { AnyNode } from "domhandler";
|
|
2
3
|
import { CompteRendu } from "../types/compte_rendu";
|
|
3
4
|
import { Reunion } from "../types/agenda";
|
|
4
|
-
export declare function getRemainingTextAfterSpeakerHeader($: cheerio.CheerioAPI, $p: cheerio.Cheerio<
|
|
5
|
+
export declare function getRemainingTextAfterSpeakerHeader($: cheerio.CheerioAPI, $p: cheerio.Cheerio<AnyNode>): string;
|
|
5
6
|
export type DaySection = {
|
|
6
7
|
title: string;
|
|
7
|
-
$start: cheerio.Cheerio<
|
|
8
|
+
$start: cheerio.Cheerio<AnyNode>;
|
|
8
9
|
time?: string;
|
|
9
10
|
};
|
|
10
11
|
export declare function cleanTitle(t: string): string;
|
|
@@ -39,7 +39,7 @@ function collectLeadingHeaderStrongEls($, $clone) {
|
|
|
39
39
|
}
|
|
40
40
|
if ($n.is("a") && $n.children("strong, b").length) {
|
|
41
41
|
$n.children("strong, b").each((_, el) => {
|
|
42
|
-
els.push(
|
|
42
|
+
els.push(el);
|
|
43
43
|
});
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
@@ -68,7 +68,7 @@ function buildPointsFromParagraphs($, paras) {
|
|
|
68
68
|
const normSpeaker = (s) => s
|
|
69
69
|
.normalize("NFKC")
|
|
70
70
|
.replace(/\s+/g, " ")
|
|
71
|
-
.replace(/[
|
|
71
|
+
.replace(/[.:]\s*$/, "")
|
|
72
72
|
.trim();
|
|
73
73
|
const normQual = (s) => s
|
|
74
74
|
.normalize("NFKC")
|