@tricoteuses/senat 3.1.22 → 3.1.24

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.
Files changed (391) hide show
  1. package/LICENSE.md +32 -32
  2. package/README.md +326 -326
  3. package/lib/src/index.d.ts +1 -0
  4. package/lib/src/other_types/collaborateurs.d.ts +5 -0
  5. package/lib/src/parsers/collaborateurs.d.ts +44 -0
  6. package/lib/src/parsers/collaborateurs.js +157 -0
  7. package/lib/src/rich_types/sens.d.ts +5 -0
  8. package/lib/src/scripts/data-download.js +1 -0
  9. package/lib/src/scripts/retrieve_collaborateurs.js +166 -0
  10. package/lib/src/scripts/retrieve_cr_seance.js +34 -25
  11. package/lib/src/scripts/retrieve_videos.js +13 -8
  12. package/lib/src/scripts/shared/incremental_import_sql.js +866 -859
  13. package/lib/src/scripts/shared/schema_version.js +84 -84
  14. package/lib/src/scripts/shared/staging_metadata_sql.js +214 -214
  15. package/lib/src/scripts/validate_prefixed_tables.js +12 -12
  16. package/lib/src/server/ameli.js +14 -13
  17. package/lib/src/server/conversion_textes.js +106 -106
  18. package/lib/src/server/debats.js +10 -10
  19. package/lib/src/server/documents.js +22 -22
  20. package/lib/src/server/dosleg.js +33 -33
  21. package/lib/src/server/questions.js +10 -10
  22. package/lib/src/server/scrutins.js +3 -3
  23. package/lib/src/server/sens.js +19 -19
  24. package/lib/src/utils/reunion_odj_building.js +0 -4
  25. package/lib/src/videos/match.js +7 -5
  26. package/lib/src/videos/pipeline.js +26 -19
  27. package/lib/tests/collaborateurs.test.js +115 -0
  28. package/lib/tests/incrementalImportSql.test.js +4 -1
  29. package/package.json +121 -119
  30. package/lib/add-js-extensions-v2.js +0 -23
  31. package/lib/add-js-extensions.js +0 -17
  32. package/lib/aggregates.d.ts +0 -52
  33. package/lib/aggregates.js +0 -930
  34. package/lib/aggregates.mjs +0 -713
  35. package/lib/aggregates.ts +0 -833
  36. package/lib/config.d.ts +0 -10
  37. package/lib/config.js +0 -16
  38. package/lib/config.mjs +0 -16
  39. package/lib/config.ts +0 -26
  40. package/lib/databases.d.ts +0 -2
  41. package/lib/databases.js +0 -26
  42. package/lib/databases.mjs +0 -57
  43. package/lib/databases.ts +0 -71
  44. package/lib/datasets.d.ts +0 -34
  45. package/lib/datasets.js +0 -233
  46. package/lib/datasets.mjs +0 -78
  47. package/lib/datasets.ts +0 -118
  48. package/lib/fields.d.ts +0 -10
  49. package/lib/fields.js +0 -68
  50. package/lib/fields.mjs +0 -22
  51. package/lib/fields.ts +0 -29
  52. package/lib/git.d.ts +0 -26
  53. package/lib/git.js +0 -167
  54. package/lib/index.d.ts +0 -13
  55. package/lib/index.js +0 -1
  56. package/lib/index.mjs +0 -7
  57. package/lib/index.ts +0 -64
  58. package/lib/inserters.d.ts +0 -98
  59. package/lib/inserters.js +0 -500
  60. package/lib/inserters.mjs +0 -360
  61. package/lib/inserters.ts +0 -521
  62. package/lib/legislatures.json +0 -38
  63. package/lib/loaders.d.ts +0 -58
  64. package/lib/loaders.js +0 -286
  65. package/lib/loaders.mjs +0 -158
  66. package/lib/loaders.ts +0 -271
  67. package/lib/model/agenda.d.ts +0 -6
  68. package/lib/model/agenda.js +0 -148
  69. package/lib/model/ameli.d.ts +0 -51
  70. package/lib/model/ameli.js +0 -149
  71. package/lib/model/ameli.mjs +0 -84
  72. package/lib/model/ameli.ts +0 -100
  73. package/lib/model/commission.d.ts +0 -18
  74. package/lib/model/commission.js +0 -269
  75. package/lib/model/debats.d.ts +0 -67
  76. package/lib/model/debats.js +0 -95
  77. package/lib/model/debats.mjs +0 -43
  78. package/lib/model/debats.ts +0 -68
  79. package/lib/model/documents.d.ts +0 -12
  80. package/lib/model/documents.js +0 -151
  81. package/lib/model/dosleg.d.ts +0 -7
  82. package/lib/model/dosleg.js +0 -326
  83. package/lib/model/dosleg.mjs +0 -196
  84. package/lib/model/dosleg.ts +0 -240
  85. package/lib/model/index.d.ts +0 -7
  86. package/lib/model/index.js +0 -7
  87. package/lib/model/index.mjs +0 -5
  88. package/lib/model/index.ts +0 -15
  89. package/lib/model/questions.d.ts +0 -45
  90. package/lib/model/questions.js +0 -89
  91. package/lib/model/questions.mjs +0 -71
  92. package/lib/model/questions.ts +0 -93
  93. package/lib/model/scrutins.d.ts +0 -13
  94. package/lib/model/scrutins.js +0 -114
  95. package/lib/model/seance.d.ts +0 -3
  96. package/lib/model/seance.js +0 -267
  97. package/lib/model/sens.d.ts +0 -146
  98. package/lib/model/sens.js +0 -454
  99. package/lib/model/sens.mjs +0 -415
  100. package/lib/model/sens.ts +0 -516
  101. package/lib/model/texte.d.ts +0 -7
  102. package/lib/model/texte.js +0 -256
  103. package/lib/model/texte.mjs +0 -208
  104. package/lib/model/texte.ts +0 -229
  105. package/lib/model/util.d.ts +0 -9
  106. package/lib/model/util.js +0 -38
  107. package/lib/model/util.mjs +0 -19
  108. package/lib/model/util.ts +0 -32
  109. package/lib/parsers/texte.d.ts +0 -7
  110. package/lib/parsers/texte.js +0 -228
  111. package/lib/raw_types/ameli.d.ts +0 -914
  112. package/lib/raw_types/ameli.js +0 -5
  113. package/lib/raw_types/ameli.mjs +0 -163
  114. package/lib/raw_types/debats.d.ts +0 -207
  115. package/lib/raw_types/debats.js +0 -5
  116. package/lib/raw_types/debats.mjs +0 -58
  117. package/lib/raw_types/dosleg.d.ts +0 -1619
  118. package/lib/raw_types/dosleg.js +0 -5
  119. package/lib/raw_types/dosleg.mjs +0 -438
  120. package/lib/raw_types/questions.d.ts +0 -419
  121. package/lib/raw_types/questions.js +0 -5
  122. package/lib/raw_types/questions.mjs +0 -11
  123. package/lib/raw_types/senat.d.ts +0 -11368
  124. package/lib/raw_types/senat.js +0 -5
  125. package/lib/raw_types/sens.d.ts +0 -8248
  126. package/lib/raw_types/sens.js +0 -5
  127. package/lib/raw_types/sens.mjs +0 -508
  128. package/lib/raw_types_kysely/ameli.d.ts +0 -915
  129. package/lib/raw_types_kysely/ameli.js +0 -7
  130. package/lib/raw_types_kysely/ameli.mjs +0 -5
  131. package/lib/raw_types_kysely/ameli.ts +0 -951
  132. package/lib/raw_types_kysely/debats.d.ts +0 -207
  133. package/lib/raw_types_kysely/debats.js +0 -7
  134. package/lib/raw_types_kysely/debats.mjs +0 -5
  135. package/lib/raw_types_kysely/debats.ts +0 -222
  136. package/lib/raw_types_kysely/dosleg.d.ts +0 -3532
  137. package/lib/raw_types_kysely/dosleg.js +0 -7
  138. package/lib/raw_types_kysely/dosleg.mjs +0 -5
  139. package/lib/raw_types_kysely/dosleg.ts +0 -3621
  140. package/lib/raw_types_kysely/questions.d.ts +0 -414
  141. package/lib/raw_types_kysely/questions.js +0 -7
  142. package/lib/raw_types_kysely/questions.mjs +0 -5
  143. package/lib/raw_types_kysely/questions.ts +0 -426
  144. package/lib/raw_types_kysely/sens.d.ts +0 -4394
  145. package/lib/raw_types_kysely/sens.js +0 -7
  146. package/lib/raw_types_kysely/sens.mjs +0 -5
  147. package/lib/raw_types_kysely/sens.ts +0 -4499
  148. package/lib/raw_types_schemats/ameli.d.ts +0 -539
  149. package/lib/raw_types_schemats/ameli.js +0 -2
  150. package/lib/raw_types_schemats/ameli.mjs +0 -2
  151. package/lib/raw_types_schemats/ameli.ts +0 -601
  152. package/lib/raw_types_schemats/debats.d.ts +0 -127
  153. package/lib/raw_types_schemats/debats.js +0 -2
  154. package/lib/raw_types_schemats/debats.mjs +0 -2
  155. package/lib/raw_types_schemats/debats.ts +0 -145
  156. package/lib/raw_types_schemats/dosleg.d.ts +0 -977
  157. package/lib/raw_types_schemats/dosleg.js +0 -2
  158. package/lib/raw_types_schemats/dosleg.mjs +0 -2
  159. package/lib/raw_types_schemats/dosleg.ts +0 -2193
  160. package/lib/raw_types_schemats/questions.d.ts +0 -235
  161. package/lib/raw_types_schemats/questions.js +0 -2
  162. package/lib/raw_types_schemats/questions.mjs +0 -2
  163. package/lib/raw_types_schemats/questions.ts +0 -249
  164. package/lib/raw_types_schemats/sens.d.ts +0 -6915
  165. package/lib/raw_types_schemats/sens.js +0 -2
  166. package/lib/raw_types_schemats/sens.mjs +0 -2
  167. package/lib/raw_types_schemats/sens.ts +0 -2907
  168. package/lib/scripts/convert_data.js +0 -354
  169. package/lib/scripts/convert_data.mjs +0 -181
  170. package/lib/scripts/convert_data.ts +0 -243
  171. package/lib/scripts/data-download.d.ts +0 -1
  172. package/lib/scripts/data-download.js +0 -12
  173. package/lib/scripts/datautil.d.ts +0 -8
  174. package/lib/scripts/datautil.js +0 -34
  175. package/lib/scripts/datautil.mjs +0 -16
  176. package/lib/scripts/datautil.ts +0 -19
  177. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  178. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  179. package/lib/scripts/parse_textes.d.ts +0 -1
  180. package/lib/scripts/parse_textes.js +0 -44
  181. package/lib/scripts/parse_textes.mjs +0 -46
  182. package/lib/scripts/parse_textes.ts +0 -65
  183. package/lib/scripts/retrieve_agenda.d.ts +0 -1
  184. package/lib/scripts/retrieve_agenda.js +0 -132
  185. package/lib/scripts/retrieve_cr_commission.d.ts +0 -1
  186. package/lib/scripts/retrieve_cr_commission.js +0 -364
  187. package/lib/scripts/retrieve_cr_seance.d.ts +0 -6
  188. package/lib/scripts/retrieve_cr_seance.js +0 -347
  189. package/lib/scripts/retrieve_documents.d.ts +0 -3
  190. package/lib/scripts/retrieve_documents.js +0 -219
  191. package/lib/scripts/retrieve_documents.mjs +0 -249
  192. package/lib/scripts/retrieve_documents.ts +0 -298
  193. package/lib/scripts/retrieve_open_data.d.ts +0 -1
  194. package/lib/scripts/retrieve_open_data.js +0 -315
  195. package/lib/scripts/retrieve_open_data.mjs +0 -217
  196. package/lib/scripts/retrieve_open_data.ts +0 -268
  197. package/lib/scripts/retrieve_senateurs_photos.d.ts +0 -1
  198. package/lib/scripts/retrieve_senateurs_photos.js +0 -147
  199. package/lib/scripts/retrieve_senateurs_photos.mjs +0 -147
  200. package/lib/scripts/retrieve_senateurs_photos.ts +0 -177
  201. package/lib/scripts/retrieve_videos.d.ts +0 -1
  202. package/lib/scripts/retrieve_videos.js +0 -461
  203. package/lib/scripts/shared/cli_helpers.d.ts +0 -95
  204. package/lib/scripts/shared/cli_helpers.js +0 -91
  205. package/lib/scripts/shared/cli_helpers.ts +0 -36
  206. package/lib/scripts/shared/util.d.ts +0 -4
  207. package/lib/scripts/shared/util.js +0 -35
  208. package/lib/scripts/shared/util.ts +0 -33
  209. package/lib/scripts/test_iter_load.d.ts +0 -1
  210. package/lib/scripts/test_iter_load.js +0 -12
  211. package/lib/src/ameli.d.ts +0 -66
  212. package/lib/src/ameli.js +0 -1
  213. package/lib/src/config.d.ts +0 -43
  214. package/lib/src/config.js +0 -37
  215. package/lib/src/conversion_textes.d.ts +0 -11
  216. package/lib/src/conversion_textes.js +0 -320
  217. package/lib/src/databases.d.ts +0 -3
  218. package/lib/src/databases.js +0 -26
  219. package/lib/src/databases_postgres.d.ts +0 -4
  220. package/lib/src/databases_postgres.js +0 -23
  221. package/lib/src/datasets.d.ts +0 -38
  222. package/lib/src/datasets.js +0 -247
  223. package/lib/src/db_types/ameli.d.ts +0 -1762
  224. package/lib/src/db_types/ameli.js +0 -1074
  225. package/lib/src/db_types/debats.d.ts +0 -380
  226. package/lib/src/db_types/debats.js +0 -266
  227. package/lib/src/db_types/dosleg.d.ts +0 -2954
  228. package/lib/src/db_types/dosleg.js +0 -2005
  229. package/lib/src/db_types/questions.d.ts +0 -699
  230. package/lib/src/db_types/questions.js +0 -493
  231. package/lib/src/db_types/sens.d.ts +0 -7843
  232. package/lib/src/db_types/sens.js +0 -4691
  233. package/lib/src/debats.d.ts +0 -38
  234. package/lib/src/debats.js +0 -1
  235. package/lib/src/dosleg.d.ts +0 -142
  236. package/lib/src/dosleg.js +0 -193
  237. package/lib/src/git.d.ts +0 -27
  238. package/lib/src/git.js +0 -251
  239. package/lib/src/loaders.d.ts +0 -52
  240. package/lib/src/loaders.js +0 -260
  241. package/lib/src/model/agenda.d.ts +0 -6
  242. package/lib/src/model/agenda.js +0 -148
  243. package/lib/src/model/ameli.d.ts +0 -67
  244. package/lib/src/model/ameli.js +0 -150
  245. package/lib/src/model/ameli_postgres.d.ts +0 -67
  246. package/lib/src/model/ameli_postgres.js +0 -150
  247. package/lib/src/model/commission.d.ts +0 -19
  248. package/lib/src/model/commission.js +0 -269
  249. package/lib/src/model/debats.d.ts +0 -39
  250. package/lib/src/model/debats.js +0 -112
  251. package/lib/src/model/documents.d.ts +0 -32
  252. package/lib/src/model/documents.js +0 -182
  253. package/lib/src/model/dosleg.d.ts +0 -144
  254. package/lib/src/model/dosleg.js +0 -468
  255. package/lib/src/model/index.d.ts +0 -7
  256. package/lib/src/model/index.js +0 -7
  257. package/lib/src/model/questions.d.ts +0 -54
  258. package/lib/src/model/questions.js +0 -91
  259. package/lib/src/model/scrutins.d.ts +0 -48
  260. package/lib/src/model/scrutins.js +0 -121
  261. package/lib/src/model/seance.d.ts +0 -3
  262. package/lib/src/model/seance.js +0 -267
  263. package/lib/src/model/sens.d.ts +0 -112
  264. package/lib/src/model/sens.js +0 -385
  265. package/lib/src/model/util.d.ts +0 -1
  266. package/lib/src/model/util.js +0 -15
  267. package/lib/src/other_types/questions.d.ts +0 -2
  268. package/lib/src/other_types/questions.js +0 -1
  269. package/lib/src/questions.d.ts +0 -53
  270. package/lib/src/questions.js +0 -1
  271. package/lib/src/raw_types/ameli.d.ts +0 -1762
  272. package/lib/src/raw_types/ameli.js +0 -1074
  273. package/lib/src/raw_types/debats.d.ts +0 -380
  274. package/lib/src/raw_types/debats.js +0 -266
  275. package/lib/src/raw_types/dosleg.d.ts +0 -2954
  276. package/lib/src/raw_types/dosleg.js +0 -2005
  277. package/lib/src/raw_types/questions.d.ts +0 -699
  278. package/lib/src/raw_types/questions.js +0 -493
  279. package/lib/src/raw_types/senat.d.ts +0 -11372
  280. package/lib/src/raw_types/senat.js +0 -5
  281. package/lib/src/raw_types/sens.d.ts +0 -7843
  282. package/lib/src/raw_types/sens.js +0 -4691
  283. package/lib/src/raw_types_schemats/ameli.d.ts +0 -541
  284. package/lib/src/raw_types_schemats/ameli.js +0 -2
  285. package/lib/src/raw_types_schemats/debats.d.ts +0 -127
  286. package/lib/src/raw_types_schemats/debats.js +0 -2
  287. package/lib/src/raw_types_schemats/dosleg.d.ts +0 -977
  288. package/lib/src/raw_types_schemats/dosleg.js +0 -2
  289. package/lib/src/raw_types_schemats/questions.d.ts +0 -237
  290. package/lib/src/raw_types_schemats/questions.js +0 -2
  291. package/lib/src/raw_types_schemats/sens.d.ts +0 -2709
  292. package/lib/src/raw_types_schemats/sens.js +0 -2
  293. package/lib/src/rich_types/agenda.d.ts +0 -45
  294. package/lib/src/rich_types/agenda.js +0 -1
  295. package/lib/src/rich_types/compte_rendu.d.ts +0 -83
  296. package/lib/src/rich_types/compte_rendu.js +0 -1
  297. package/lib/src/rich_types/sessions.d.ts +0 -6
  298. package/lib/src/rich_types/sessions.js +0 -19
  299. package/lib/src/rich_types/texte.d.ts +0 -72
  300. package/lib/src/rich_types/texte.js +0 -15
  301. package/lib/src/scripts/test_iter_load.d.ts +0 -1
  302. package/lib/src/scripts/test_iter_load.js +0 -12
  303. package/lib/src/sens.d.ts +0 -104
  304. package/lib/src/sens.js +0 -1
  305. package/lib/src/types/agenda.d.ts +0 -45
  306. package/lib/src/types/agenda.js +0 -1
  307. package/lib/src/types/ameli.d.ts +0 -1762
  308. package/lib/src/types/ameli.js +0 -1074
  309. package/lib/src/types/compte_rendu.d.ts +0 -83
  310. package/lib/src/types/compte_rendu.js +0 -1
  311. package/lib/src/types/debats.d.ts +0 -380
  312. package/lib/src/types/debats.js +0 -266
  313. package/lib/src/types/dosleg.d.ts +0 -2954
  314. package/lib/src/types/dosleg.js +0 -2005
  315. package/lib/src/types/questions.d.ts +0 -699
  316. package/lib/src/types/questions.js +0 -493
  317. package/lib/src/types/sens.d.ts +0 -7843
  318. package/lib/src/types/sens.js +0 -4691
  319. package/lib/src/types/sessions.d.ts +0 -6
  320. package/lib/src/types/sessions.js +0 -19
  321. package/lib/src/types/texte.d.ts +0 -72
  322. package/lib/src/types/texte.js +0 -15
  323. package/lib/src/validators/config.d.ts +0 -9
  324. package/lib/src/validators/config.js +0 -10
  325. package/lib/strings.d.ts +0 -1
  326. package/lib/strings.js +0 -18
  327. package/lib/strings.mjs +0 -18
  328. package/lib/strings.ts +0 -26
  329. package/lib/tsconfig.tsbuildinfo +0 -1
  330. package/lib/types/agenda.d.ts +0 -44
  331. package/lib/types/agenda.js +0 -1
  332. package/lib/types/ameli.d.ts +0 -5
  333. package/lib/types/ameli.js +0 -1
  334. package/lib/types/ameli.mjs +0 -13
  335. package/lib/types/ameli.ts +0 -21
  336. package/lib/types/compte_rendu.d.ts +0 -83
  337. package/lib/types/compte_rendu.js +0 -1
  338. package/lib/types/debats.d.ts +0 -2
  339. package/lib/types/debats.js +0 -1
  340. package/lib/types/debats.mjs +0 -2
  341. package/lib/types/debats.ts +0 -6
  342. package/lib/types/dosleg.d.ts +0 -70
  343. package/lib/types/dosleg.js +0 -1
  344. package/lib/types/dosleg.mjs +0 -151
  345. package/lib/types/dosleg.ts +0 -284
  346. package/lib/types/questions.d.ts +0 -2
  347. package/lib/types/questions.js +0 -1
  348. package/lib/types/questions.mjs +0 -1
  349. package/lib/types/questions.ts +0 -3
  350. package/lib/types/sens.d.ts +0 -10
  351. package/lib/types/sens.js +0 -1
  352. package/lib/types/sens.mjs +0 -1
  353. package/lib/types/sens.ts +0 -12
  354. package/lib/types/sessions.d.ts +0 -5
  355. package/lib/types/sessions.js +0 -84
  356. package/lib/types/sessions.mjs +0 -43
  357. package/lib/types/sessions.ts +0 -42
  358. package/lib/types/texte.d.ts +0 -74
  359. package/lib/types/texte.js +0 -16
  360. package/lib/types/texte.mjs +0 -16
  361. package/lib/types/texte.ts +0 -76
  362. package/lib/typings/windows-1252.d.js +0 -2
  363. package/lib/typings/windows-1252.d.mjs +0 -2
  364. package/lib/typings/windows-1252.d.ts +0 -11
  365. package/lib/utils/cr_spliting.d.ts +0 -28
  366. package/lib/utils/cr_spliting.js +0 -265
  367. package/lib/utils/date.d.ts +0 -10
  368. package/lib/utils/date.js +0 -100
  369. package/lib/utils/nvs-timecode.d.ts +0 -7
  370. package/lib/utils/nvs-timecode.js +0 -79
  371. package/lib/utils/reunion_grouping.d.ts +0 -9
  372. package/lib/utils/reunion_grouping.js +0 -361
  373. package/lib/utils/reunion_odj_building.d.ts +0 -5
  374. package/lib/utils/reunion_odj_building.js +0 -154
  375. package/lib/utils/reunion_parsing.d.ts +0 -23
  376. package/lib/utils/reunion_parsing.js +0 -209
  377. package/lib/utils/scoring.d.ts +0 -14
  378. package/lib/utils/scoring.js +0 -147
  379. package/lib/utils/string_cleaning.d.ts +0 -7
  380. package/lib/utils/string_cleaning.js +0 -57
  381. package/lib/validators/config.d.ts +0 -9
  382. package/lib/validators/config.js +0 -10
  383. package/lib/validators/config.mjs +0 -54
  384. package/lib/validators/config.ts +0 -79
  385. package/lib/validators/senat.d.ts +0 -0
  386. package/lib/validators/senat.js +0 -28
  387. package/lib/validators/senat.mjs +0 -24
  388. package/lib/validators/senat.ts +0 -26
  389. /package/lib/{add-js-extensions-v2.d.ts → src/other_types/collaborateurs.js} +0 -0
  390. /package/lib/{add-js-extensions.d.ts → src/scripts/retrieve_collaborateurs.d.ts} +0 -0
  391. /package/lib/{scripts/convert_data.d.ts → tests/collaborateurs.test.d.ts} +0 -0
