@tricoteuses/senat 2.9.0 → 2.9.5

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 (116) hide show
  1. package/LICENSE.md +22 -22
  2. package/README.md +116 -115
  3. package/lib/loaders.d.ts +1 -1
  4. package/lib/model/agenda.js +2 -0
  5. package/lib/scripts/retrieve_videos.js +420 -0
  6. package/lib/types/agenda.d.ts +2 -0
  7. package/package.json +95 -94
  8. package/lib/aggregates.d.ts +0 -52
  9. package/lib/aggregates.js +0 -949
  10. package/lib/aggregates.mjs +0 -726
  11. package/lib/aggregates.ts +0 -852
  12. package/lib/config.mjs +0 -16
  13. package/lib/config.ts +0 -26
  14. package/lib/databases.mjs +0 -55
  15. package/lib/databases.ts +0 -68
  16. package/lib/datasets.mjs +0 -78
  17. package/lib/datasets.ts +0 -118
  18. package/lib/fields.d.ts +0 -10
  19. package/lib/fields.js +0 -68
  20. package/lib/fields.mjs +0 -22
  21. package/lib/fields.ts +0 -29
  22. package/lib/index.mjs +0 -7
  23. package/lib/index.ts +0 -64
  24. package/lib/inserters.d.ts +0 -98
  25. package/lib/inserters.js +0 -500
  26. package/lib/inserters.mjs +0 -360
  27. package/lib/inserters.ts +0 -521
  28. package/lib/legislatures.json +0 -38
  29. package/lib/loaders.mjs +0 -97
  30. package/lib/loaders.ts +0 -173
  31. package/lib/model/ameli.mjs +0 -57
  32. package/lib/model/ameli.ts +0 -86
  33. package/lib/model/debats.mjs +0 -43
  34. package/lib/model/debats.ts +0 -68
  35. package/lib/model/dosleg.mjs +0 -163
  36. package/lib/model/dosleg.ts +0 -204
  37. package/lib/model/index.mjs +0 -4
  38. package/lib/model/index.ts +0 -13
  39. package/lib/model/questions.mjs +0 -76
  40. package/lib/model/questions.ts +0 -102
  41. package/lib/model/sens.mjs +0 -339
  42. package/lib/model/sens.ts +0 -432
  43. package/lib/model/texte.mjs +0 -156
  44. package/lib/model/texte.ts +0 -174
  45. package/lib/raw_types_kysely/ameli.d.ts +0 -915
  46. package/lib/raw_types_kysely/ameli.js +0 -7
  47. package/lib/raw_types_kysely/ameli.mjs +0 -5
  48. package/lib/raw_types_kysely/ameli.ts +0 -951
  49. package/lib/raw_types_kysely/debats.d.ts +0 -207
  50. package/lib/raw_types_kysely/debats.js +0 -7
  51. package/lib/raw_types_kysely/debats.mjs +0 -5
  52. package/lib/raw_types_kysely/debats.ts +0 -222
  53. package/lib/raw_types_kysely/dosleg.d.ts +0 -3532
  54. package/lib/raw_types_kysely/dosleg.js +0 -7
  55. package/lib/raw_types_kysely/dosleg.mjs +0 -5
  56. package/lib/raw_types_kysely/dosleg.ts +0 -3621
  57. package/lib/raw_types_kysely/questions.d.ts +0 -414
  58. package/lib/raw_types_kysely/questions.js +0 -7
  59. package/lib/raw_types_kysely/questions.mjs +0 -5
  60. package/lib/raw_types_kysely/questions.ts +0 -426
  61. package/lib/raw_types_kysely/sens.d.ts +0 -4394
  62. package/lib/raw_types_kysely/sens.js +0 -7
  63. package/lib/raw_types_kysely/sens.mjs +0 -5
  64. package/lib/raw_types_kysely/sens.ts +0 -4499
  65. package/lib/raw_types_schemats/ameli.mjs +0 -2
  66. package/lib/raw_types_schemats/ameli.ts +0 -601
  67. package/lib/raw_types_schemats/debats.mjs +0 -2
  68. package/lib/raw_types_schemats/debats.ts +0 -145
  69. package/lib/raw_types_schemats/dosleg.mjs +0 -2
  70. package/lib/raw_types_schemats/dosleg.ts +0 -2193
  71. package/lib/raw_types_schemats/questions.mjs +0 -2
  72. package/lib/raw_types_schemats/questions.ts +0 -249
  73. package/lib/raw_types_schemats/sens.mjs +0 -2
  74. package/lib/raw_types_schemats/sens.ts +0 -2907
  75. package/lib/scripts/convert_data.mjs +0 -95
  76. package/lib/scripts/convert_data.ts +0 -119
  77. package/lib/scripts/datautil.mjs +0 -16
  78. package/lib/scripts/datautil.ts +0 -19
  79. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  80. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  81. package/lib/scripts/parse_textes.mjs +0 -38
  82. package/lib/scripts/parse_textes.ts +0 -52
  83. package/lib/scripts/retrieve_documents.mjs +0 -243
  84. package/lib/scripts/retrieve_documents.ts +0 -279
  85. package/lib/scripts/retrieve_open_data.mjs +0 -214
  86. package/lib/scripts/retrieve_open_data.ts +0 -261
  87. package/lib/scripts/retrieve_senateurs_photos.mjs +0 -147
  88. package/lib/scripts/retrieve_senateurs_photos.ts +0 -177
  89. package/lib/scripts/retrieve_textes.mjs +0 -165
  90. package/lib/scripts/retrieve_textes.ts +0 -79
  91. package/lib/scripts/shared/cli_helpers.ts +0 -36
  92. package/lib/scripts/shared/util.ts +0 -33
  93. package/lib/strings.mjs +0 -18
  94. package/lib/strings.ts +0 -26
  95. package/lib/types/ameli.mjs +0 -13
  96. package/lib/types/ameli.ts +0 -21
  97. package/lib/types/debats.mjs +0 -2
  98. package/lib/types/debats.ts +0 -6
  99. package/lib/types/dosleg.mjs +0 -151
  100. package/lib/types/dosleg.ts +0 -284
  101. package/lib/types/questions.mjs +0 -1
  102. package/lib/types/questions.ts +0 -3
  103. package/lib/types/sens.mjs +0 -1
  104. package/lib/types/sens.ts +0 -12
  105. package/lib/types/sessions.mjs +0 -43
  106. package/lib/types/sessions.ts +0 -42
  107. package/lib/types/texte.mjs +0 -16
  108. package/lib/types/texte.ts +0 -66
  109. package/lib/typings/windows-1252.d.js +0 -2
  110. package/lib/typings/windows-1252.d.mjs +0 -2
  111. package/lib/typings/windows-1252.d.ts +0 -11
  112. package/lib/validators/config.mjs +0 -54
  113. package/lib/validators/config.ts +0 -79
  114. package/lib/validators/senat.mjs +0 -24
  115. package/lib/validators/senat.ts +0 -26
  116. /package/lib/scripts/{retrieve_textes.d.ts → retrieve_videos.d.ts} +0 -0
