@tricoteuses/senat 3.1.17 → 3.1.19
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/src/config.d.ts +0 -22
- package/lib/src/config.js +7 -17
- package/lib/src/conversion_textes.js +1 -5
- package/lib/src/databases.d.ts +2 -0
- package/lib/src/databases.js +26 -0
- package/lib/src/datasets.d.ts +0 -4
- package/lib/src/datasets.js +2 -16
- package/lib/src/git.d.ts +0 -1
- package/lib/src/git.js +11 -45
- package/lib/src/loaders.d.ts +12 -12
- package/lib/src/loaders.js +8 -14
- package/lib/src/model/agenda.d.ts +1 -1
- package/lib/src/model/agenda.js +3 -3
- package/lib/src/model/ameli.d.ts +52 -64
- package/lib/src/model/ameli.js +145 -147
- package/lib/src/model/commission.d.ts +4 -5
- package/lib/src/model/commission.js +6 -6
- package/lib/src/model/debats.d.ts +66 -38
- package/lib/src/model/debats.js +93 -110
- package/lib/src/model/documents.d.ts +12 -32
- package/lib/src/model/documents.js +130 -171
- package/lib/src/model/dosleg.d.ts +5 -142
- package/lib/src/model/dosleg.js +156 -298
- package/lib/src/model/index.d.ts +7 -7
- package/lib/src/model/index.js +7 -7
- package/lib/src/model/questions.d.ts +45 -54
- package/lib/src/model/questions.js +87 -89
- package/lib/src/model/scrutins.d.ts +13 -48
- package/lib/src/model/scrutins.js +111 -118
- package/lib/src/model/seance.d.ts +1 -1
- package/lib/src/model/seance.js +7 -7
- package/lib/src/model/sens.d.ts +179 -109
- package/lib/src/model/sens.js +484 -384
- package/lib/src/model/util.d.ts +8 -0
- package/lib/src/model/util.js +23 -0
- package/lib/src/raw_types/ameli.d.ts +800 -1648
- package/lib/src/raw_types/ameli.js +5 -1074
- package/lib/src/raw_types/debats.d.ts +180 -353
- package/lib/src/raw_types/debats.js +5 -266
- package/lib/src/raw_types/dosleg.d.ts +1523 -2858
- package/lib/src/raw_types/dosleg.js +5 -2005
- package/lib/src/raw_types/questions.d.ts +395 -671
- package/lib/src/raw_types/questions.js +5 -493
- package/lib/src/raw_types/senat.d.ts +11372 -0
- package/lib/src/raw_types/senat.js +5 -0
- package/lib/src/raw_types/sens.d.ts +8148 -7743
- package/lib/src/raw_types/sens.js +5 -4691
- package/lib/src/raw_types_schemats/ameli.d.ts +2 -4
- 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 +4235 -29
- package/lib/src/rich_types/dosleg.js +1 -1
- package/lib/src/scripts/test_iter_load.d.ts +1 -0
- package/lib/src/scripts/test_iter_load.js +12 -0
- package/lib/src/server/dosleg.js +20 -0
- package/lib/src/types/ameli.d.ts +4 -4
- package/lib/src/types/dosleg.d.ts +39 -39
- package/lib/src/types/questions.d.ts +2 -2
- package/lib/src/types/sens.d.ts +2 -0
- package/lib/src/types/texte.d.ts +2 -2
- package/lib/src/utils/reunion_odj_building.js +27 -11
- package/package.json +1 -1
- package/lib/src/databases_postgres.d.ts +0 -4
- package/lib/src/databases_postgres.js +0 -23
- package/lib/src/scripts/debug_dosleg_query.d.ts +0 -6
- package/lib/src/scripts/debug_dosleg_query.js +0 -50
package/lib/src/model/ameli.js
CHANGED
|
@@ -1,150 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
};
|
|
1
|
+
import { sql } from "kysely";
|
|
2
|
+
import { jsonArrayFrom } from "kysely/helpers/postgres";
|
|
3
|
+
import { dbSenat } from "../databases";
|
|
4
|
+
import { concat, rtrim, toDateString } from "./util";
|
|
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"));
|
|
141
24
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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) {
|
|
144
|
+
if (fromSession !== undefined) {
|
|
145
|
+
return findAllAmendementsQuery.where("ameli.ses.ann", ">=", fromSession).stream();
|
|
149
146
|
}
|
|
147
|
+
return findAllAmendementsQuery.stream();
|
|
150
148
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as cheerio from "cheerio";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function getRemainingTextAfterSpeakerHeader($: cheerio.CheerioAPI, $p: cheerio.Cheerio<AnyNode>): string;
|
|
2
|
+
import { CompteRendu } from "../types/compte_rendu";
|
|
3
|
+
import { Reunion } from "../types/agenda";
|
|
4
|
+
export declare function getRemainingTextAfterSpeakerHeader($: cheerio.CheerioAPI, $p: cheerio.Cheerio<any>): string;
|
|
6
5
|
export type DaySection = {
|
|
7
6
|
title: string;
|
|
8
|
-
$start: cheerio.Cheerio<
|
|
7
|
+
$start: cheerio.Cheerio<any>;
|
|
9
8
|
time?: string;
|
|
10
9
|
};
|
|
11
10
|
export declare function cleanTitle(t: string): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as cheerio from "cheerio";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { makeReunionUid } from "../utils/reunion_parsing
|
|
4
|
-
import { norm } from "../utils/string_cleaning
|
|
5
|
-
import { frDateToISO, hourShortToStartTime } from "../utils/date
|
|
6
|
-
import { toCRDate } from "./util
|
|
3
|
+
import { makeReunionUid } from "../utils/reunion_parsing";
|
|
4
|
+
import { norm } from "../utils/string_cleaning";
|
|
5
|
+
import { frDateToISO, hourShortToStartTime } from "../utils/date";
|
|
6
|
+
import { toCRDate } from "./util";
|
|
7
7
|
const PARA_h3_SEL = "p.sh_justify, p.sh_center, p.sh_marge, p[align], li, h3";
|
|
8
8
|
function findDayRoot($, targetISO) {
|
|
9
9
|
let $root = $();
|
|
@@ -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(el);
|
|
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")
|
|
@@ -1,39 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
prenom: string | null;
|
|
6
|
-
}
|
|
7
|
-
export interface DebatInterventionRow {
|
|
8
|
-
analyse: string | null;
|
|
9
|
-
auteur: DebatAuteurRow | null;
|
|
10
|
-
auteur_code: string;
|
|
11
|
-
fonction_intervenant: string | null;
|
|
12
|
-
id: string | null;
|
|
13
|
-
url: string | null;
|
|
14
|
-
}
|
|
15
|
-
export interface DebatSectionRow {
|
|
16
|
-
categorie: string | null;
|
|
17
|
-
id?: string | null;
|
|
18
|
-
interventions: DebatInterventionRow[];
|
|
19
|
-
lecture_id?: string | null;
|
|
20
|
-
libelle?: string | null;
|
|
21
|
-
numero?: string | null;
|
|
22
|
-
objet: string | null;
|
|
23
|
-
type: string | null;
|
|
24
|
-
url?: string | null;
|
|
25
|
-
}
|
|
26
|
-
export interface DebatLectureRow {
|
|
1
|
+
import { InferResult } from "kysely";
|
|
2
|
+
export type DebatResult = InferResult<typeof findAllQuery>[0];
|
|
3
|
+
declare const findAllQuery: import("kysely").SelectQueryBuilder<any, "debats.debats", {
|
|
4
|
+
[x: string]: any;
|
|
27
5
|
id: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
6
|
+
date_seance: string;
|
|
7
|
+
sections: {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
interventions: {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
auteur: {
|
|
12
|
+
code: any;
|
|
13
|
+
nom: any;
|
|
14
|
+
prenom: any;
|
|
15
|
+
matricule: any;
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
}[];
|
|
19
|
+
sections_divers: {
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
interventions: {
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
auteur: {
|
|
24
|
+
code: any;
|
|
25
|
+
nom: any;
|
|
26
|
+
prenom: any;
|
|
27
|
+
matricule: any;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
}[];
|
|
31
|
+
lectures: {
|
|
32
|
+
id: any;
|
|
33
|
+
}[];
|
|
34
|
+
}>;
|
|
35
|
+
export declare function findAll(fromSession?: number): AsyncIterableIterator<{
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
id: string;
|
|
38
|
+
date_seance: string;
|
|
39
|
+
sections: {
|
|
40
|
+
[x: string]: any;
|
|
41
|
+
interventions: {
|
|
42
|
+
[x: string]: any;
|
|
43
|
+
auteur: {
|
|
44
|
+
code: any;
|
|
45
|
+
nom: any;
|
|
46
|
+
prenom: any;
|
|
47
|
+
matricule: any;
|
|
48
|
+
};
|
|
49
|
+
}[];
|
|
50
|
+
}[];
|
|
51
|
+
sections_divers: {
|
|
52
|
+
[x: string]: any;
|
|
53
|
+
interventions: {
|
|
54
|
+
[x: string]: any;
|
|
55
|
+
auteur: {
|
|
56
|
+
code: any;
|
|
57
|
+
nom: any;
|
|
58
|
+
prenom: any;
|
|
59
|
+
matricule: any;
|
|
60
|
+
};
|
|
61
|
+
}[];
|
|
62
|
+
}[];
|
|
63
|
+
lectures: {
|
|
64
|
+
id: any;
|
|
65
|
+
}[];
|
|
66
|
+
}>;
|
|
67
|
+
export {};
|
package/lib/src/model/debats.js
CHANGED
|
@@ -1,112 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
debats.
|
|
10
|
-
|
|
11
|
-
debats.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
typsec.typseccat as categorie,
|
|
22
|
-
secdis.lecassidt as lecture_id,
|
|
23
|
-
secdis.secdisordid as section_order,
|
|
24
|
-
(
|
|
25
|
-
select coalesce(
|
|
26
|
-
json_agg(intervention_rows order by intervention_rows.intervention_order nulls last),
|
|
27
|
-
'[]'::json
|
|
28
|
-
)
|
|
29
|
-
from (
|
|
30
|
-
select
|
|
31
|
-
intpjl.intordid::text as id,
|
|
32
|
-
intpjl.autcod as auteur_code,
|
|
33
|
-
intpjl.intfon as fonction_intervenant,
|
|
34
|
-
intpjl.inturl as url,
|
|
35
|
-
intpjl.intana as analyse,
|
|
36
|
-
json_build_object(
|
|
37
|
-
'code', auteur.autcod,
|
|
38
|
-
'nom', auteur.nomuse,
|
|
39
|
-
'prenom', auteur.prenom,
|
|
40
|
-
'matricule', auteur.autmat
|
|
41
|
-
) as auteur,
|
|
42
|
-
intpjl.intordid as intervention_order
|
|
43
|
-
from senat.debats_intpjl as intpjl
|
|
44
|
-
left join senat.dosleg_auteur as auteur on intpjl.autcod = auteur.autcod
|
|
45
|
-
where intpjl.secdiscle = secdis.secdiscle
|
|
46
|
-
) as intervention_rows
|
|
47
|
-
) as interventions
|
|
48
|
-
from senat.debats_secdis as secdis
|
|
49
|
-
left join senat.debats_typsec as typsec on secdis.typseccod = typsec.typseccod
|
|
50
|
-
where secdis.datsea = debats.datsea
|
|
51
|
-
) as section_rows
|
|
52
|
-
) as sections,
|
|
53
|
-
(
|
|
54
|
-
select coalesce(json_agg(section_rows), '[]'::json)
|
|
55
|
-
from (
|
|
56
|
-
select
|
|
57
|
-
secdivers.secdiverslibelle as libelle,
|
|
58
|
-
secdivers.secdiversobj as objet,
|
|
59
|
-
typsec.typseclib as type,
|
|
60
|
-
typsec.typseccat as categorie,
|
|
61
|
-
(
|
|
62
|
-
select coalesce(
|
|
63
|
-
json_agg(intervention_rows order by intervention_rows.intervention_order nulls last),
|
|
64
|
-
'[]'::json
|
|
65
|
-
)
|
|
66
|
-
from (
|
|
67
|
-
select
|
|
68
|
-
intdivers.intdiversordid::text as id,
|
|
69
|
-
intdivers.autcod as auteur_code,
|
|
70
|
-
intdivers.intfon as fonction_intervenant,
|
|
71
|
-
intdivers.inturl as url,
|
|
72
|
-
intdivers.intana as analyse,
|
|
73
|
-
json_build_object(
|
|
74
|
-
'code', auteur.autcod,
|
|
75
|
-
'nom', auteur.nomuse,
|
|
76
|
-
'prenom', auteur.prenom,
|
|
77
|
-
'matricule', auteur.autmat
|
|
78
|
-
) as auteur,
|
|
79
|
-
intdivers.intdiversordid as intervention_order
|
|
80
|
-
from senat.debats_intdivers as intdivers
|
|
81
|
-
left join senat.dosleg_auteur as auteur on intdivers.autcod = auteur.autcod
|
|
82
|
-
where intdivers.secdiverscle = secdivers.secdiverscle
|
|
83
|
-
) as intervention_rows
|
|
84
|
-
) as interventions
|
|
85
|
-
from senat.debats_secdivers as secdivers
|
|
86
|
-
left join senat.debats_typsec as typsec on secdivers.typseccod = typsec.typseccod
|
|
87
|
-
where secdivers.datsea = debats.datsea
|
|
88
|
-
) as section_rows
|
|
89
|
-
) as sections_divers,
|
|
90
|
-
(
|
|
91
|
-
select coalesce(json_agg(lecture_rows), '[]'::json)
|
|
92
|
-
from (
|
|
93
|
-
select lecassdeb.lecassidt as id
|
|
94
|
-
from senat.debats_lecassdeb as lecassdeb
|
|
95
|
-
where lecassdeb.datsea = debats.datsea
|
|
96
|
-
) as lecture_rows
|
|
97
|
-
) as lectures
|
|
98
|
-
from senat.debats_debats as debats
|
|
99
|
-
`,
|
|
100
|
-
};
|
|
1
|
+
import { jsonArrayFrom, jsonBuildObject } from "kysely/helpers/postgres";
|
|
2
|
+
import { dbSenat } from "../databases";
|
|
3
|
+
import { ID_DATE_FORMAT } from "../scripts/datautil";
|
|
4
|
+
import { toDateString } from "./util";
|
|
5
|
+
function sectionsLegislatives(dateSeance) {
|
|
6
|
+
return jsonArrayFrom(dbSenat
|
|
7
|
+
.selectFrom("debats.secdis")
|
|
8
|
+
.leftJoin("debats.typsec", "debats.secdis.typseccod", "debats.typsec.typseccod")
|
|
9
|
+
.where("debats.secdis.datsea", "=", dateSeance)
|
|
10
|
+
.select(({ ref }) => [
|
|
11
|
+
"debats.secdis.secdisordid as id",
|
|
12
|
+
"debats.secdis.secdisnum as numero",
|
|
13
|
+
"debats.secdis.secdisobj as objet",
|
|
14
|
+
"debats.secdis.secdisurl as url",
|
|
15
|
+
"debats.typsec.typseclib as type",
|
|
16
|
+
"debats.typsec.typseccat as categorie",
|
|
17
|
+
interventionsLegislatives(ref("debats.secdis.secdiscle")).as("interventions"),
|
|
18
|
+
"debats.secdis.lecassidt as lecture_id",
|
|
19
|
+
])
|
|
20
|
+
.orderBy("debats.secdis.secdisordid", "asc"));
|
|
101
21
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
22
|
+
function interventionsLegislatives(sectionId) {
|
|
23
|
+
return jsonArrayFrom(dbSenat
|
|
24
|
+
.selectFrom("debats.intpjl")
|
|
25
|
+
.leftJoin("dosleg.auteur", "debats.intpjl.autcod", "dosleg.auteur.autcod")
|
|
26
|
+
.where("debats.intpjl.secdiscle", "=", sectionId)
|
|
27
|
+
.select(({ ref, val, fn }) => [
|
|
28
|
+
"debats.intpjl.intordid as id",
|
|
29
|
+
"debats.intpjl.autcod as auteur_code",
|
|
30
|
+
"debats.intpjl.intfon as fonction_intervenant",
|
|
31
|
+
"debats.intpjl.inturl as url",
|
|
32
|
+
"debats.intpjl.intana as analyse",
|
|
33
|
+
jsonBuildObject({
|
|
34
|
+
code: ref("dosleg.auteur.autcod"),
|
|
35
|
+
nom: ref("dosleg.auteur.nomuse"),
|
|
36
|
+
prenom: ref("dosleg.auteur.prenom"),
|
|
37
|
+
matricule: ref("dosleg.auteur.autmat"),
|
|
38
|
+
}).as("auteur"),
|
|
39
|
+
])
|
|
40
|
+
.orderBy("debats.intpjl.intordid", "asc"));
|
|
41
|
+
}
|
|
42
|
+
function sectionsNonLegislatives(dateSeance) {
|
|
43
|
+
return jsonArrayFrom(dbSenat
|
|
44
|
+
.selectFrom("debats.secdivers")
|
|
45
|
+
.leftJoin("debats.typsec", "debats.secdivers.typseccod", "debats.typsec.typseccod")
|
|
46
|
+
.where("debats.secdivers.datsea", "=", dateSeance)
|
|
47
|
+
.select(({ ref }) => [
|
|
48
|
+
"debats.secdivers.secdiverslibelle as libelle",
|
|
49
|
+
"debats.secdivers.secdiversobj as objet",
|
|
50
|
+
"debats.typsec.typseclib as type",
|
|
51
|
+
"debats.typsec.typseccat as categorie",
|
|
52
|
+
interventionsNonLegislatives(ref("debats.secdivers.secdiverscle")).as("interventions"),
|
|
53
|
+
]));
|
|
54
|
+
}
|
|
55
|
+
function interventionsNonLegislatives(sectionId) {
|
|
56
|
+
return jsonArrayFrom(dbSenat
|
|
57
|
+
.selectFrom("debats.intdivers")
|
|
58
|
+
.leftJoin("dosleg.auteur", "debats.intdivers.autcod", "dosleg.auteur.autcod")
|
|
59
|
+
.where("debats.intdivers.intdiverscle", "=", sectionId)
|
|
60
|
+
.select(({ ref, val }) => [
|
|
61
|
+
"debats.intdivers.intdiversordid as id",
|
|
62
|
+
"debats.intdivers.autcod as auteur_code",
|
|
63
|
+
"debats.intdivers.intfon as fonction_intervenant",
|
|
64
|
+
"debats.intdivers.inturl as url",
|
|
65
|
+
"debats.intdivers.intana as analyse",
|
|
66
|
+
jsonBuildObject({
|
|
67
|
+
code: ref("dosleg.auteur.autcod"),
|
|
68
|
+
nom: ref("dosleg.auteur.nomuse"),
|
|
69
|
+
prenom: ref("dosleg.auteur.prenom"),
|
|
70
|
+
matricule: ref("dosleg.auteur.autmat"),
|
|
71
|
+
}).as("auteur"),
|
|
72
|
+
])
|
|
73
|
+
.orderBy("debats.intdivers.intdiversordid", "asc"));
|
|
74
|
+
}
|
|
75
|
+
function lecturesAssemblee(dateSeance) {
|
|
76
|
+
return jsonArrayFrom(dbSenat
|
|
77
|
+
.selectFrom("debats.lecassdeb")
|
|
78
|
+
.where("debats.lecassdeb.datsea", "=", dateSeance)
|
|
79
|
+
.select("debats.lecassdeb.lecassidt as id"));
|
|
80
|
+
}
|
|
81
|
+
const findAllQuery = dbSenat
|
|
82
|
+
.selectFrom("debats.debats")
|
|
83
|
+
.select(({ ref, val }) => [
|
|
84
|
+
toDateString(ref("debats.debats.datsea"), val(ID_DATE_FORMAT)).as("id"),
|
|
85
|
+
toDateString(ref("debats.debats.datsea")).as("date_seance"),
|
|
86
|
+
"debats.debats.numero as numero",
|
|
87
|
+
"debats.debats.deburl as url",
|
|
88
|
+
"debats.debats.debsyn as etat_synchronisation",
|
|
89
|
+
sectionsLegislatives(ref("debats.debats.datsea")).as("sections"),
|
|
90
|
+
sectionsNonLegislatives(ref("debats.debats.datsea")).as("sections_divers"),
|
|
91
|
+
lecturesAssemblee(ref("debats.debats.datsea")).as("lectures"),
|
|
92
|
+
]);
|
|
93
|
+
export function findAll(fromSession) {
|
|
94
|
+
return findAllQuery.stream();
|
|
112
95
|
}
|