@@ -1,52 +0,0 @@
1
- import { AmendementResult } from "./model/ameli.js";
2
- import { DebatResult } from "./model/debats.js";
3
- import { DossierLegislatifResult } from "./model/dosleg.js";
4
- import { QuestionResult } from "./model/questions.js";
5
- import { ScrutinResult } from "./model/scrutins.js";
6
- import { CirconscriptionResult, OrganismeResult, SenateurResult } from "./model/sens.js";
7
- import { Reunion } from "./rich_types/agenda.js";
8
- import { FlatTexte, DocumentMetadata } from "./rich_types/texte.js";
9
- import { CompteRendu } from "./rich_types/compte_rendu.js";
10
- import { DocumentResult } from "./model/documents.js";
11
- export { EnabledDatasets } from "./datasets.js";
12
- export type { DocumentResult } from "./model/documents.js";
13
- export declare const AGENDA_FOLDER = "agenda";
14
- export declare const COMPTES_RENDUS_FOLDER = "seances";
15
- export declare const COMMISSION_FOLDER = "commissions";
16
- export declare const DOSLEG_DOSSIERS_FOLDER = "dossiers";
17
- export declare const ENRICHED_TEXTE_FOLDER = "leg_enrichi";
18
- export declare const SCRUTINS_FOLDER = "scrutins";
19
- export declare const SENS_CIRCONSCRIPTIONS_FOLDER = "circonscriptions";
20
- export declare const SENS_ORGANISMES_FOLDER = "organismes";
21
- export declare const SENS_SENATEURS_FOLDER = "senateurs";
22
- export declare const TEXTE_FOLDER = "leg";
23
- export declare const RAPPORT_FOLDER = "rap";
24
- export declare const DATA_ORIGINAL_FOLDER = "original";
25
- export declare const DATA_TRANSFORMED_FOLDER = "transformed";
26
- export declare const DOCUMENT_METADATA_FILE = "metadata.json";
27
- export type IterItem<T> = {
28
- item: T;
29
- filePathFromDataset?: string;
30
- legislature?: number;
31
- gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
32
- };
33
- export declare function iterFilePaths(dirPath: string): Generator<string>;
34
- export declare function iterLoadSenatAmendements(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<AmendementResult>>;
35
- export declare function iterLoadSenatDebats(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DebatResult>>;
36
- export declare function iterLoadSenatComptesRendusSeances(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<CompteRendu>>;
37
- export declare function iterLoadSenatComptesRendusCommissions(dataDir: string, session: number, options?: {}): Generator<IterItem<CompteRendu>>;
38
- export declare function iterLoadSenatDossiersLegislatifs(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DossierLegislatifResult>>;
39
- export declare function iterLoadSenatRapportUrls(dataDir: string, session: number | undefined): Generator<IterItem<DocumentMetadata>>;
40
- export declare function iterLoadSenatTexteUrls(dataDir: string, session: number | undefined): Generator<IterItem<DocumentMetadata>>;
41
- export declare function iterLoadSenatRapports(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DocumentResult>>;
42
- export declare function iterLoadSenatTextes(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<DocumentResult & Partial<FlatTexte>>>;
43
- export declare function loadSenatTexteContent(dataDir: string, session: number | string | null | undefined, texteId: string): IterItem<FlatTexte | null>;
44
- export declare function loadSenatCompteRenduContent(dataDir: string, session: number, debatId: string | number): {
45
- item: CompteRendu | null;
46
- };
47
- export declare function iterLoadSenatAgendas(dataDir: string, session: number | undefined): Generator<IterItem<Reunion>>;
48
- export declare function iterLoadSenatCirconscriptions(dataDir: string, options?: {}): Generator<IterItem<CirconscriptionResult>>;
49
- export declare function iterLoadSenatOrganismes(dataDir: string, options?: {}): Generator<IterItem<OrganismeResult>>;
50
- export declare function iterLoadSenatSenateurs(dataDir: string, options?: {}): Generator<IterItem<SenateurResult>>;
51
- export declare function iterLoadSenatQuestions(dataDir: string, legislature: number, options?: {}): Generator<IterItem<QuestionResult>>;
52
- export declare function iterLoadSenatScrutins(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<ScrutinResult>>;
@@ -1,260 +0,0 @@
1
- import fsex from "fs-extra";
2
- import fs from "fs";
3
- import path from "path";
4
- import * as git from "./git.js";
5
- import { datasets } from "./datasets.js";
6
- import { UNDEFINED_SESSION } from "./rich_types/sessions.js";
7
- export { EnabledDatasets } from "./datasets.js";
8
- export const AGENDA_FOLDER = "agenda";
9
- export const COMPTES_RENDUS_FOLDER = "seances";
10
- export const COMMISSION_FOLDER = "commissions";
11
- export const DOSLEG_DOSSIERS_FOLDER = "dossiers";
12
- export const ENRICHED_TEXTE_FOLDER = "leg_enrichi";
13
- export const SCRUTINS_FOLDER = "scrutins";
14
- export const SENS_CIRCONSCRIPTIONS_FOLDER = "circonscriptions";
15
- export const SENS_ORGANISMES_FOLDER = "organismes";
16
- export const SENS_SENATEURS_FOLDER = "senateurs";
17
- export const TEXTE_FOLDER = "leg";
18
- export const RAPPORT_FOLDER = "rap";
19
- export const DATA_ORIGINAL_FOLDER = "original";
20
- export const DATA_TRANSFORMED_FOLDER = "transformed";
21
- export const DOCUMENT_METADATA_FILE = "metadata.json";
22
- export function* iterFilePaths(dirPath) {
23
- if (dirPath && fs.existsSync(dirPath)) {
24
- const files = fs.readdirSync(dirPath, {
25
- withFileTypes: true,
26
- recursive: true,
27
- });
28
- for (const file of files) {
29
- if (file.isFile()) {
30
- yield path.join(file.parentPath, file.name);
31
- }
32
- }
33
- }
34
- }
35
- function* iterLoadSenatItems(dataDir, dataName, legislatureOrSession, subDir, { log = false, sinceCommit } = {}) {
36
- let itemsDir = path.join(dataDir, dataName);
37
- if (subDir) {
38
- itemsDir = path.join(itemsDir, subDir);
39
- }
40
- if (legislatureOrSession) {
41
- itemsDir = path.join(itemsDir, String(legislatureOrSession));
42
- }
43
- // Get changed files if sinceCommit is specified (excluding deleted files)
44
- const changedFiles = sinceCommit
45
- ? git.getChangedFilesSinceCommit(itemsDir, sinceCommit, {
46
- diffFilter: "AMR", // Added, Modified, Renamed
47
- })
48
- : null;
49
- if (log && sinceCommit) {
50
- console.log(`Filtering files changed since commit ${sinceCommit} in ${itemsDir}`);
51
- console.log(`Found ${changedFiles?.size || 0} changed files (AMR)`);
52
- }
53
- for (const filePath of iterFilePaths(itemsDir)) {
54
- if (!filePath.endsWith(".json")) {
55
- continue;
56
- }
57
- const relativePath = path.relative(path.join(dataDir, dataName), filePath);
58
- const gitStatus = changedFiles?.get(relativePath);
59
- // Filter by changed files if sinceCommit is specified
60
- if (changedFiles && !gitStatus) {
61
- // Skip files not in the change set
62
- continue;
63
- }
64
- if (log) {
65
- console.log(`Loading file: ${filePath}…${gitStatus ? ` (${gitStatus})` : ""}`);
66
- }
67
- let item;
68
- try {
69
- const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
70
- item = JSON.parse(itemJson);
71
- }
72
- catch (error) {
73
- const err = error;
74
- console.warn(`[iterLoadSenatItems] skipped invalid JSON: ${filePath} (${err.message})`);
75
- continue;
76
- }
77
- const filePathFromDataset = filePath.substring(filePath.indexOf(dataName) + dataName.length);
78
- yield {
79
- item,
80
- filePathFromDataset,
81
- legislature: legislatureOrSession,
82
- ...(gitStatus && { gitStatus }), // Include gitStatus
83
- };
84
- }
85
- // Yield deleted files at the end if sinceCommit is specified
86
- if (sinceCommit) {
87
- const deletedFiles = git.getChangedFilesSinceCommit(itemsDir, sinceCommit, {
88
- diffFilter: "D", // Deleted
89
- });
90
- if (log) {
91
- console.log(`Found ${deletedFiles.size || 0} deleted files (D)`);
92
- }
93
- for (const [relativePath, status] of deletedFiles.entries()) {
94
- const deletedFilePath = path.join(itemsDir, relativePath);
95
- if (log) {
96
- console.log(`Deleted file: ${deletedFilePath}`);
97
- }
98
- // Extract UID from filename (remove extension) for the placeholder item
99
- const fileExtension = path.extname(relativePath) || ".json"; // Assuming files use an extension like .json
100
- const filename = path.basename(relativePath, fileExtension);
101
- const fakeItem = { uid: filename }; // Placeholder item using uid constraint
102
- const filePathFromDataset = deletedFilePath.substring(deletedFilePath.indexOf(dataName) + dataName.length);
103
- yield {
104
- item: fakeItem,
105
- filePathFromDataset,
106
- legislature: legislatureOrSession,
107
- gitStatus: status,
108
- };
109
- }
110
- }
111
- }
112
- export function* iterLoadSenatAmendements(dataDir, session, options = {}) {
113
- for (const amendementItem of iterLoadSenatItems(dataDir, datasets.ameli.database, session, undefined, options)) {
114
- yield amendementItem;
115
- }
116
- }
117
- export function* iterLoadSenatDebats(dataDir, session, options = {}) {
118
- for (const debatItem of iterLoadSenatItems(dataDir, datasets.debats.database, session, undefined, options)) {
119
- yield debatItem;
120
- }
121
- }
122
- export function* iterLoadSenatComptesRendusSeances(dataDir, session, options = {}) {
123
- for (const compteRenduItem of iterLoadSenatItems(dataDir, COMPTES_RENDUS_FOLDER, session, DATA_TRANSFORMED_FOLDER, options)) {
124
- yield compteRenduItem;
125
- }
126
- }
127
- export function* iterLoadSenatComptesRendusCommissions(dataDir, session, options = {}) {
128
- for (const compteRenduItem of iterLoadSenatItems(dataDir, COMMISSION_FOLDER, session, DATA_TRANSFORMED_FOLDER, options)) {
129
- yield compteRenduItem;
130
- }
131
- }
132
- export function* iterLoadSenatDossiersLegislatifs(dataDir, session, options = {}) {
133
- for (const dossierLegislatifItem of iterLoadSenatItems(dataDir, datasets.dosleg.database, session, DOSLEG_DOSSIERS_FOLDER, options)) {
134
- yield dossierLegislatifItem;
135
- }
136
- }
137
- export function* iterLoadSenatRapportUrls(dataDir, session) {
138
- let itemsDir = path.join(dataDir, RAPPORT_FOLDER, DATA_ORIGINAL_FOLDER);
139
- if (session) {
140
- itemsDir = path.join(itemsDir, session.toString());
141
- }
142
- for (const filePath of iterFilePaths(itemsDir)) {
143
- const parsedFilePath = path.parse(filePath);
144
- if (parsedFilePath.base === DOCUMENT_METADATA_FILE) {
145
- const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
146
- const item = JSON.parse(itemJson);
147
- yield {
148
- item,
149
- };
150
- }
151
- }
152
- }
153
- export function* iterLoadSenatTexteUrls(dataDir, session) {
154
- let itemsDir = path.join(dataDir, TEXTE_FOLDER, DATA_ORIGINAL_FOLDER);
155
- if (session) {
156
- itemsDir = path.join(itemsDir, session.toString());
157
- }
158
- for (const filePath of iterFilePaths(itemsDir)) {
159
- const parsedFilePath = path.parse(filePath);
160
- if (parsedFilePath.base === DOCUMENT_METADATA_FILE) {
161
- const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
162
- const item = JSON.parse(itemJson);
163
- yield {
164
- item,
165
- };
166
- }
167
- }
168
- }
169
- export function* iterLoadSenatRapports(dataDir, session, options = {}) {
170
- for (const iterItem of iterLoadSenatItems(dataDir, RAPPORT_FOLDER, session, "original", options)) {
171
- if (iterItem.item?.["id"]) {
172
- yield iterItem;
173
- }
174
- }
175
- }
176
- export function* iterLoadSenatTextes(dataDir, session, options = {}) {
177
- for (const iterItem of iterLoadSenatItems(dataDir, TEXTE_FOLDER, session, DATA_ORIGINAL_FOLDER, options)) {
178
- if (!iterItem.item?.["id"]) {
179
- continue;
180
- }
181
- const texteItem = iterItem;
182
- const texte = texteItem.item;
183
- const texteId = texte["id"];
184
- if (!texteId) {
185
- continue;
186
- }
187
- const { item: texteContent } = loadSenatTexteContent(dataDir, texte["session"], texteId);
188
- if (texteContent) {
189
- texteItem.item = { ...texteContent, ...texteItem.item };
190
- }
191
- yield texteItem;
192
- }
193
- }
194
- export function loadSenatTexteContent(dataDir, session, texteId) {
195
- const fullTextePath = path.join(dataDir, TEXTE_FOLDER, DATA_TRANSFORMED_FOLDER, String(session ?? UNDEFINED_SESSION), texteId, `${texteId}.json`);
196
- if (!fs.existsSync(fullTextePath)) {
197
- return { item: null };
198
- }
199
- const texteJson = fs.readFileSync(fullTextePath, { encoding: "utf8" });
200
- return { item: JSON.parse(texteJson) };
201
- }
202
- export function loadSenatCompteRenduContent(dataDir, session, debatId) {
203
- const fullPath = path.join(dataDir, COMPTES_RENDUS_FOLDER, DATA_TRANSFORMED_FOLDER, String(session), `${debatId}.json`);
204
- if (!fs.existsSync(fullPath)) {
205
- return { item: null };
206
- }
207
- const json = fs.readFileSync(fullPath, { encoding: "utf8" });
208
- return { item: JSON.parse(json) };
209
- }
210
- export function* iterLoadSenatAgendas(dataDir, session) {
211
- const baseDir = path.join(dataDir, AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER, String(session ?? ""));
212
- if (!fs.existsSync(baseDir))
213
- return;
214
- const files = (fs.readdirSync(baseDir) || []).filter((f) => f.startsWith("RUSN") && f.endsWith(".json")).sort();
215
- for (const fileName of files) {
216
- const filePath = path.join(baseDir, fileName);
217
- let raw;
218
- try {
219
- raw = fsex.readJSONSync(filePath);
220
- }
221
- catch {
222
- continue; // JSON invalide
223
- }
224
- if (!raw || typeof raw !== "object")
225
- continue;
226
- const gr = raw;
227
- if (!gr.uid || !gr.date || !gr.titre)
228
- continue;
229
- const reunion = {
230
- ...gr,
231
- events: Array.isArray(gr.events) ? gr.events : [],
232
- };
233
- yield { item: reunion };
234
- }
235
- }
236
- export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
237
- for (const circonscriptionItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_CIRCONSCRIPTIONS_FOLDER, options)) {
238
- yield circonscriptionItem;
239
- }
240
- }
241
- export function* iterLoadSenatOrganismes(dataDir, options = {}) {
242
- for (const organismeItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_ORGANISMES_FOLDER, options)) {
243
- yield organismeItem;
244
- }
245
- }
246
- export function* iterLoadSenatSenateurs(dataDir, options = {}) {
247
- for (const senateurItem of iterLoadSenatItems(dataDir, datasets.sens.database, undefined, SENS_SENATEURS_FOLDER, options)) {
248
- yield senateurItem;
249
- }
250
- }
251
- export function* iterLoadSenatQuestions(dataDir, legislature, options = {}) {
252
- for (const questionItem of iterLoadSenatItems(dataDir, datasets.questions.database, legislature, undefined, options)) {
253
- yield questionItem;
254
- }
255
- }
256
- export function* iterLoadSenatScrutins(dataDir, session, options = {}) {
257
- for (const scrutinItem of iterLoadSenatItems(dataDir, "scrutins", session, undefined, options)) {
258
- yield scrutinItem;
259
- }
260
- }
@@ -1,6 +0,0 @@
1
- import { AgendaEvent } from "../rich_types/agenda.js";
2
- export declare function getStartAndEndTimes(timeStr: string | null | undefined, dateISO: string): {
3
- startTime: string | null;
4
- endTime: string | null;
5
- };
6
- export declare function parseAgendaFromFile(htmlFilePath: string): Promise<AgendaEvent[] | null>;
@@ -1,148 +0,0 @@
1
- import { JSDOM } from "jsdom";
2
- import { DateTime } from "luxon";
3
- import path from "path";
4
- import { ID_DATE_FORMAT, STANDARD_DATE_FORMAT } from "../scripts/datautil.js";
5
- const FR_TZ = "Europe/Paris";
6
- function eventIsSeance(eventElement) {
7
- return eventElement.classList.contains("evt-seance");
8
- }
9
- function getEventType(eventClasses) {
10
- const typeClass = [...eventClasses].find((className) => className.startsWith("evt-")) || null;
11
- switch (typeClass) {
12
- case "evt-seance":
13
- return "Séance publique";
14
- case "evt-instanz":
15
- return "Commissions";
16
- case "evt-cemi":
17
- return "Mission de contrôle";
18
- case "evt-deleg":
19
- return "Offices et délégations";
20
- case "evt-bureau":
21
- return "Instances décisionnelles";
22
- }
23
- return null;
24
- }
25
- function getUrlDossierSenat(lienElements) {
26
- const urlElement = [...lienElements].find((lienElement) => lienElement.textContent?.includes("dossier législatif"));
27
- return urlElement ? urlElement.getAttribute("href") : null;
28
- }
29
- function getQuantieme(eventElement, seancesElements) {
30
- const seanceIndex = seancesElements.indexOf(eventElement);
31
- if (seancesElements.length === 1 && seanceIndex === 0) {
32
- return "Unique";
33
- }
34
- else {
35
- switch (seanceIndex) {
36
- case 0:
37
- return "Première";
38
- case 1:
39
- return "Deuxième";
40
- case 2:
41
- return "Troisième";
42
- case 3:
43
- return "Quatrième";
44
- case 4:
45
- return "Cinquième";
46
- }
47
- }
48
- return "Non défini";
49
- }
50
- /**
51
- * Normalize time string to become a simple start time ("H'h'mm") or a duration ("'de 'H'h'mm' à 'H'h'mm").
52
- */
53
- function normalizeTime(timeStr) {
54
- return timeStr
55
- ?.replace(/^À l'issue de l'espace réservé .* et au plus tard\s/i, "") // Must be processed first
56
- ?.replace(/^(?:le )?matin/i, "10h00") // We chose "matin" to mean 10h00
57
- ?.replace(/^(?:l')?après-midi/i, "16h00") // We chose "après-midi" to mean 16h00
58
- ?.replace(/^(?:le )?soir/i, "20h00") // We chose "soir" to mean 20h00
59
- ?.replace(/^(?:la )?nuit/i, "22h00") // We chose "nuit" to mean 22h00
60
- ?.replace(/^à\s/gi, "")
61
- ?.replace(/heures/gi, "h00")
62
- ?.replace(/\set.*/i, "")
63
- ?.replace(/,.*/, "")
64
- ?.replace(/\s\(hors hémicycle\)/i, "")
65
- ?.replace(/\s*h\s*/gi, "h");
66
- }
67
- export function getStartAndEndTimes(timeStr, dateISO) {
68
- const normalizedTime = normalizeTime(timeStr);
69
- if (!normalizedTime) {
70
- return { startTime: null, endTime: null };
71
- }
72
- const rangeMatch = normalizedTime.match(/^de (?<start>\d{1,2}h\d{2}) à (?<end>\d{1,2}h\d{2})$/i);
73
- const toUtcTimeOnly = (value) => {
74
- if (!value)
75
- return null;
76
- const time = DateTime.fromFormat(value, "H'h'mm", { zone: FR_TZ });
77
- if (!time.isValid)
78
- return null;
79
- const local = DateTime.fromISO(dateISO, { zone: FR_TZ }).set({
80
- hour: time.hour,
81
- minute: time.minute,
82
- second: 0,
83
- millisecond: 0,
84
- });
85
- if (!local.isValid)
86
- return null;
87
- return local.toUTC().toFormat("HH:mm:ss.SSS'Z'");
88
- };
89
- if (rangeMatch?.groups) {
90
- const { start, end } = rangeMatch.groups;
91
- return {
92
- startTime: toUtcTimeOnly(start),
93
- endTime: toUtcTimeOnly(end),
94
- };
95
- }
96
- return {
97
- startTime: toUtcTimeOnly(normalizedTime),
98
- endTime: null,
99
- };
100
- }
101
- function transformAgenda(document, fileName) {
102
- const agendaEvents = [];
103
- const eventElements = document.querySelectorAll(".evt");
104
- const seanceElements = Array.from(eventElements).filter((eventElement) => eventIsSeance(eventElement));
105
- for (const eventElement of eventElements) {
106
- const id = eventElement.previousElementSibling?.getAttribute("name") || null;
107
- if (!id) {
108
- continue;
109
- }
110
- const type = getEventType(eventElement.classList);
111
- const date = DateTime.fromFormat(fileName, ID_DATE_FORMAT).toFormat(STANDARD_DATE_FORMAT);
112
- const timeOriginal = eventElement.querySelector(".time")?.textContent || null;
113
- const { startTime, endTime } = getStartAndEndTimes(timeOriginal, date);
114
- const titre = eventElement.querySelector(".titre")?.textContent?.trim() || "";
115
- const organe = eventElement.querySelector(".organe")?.textContent?.trim() || null;
116
- const objet = eventElement.querySelector(".objet")?.textContent?.trim()?.replace(/^- /, "") || null;
117
- const lieu = eventElement.querySelector(".lieu")?.textContent || null;
118
- const videoElement = eventElement.querySelector(".video");
119
- const urlDossierSenat = getUrlDossierSenat(eventElement.querySelectorAll(".lien a"));
120
- agendaEvents.push({
121
- id,
122
- type,
123
- date,
124
- startTime,
125
- endTime,
126
- timeOriginal,
127
- titre,
128
- organe,
129
- objet,
130
- lieu,
131
- captationVideo: videoElement !== null,
132
- urlDossierSenat: urlDossierSenat,
133
- quantieme: eventIsSeance(eventElement) ? getQuantieme(eventElement, seanceElements) : null,
134
- });
135
- }
136
- return agendaEvents;
137
- }
138
- export async function parseAgendaFromFile(htmlFilePath) {
139
- try {
140
- const { document } = (await JSDOM.fromFile(htmlFilePath, { contentType: "text/html" })).window;
141
- const fileName = path.parse(htmlFilePath).name;
142
- return transformAgenda(document, fileName);
143
- }
144
- catch (error) {
145
- console.error(`Could not parse texte with error ${error.message}`);
146
- }
147
- return null;
148
- }
@@ -1,67 +0,0 @@
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
- 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 findAllAmendements(fromSession?: number): AsyncGenerator<AmendementResult, void, unknown>;
@@ -1,150 +0,0 @@
1
- import { streamUnsafeQuery } from "../databases_postgres.js";
2
- function buildFindAllAmendementsQuery(fromSession) {
3
- const params = [];
4
- const whereSession = fromSession === undefined ? "" : "where ses.ann >= $1";
5
- if (fromSession !== undefined) {
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
- };
149
- }
150
- }