package/LICENSE.md CHANGED
@@ -1,22 +1,22 @@
1
- # Tricoteuses-Senat
2
-
3
- ## _Handle French Sénat's open data_
4
-
5
- By: Emmanuel Raviart <mailto:emmanuel@raviart.com>
6
-
7
- Copyright (C) 2019, 2020, 2021 Emmanuel Raviart
8
-
9
- https://git.tricoteuses.fr/logiciels/tricoteuses-senat
10
-
11
- > Tricoteuses-Senat is free software; you can redistribute it and/or modify
12
- > it under the terms of the GNU Affero General Public License as
13
- > published by the Free Software Foundation, either version 3 of the
14
- > License, or (at your option) any later version.
15
- >
16
- > Tricoteuses-Senat is distributed in the hope that it will be useful,
17
- > but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- > GNU Affero General Public License for more details.
20
- >
21
- > You should have received a copy of the GNU Affero General Public License
22
- > along with this program. If not, see <http://www.gnu.org/licenses/>.
1
+ # Tricoteuses-Senat
2
+
3
+ ## _Handle French Sénat's open data_
4
+
5
+ By: Emmanuel Raviart <mailto:emmanuel@raviart.com>
6
+
7
+ Copyright (C) 2019, 2020, 2021 Emmanuel Raviart
8
+
9
+ https://git.tricoteuses.fr/logiciels/tricoteuses-senat
10
+
11
+ > Tricoteuses-Senat is free software; you can redistribute it and/or modify
12
+ > it under the terms of the GNU Affero General Public License as
13
+ > published by the Free Software Foundation, either version 3 of the
14
+ > License, or (at your option) any later version.
15
+ >
16
+ > Tricoteuses-Senat is distributed in the hope that it will be useful,
17
+ > but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ > GNU Affero General Public License for more details.
20
+ >
21
+ > You should have received a copy of the GNU Affero General Public License
22
+ > along with this program. If not, see <http://www.gnu.org/licenses/>.
package/README.md CHANGED
@@ -1,115 +1,116 @@
1
- # Tricoteuses-Senat
2
-
3
- ## _Retrieve, clean up & handle French Sénat's open data_
4
-
5
- ## Requirements
6
-
7
- - Node >= 22
8
-
9
- ## Installation
10
-
11
- ```bash
12
- git clone https://git.tricoteuses.fr/logiciels/tricoteuses-senat
13
- cd tricoteuses-senat/
14
- ```
15
-
16
- Create a `.env` file to set PostgreSQL database informations and other configuration variables (you can use `example.env` as a template). Then
17
-
18
- ```bash
19
- npm install
20
- ```
21
-
22
- ### Database creation (not needed if downloading with Docker image)
23
-
24
- #### Using Docker
25
-
26
- ```bash
27
- docker run --name local-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=$YOUR_CUSTOM_DB_PASSWORD postgres
28
- # Default Postgres user is postgres
29
- # But scripts require an "opendata" role
30
- docker exec -it local-postgres psql -U postgres -c "CREATE ROLE opendata;"
31
- ```
32
-
33
- ## Download data
34
-
35
- Create a folder where the data will be downloaded and run the following command to download the data and convert it into JSON files.
36
-
37
- ```bash
38
- mkdir ../senat-data/
39
-
40
- # Available options for optional `categories` parameter : All, Ameli, Debats, DosLeg, Questions, Sens
41
- npm run data:download ../senat-data -- [--categories All]
42
- ```
43
-
44
- Data from other sources is also available :
45
- ```bash
46
- # Retrieval of textes and rapports from Sénat's website
47
- # Available options for optional `formats` parameter : xml, html, pdf
48
- # Available options for optional `types` parameter : textes, rapports
49
- npm run data:retrieve_documents ../senat-data -- --fromSession 2022 [--formats xml pdf] [--types textes]
50
-
51
- # Retrieval & parsing (textes in xml format only for now)
52
- npm run data:retrieve_documents ../senat-data -- --fromSession 2022 --parseDocuments
53
-
54
- # Parsing only
55
- npm run data:parse_textes_lois ../senat-data
56
-
57
- # Retrieval (& parsing) of agenda from Sénat's website
58
- npm run data:retrieve_agenda ../senat-data -- --fromSession 2022 [--parseAgenda]
59
-
60
- # Retrieval (& parsing) of comptes-rendus des débats from Sénat's website
61
- npm run data:retrieve_comptes_rendus ../senat-data -- [--parseDebats]
62
-
63
- # Retrieval of sénateurs' pictures from Sénat's website
64
- npm run data:retrieve_senateurs_photos ../senat-data
65
- ```
66
-
67
- ## Data download using Docker
68
-
69
- A Docker image that downloads and converts the data all at once is available. Build it locally or run it from the container registry.
70
- Use the environment variables `FROM_SESSION` and `CATEGORIES` if needed.
71
-
72
- ```bash
73
- docker run --pull always --name tricoteuses-senat -v ../senat-data:/app/senat-data -d git.tricoteuses.fr/logiciels/tricoteuses-senat:latest
74
- ```
75
-
76
- Use the environment variable `CATEGORIES` and `FROM_SESSION` if needed.
77
-
78
- ## Using the data
79
-
80
- Once the data is downloaded, you can use loaders to retrieve it.
81
- To use loaders in your project, you can install the _@tricoteuses/senat_ package, and import the iterator functions that you need.
82
-
83
- ```bash
84
- npm install @tricoteuses/senat
85
- ```
86
-
87
- ```js
88
- import { iterLoadSenatQuestions } from "@tricoteuses/senat/loaders"
89
-
90
- // Pass data directory and legislature as arguments
91
- for (const { item: question } of iterLoadSenatQuestions("../senat-data", 17)) {
92
- console.log(question.id)
93
- }
94
- ```
95
-
96
- ## Generation of raw types from SQL schema (for contributors only)
97
-
98
- ```bash
99
- npm run data:generate_schemas ../senat-data
100
- ```
101
-
102
- ## Publishing
103
-
104
- To publish a new version of this package onto npm, bump the package version and publish.
105
-
106
- ```bash
107
- npm version x.y.z # Bumps version in package.json and creates a new tag x.y.z
108
- npm publish
109
- ```
110
-
111
- The Docker image will be automatically built during a CI Workflow if you push the tag to the remote repository.
112
-
113
- ```bash
114
- git push --tags
115
- ```
1
+ # Tricoteuses-Senat
2
+
3
+ ## _Retrieve, clean up & handle French Sénat's open data_
4
+
5
+ ## Requirements
6
+
7
+ - Node >= 22
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ git clone https://git.tricoteuses.fr/logiciels/tricoteuses-senat
13
+ cd tricoteuses-senat/
14
+ ```
15
+
16
+ Create a `.env` file to set PostgreSQL database informations and other configuration variables (you can use `example.env` as a template). Then
17
+
18
+ ```bash
19
+ npm install
20
+ ```
21
+
22
+ ### Database creation (not needed if downloading with Docker image)
23
+
24
+ #### Using Docker
25
+
26
+ ```bash
27
+ docker run --name local-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=$YOUR_CUSTOM_DB_PASSWORD postgres
28
+ # Default Postgres user is postgres
29
+ # But scripts require an "opendata" role
30
+ docker exec -it local-postgres psql -U postgres -c "CREATE ROLE opendata;"
31
+ ```
32
+
33
+ ## Download data
34
+
35
+ Create a folder where the data will be downloaded and run the following command to download the data and convert it into JSON files.
36
+
37
+ ```bash
38
+ mkdir ../senat-data/
39
+
40
+ # Available options for optional `categories` parameter : All, Ameli, Debats, DosLeg, Questions, Sens
41
+ npm run data:download ../senat-data -- [--categories All]
42
+ ```
43
+
44
+ Data from other sources is also available :
45
+ ```bash
46
+ # Retrieval of textes and rapports from Sénat's website
47
+ # Available options for optional `formats` parameter : xml, html, pdf
48
+ # Available options for optional `types` parameter : textes, rapports
49
+ npm run data:retrieve_documents ../senat-data -- --fromSession 2022 [--formats xml pdf] [--types textes]
50
+
51
+ # Retrieval & parsing (textes in xml format only for now)
52
+ npm run data:retrieve_documents ../senat-data -- --fromSession 2022 --parseDocuments
53
+
54
+ # Parsing only
55
+ npm run data:parse_textes_lois ../senat-data
56
+
57
+ # Retrieval (& parsing) of agenda from Sénat's website
58
+ npm run data:retrieve_agenda ../senat-data -- --fromSession 2022 [--parseAgenda]
59
+
60
+ # Retrieval (& parsing) of comptes-rendus des débats from Sénat's website
61
+ npm run data:retrieve_comptes_rendus ../senat-data -- [--parseDebats]
62
+
63
+ # Retrieval of sénateurs' pictures from Sénat's website
64
+ npm run data:retrieve_senateurs_photos ../senat-data
65
+ ```
66
+
67
+ ## Data download using Docker
68
+
69
+ A Docker image that downloads and converts the data all at once is available. Build it locally or run it from the container registry.
70
+ Use the environment variables `FROM_SESSION` and `CATEGORIES` if needed.
71
+
72
+ ```bash
73
+ docker run --pull always --name tricoteuses-senat -v ../senat-data:/app/senat-data -d git.tricoteuses.fr/logiciels/tricoteuses-senat:latest
74
+ ```
75
+
76
+ Use the environment variable `CATEGORIES` and `FROM_SESSION` if needed.
77
+
78
+ ## Using the data
79
+
80
+ Once the data is downloaded, you can use loaders to retrieve it.
81
+ To use loaders in your project, you can install the _@tricoteuses/senat_ package, and import the iterator functions that you need.
82
+
83
+ ```bash
84
+ npm install @tricoteuses/senat
85
+ ```
86
+
87
+ ```js
88
+ import { iterLoadSenatQuestions } from "@tricoteuses/senat/loaders"
89
+
90
+ // Pass data directory and legislature as arguments
91
+ for (const { item: question } of iterLoadSenatQuestions("../senat-data", 17)) {
92
+ console.log(question.id)
93
+ }
94
+ ```
95
+
96
+ ## Generation of raw types from SQL schema (for contributors only)
97
+
98
+ ```bash
99
+ npm run data:generate_schemas ../senat-data
100
+ ```
101
+
102
+ ## Publishing
103
+
104
+ To publish a new version of this package onto npm, bump the package version and publish.
105
+
106
+ ```bash
107
+ npm version x.y.z # Bumps version in package.json and creates a new tag x.y.z
108
+ npx tsc
109
+ npm publish
110
+ ```
111
+
112
+ The Docker image will be automatically built during a CI Workflow if you push the tag to the remote repository.
113
+
114
+ ```bash
115
+ git push --tags
116
+ ```
package/lib/loaders.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare const TEXTE_FOLDER = "leg";
17
17
  export declare const DATA_ORIGINAL_FOLDER = "original";
18
18
  export declare const DATA_TRANSFORMED_FOLDER = "transformed";
19
19
  export declare const DOCUMENT_METADATA_FILE = "metadata.json";
20
- type IterItem<T> = {
20
+ export type IterItem<T> = {
21
21
  item: T;
22
22
  filePathFromDataset?: string;
23
23
  legislature?: number;
@@ -119,6 +119,8 @@ function transformAgenda(document, fileName) {
119
119
  captationVideo: videoElement !== null,
120
120
  urlDossierSenat: urlDossierSenat,
121
121
  quantieme: eventIsSeance(eventElement) ? getQuantieme(eventElement, seanceElements) : null,
122
+ urlVideo: null,
123
+ timecodeDebutVideo: null
122
124
  });
123
125
  }
124
126
  return agendaEvents;