@tricoteuses/senat 0.3.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/lib/aggregates.d.ts +54 -0
- package/lib/aggregates.js +1122 -0
- package/lib/aggregates.mjs +802 -0
- package/lib/aggregates.ts +947 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.js +49 -0
- package/lib/config.mjs +16 -0
- package/lib/config.ts +26 -0
- package/lib/databases.d.ts +11 -0
- package/lib/databases.js +125 -0
- package/lib/databases.mjs +26 -0
- package/lib/databases.ts +32 -0
- package/lib/datasets.d.ts +28 -0
- package/lib/datasets.js +93 -0
- package/lib/datasets.mjs +78 -0
- package/lib/datasets.ts +118 -0
- package/lib/fields.d.ts +10 -0
- package/lib/fields.js +68 -0
- package/lib/fields.mjs +22 -0
- package/lib/fields.ts +29 -0
- package/lib/index.d.ts +6 -5
- package/lib/index.js +236 -7
- package/lib/index.mjs +6 -1
- package/lib/index.ts +59 -0
- package/lib/inserters.d.ts +6 -2
- package/lib/inserters.js +86 -191
- package/lib/inserters.mjs +19 -3
- package/lib/inserters.ts +545 -0
- package/lib/model/ameli.d.ts +4 -0
- package/lib/model/ameli.js +167 -0
- package/lib/model/ameli.mjs +57 -0
- package/lib/model/ameli.ts +86 -0
- package/lib/model/debats.d.ts +4 -0
- package/lib/model/debats.js +123 -0
- package/lib/model/debats.mjs +43 -0
- package/lib/model/debats.ts +68 -0
- package/lib/model/dosleg.d.ts +29 -0
- package/lib/model/dosleg.js +840 -0
- package/lib/model/dosleg.mjs +337 -0
- package/lib/model/dosleg.ts +558 -0
- package/lib/model/index.d.ts +5 -0
- package/lib/model/index.js +48 -0
- package/lib/model/index.mjs +5 -0
- package/lib/model/index.ts +11 -0
- package/lib/model/questions.d.ts +2 -0
- package/lib/model/questions.js +52 -0
- package/lib/model/questions.mjs +8 -0
- package/lib/model/questions.ts +14 -0
- package/lib/model/sens.d.ts +2 -0
- package/lib/model/sens.js +57 -0
- package/lib/model/sens.mjs +9 -0
- package/lib/model/sens.ts +18 -0
- package/lib/model/util.d.ts +1 -0
- package/lib/model/util.js +60 -0
- package/lib/model/util.mjs +10 -0
- package/lib/model/util.ts +16 -0
- package/lib/raw_types/ameli.d.ts +416 -410
- package/lib/raw_types/ameli.js +26 -144
- package/lib/raw_types/ameli.ts +601 -0
- package/lib/raw_types/debats.d.ts +82 -80
- package/lib/raw_types/debats.js +8 -42
- package/lib/raw_types/debats.ts +145 -0
- package/lib/raw_types/dosleg.d.ts +936 -920
- package/lib/raw_types/dosleg.js +5 -345
- package/lib/raw_types/dosleg.ts +2193 -0
- package/lib/raw_types/questions.d.ts +226 -2
- package/lib/raw_types/questions.js +18 -5
- package/lib/raw_types/questions.mjs +1 -8
- package/lib/raw_types/questions.ts +249 -0
- package/lib/raw_types/sens.d.ts +1180 -1176
- package/lib/raw_types/sens.js +3 -397
- package/lib/raw_types/sens.ts +2907 -0
- package/lib/scripts/convert_data.d.ts +1 -0
- package/lib/scripts/convert_data.js +284 -0
- package/lib/scripts/convert_data.mjs +146 -0
- package/lib/scripts/convert_data.ts +182 -0
- package/lib/scripts/fix_db.d.ts +1 -0
- package/lib/scripts/fix_db.js +144 -0
- package/lib/scripts/fix_db.mjs +64 -0
- package/lib/scripts/fix_db.ts +75 -0
- package/lib/scripts/images/transparent_150x192.jpg +0 -0
- package/lib/scripts/images/transparent_155x225.jpg +0 -0
- package/lib/scripts/retrieve_open_data.d.ts +1 -0
- package/lib/scripts/retrieve_open_data.js +371 -0
- package/lib/scripts/retrieve_open_data.mjs +218 -0
- package/lib/scripts/retrieve_open_data.ts +258 -0
- package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
- package/lib/scripts/retrieve_senateurs_photos.js +268 -0
- package/lib/scripts/retrieve_senateurs_photos.mjs +164 -0
- package/lib/scripts/retrieve_senateurs_photos.ts +200 -0
- package/lib/scripts/retrieve_textes.d.ts +1 -0
- package/lib/scripts/retrieve_textes.js +179 -0
- package/lib/scripts/retrieve_textes.mjs +77 -0
- package/lib/scripts/retrieve_textes.ts +95 -0
- package/lib/strings.d.ts +1 -0
- package/lib/strings.js +49 -0
- package/lib/strings.mjs +18 -0
- package/lib/strings.ts +26 -0
- package/lib/types/ameli.d.ts +5 -0
- package/lib/types/ameli.js +7 -4
- package/lib/types/ameli.mjs +13 -1
- package/lib/types/ameli.ts +21 -0
- package/lib/types/debats.d.ts +2 -0
- package/lib/types/debats.js +4 -3
- package/lib/types/debats.mjs +2 -1
- package/lib/types/debats.ts +6 -0
- package/lib/types/dosleg.d.ts +28 -0
- package/lib/types/dosleg.js +30 -3
- package/lib/types/dosleg.mjs +151 -1
- package/lib/types/dosleg.ts +284 -0
- package/lib/types/questions.d.ts +2 -0
- package/lib/types/questions.js +13 -1
- package/lib/types/questions.mjs +1 -1
- package/lib/types/questions.ts +3 -0
- package/lib/types/sens.d.ts +2 -0
- package/lib/types/sens.js +4 -3
- package/lib/types/sens.mjs +23 -1
- package/lib/types/sens.ts +36 -0
- package/lib/typings/windows-1252.d.js +2 -0
- package/lib/typings/windows-1252.d.mjs +2 -0
- package/lib/typings/windows-1252.d.ts +11 -0
- package/lib/validators/config.d.ts +1 -0
- package/lib/validators/config.js +121 -0
- package/lib/validators/config.mjs +54 -0
- package/lib/validators/config.ts +79 -0
- package/lib/validators/senat.d.ts +0 -0
- package/lib/validators/senat.js +28 -0
- package/lib/validators/senat.mjs +24 -0
- package/lib/validators/senat.ts +26 -0
- package/package.json +35 -4
package/README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
1
|
# Tricoteuses-Senat
|
|
2
2
|
|
|
3
3
|
## _Handle French Sénat's open data_
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://git.en-root.org/tricoteuses/tricoteuses-senat
|
|
9
|
+
cd tricoteuses-senat/
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Create a `.env` file to set PostgreSQL database informations and other configuration variables (you can use `example.env` as a template). Then
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Database creation
|
|
19
|
+
|
|
20
|
+
#### Using Docker
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
docker run --name local-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=$YOUR_CUSTOM_DB_PASSWORD postgres
|
|
24
|
+
# Default Postgres user is postgres
|
|
25
|
+
# But scripts require an "opendata" role
|
|
26
|
+
docker exec -it local-postgres psql -U postgres -c "CREATE ROLE opendata;"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Retrieval, cleaning & import of open data from Sénat
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
mkdir ../senat-data/
|
|
35
|
+
npx babel-node --extensions ".ts" --max-old-space-size=4096 -- src/scripts/retrieve_open_data.ts --fetch --unzip --repair-encoding ../senat-data/
|
|
36
|
+
npx babel-node --extensions ".ts" -- src/scripts/retrieve_open_data.ts --import ../senat-data/
|
|
37
|
+
npx babel-node --extensions ".ts" -- src/scripts/fix_db.ts --updateSchema
|
|
38
|
+
npx babel-node --extensions ".ts" -- src/scripts/convert_data.ts ../senat-data/ [--categories DosLeg]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Retrieval of sénateurs' pictures from Sénat's website
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx babel-node --extensions ".ts" -- src/scripts/retrieve_senateurs_photos.ts --fetch ../senat-data/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Retrieval & cleaning of bills from Sénat HTML pages
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx babel-node --extensions ".ts" -- src/scripts/retrieve_textes.ts ../senat-data/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Generation of raw types from SQL schema.
|
|
54
|
+
|
|
55
|
+
To be run after database has been fixed (`src/scripts/fix_db.ts --updateSchema`).
|
|
56
|
+
```bash
|
|
57
|
+
npx babel-node --extensions ".ts" -- src/scripts/retrieve_open_data.ts --schema ../senat-data/
|
|
58
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Ses, Sub, TxtAmeli } from './types/ameli';
|
|
2
|
+
import { Debat } from './types/debats';
|
|
3
|
+
import { Ass, Aud, Auteur, DateSeance, DecCoc, DenRap, DocAtt, Ecr, EtaLoi, LecAss, LecAssRap, Lecture, Loi, Org, OriTxt, Qua, Rap, Scr, Texte, TypAtt, TypLec, TypLoi, TypTxt, TypUrl } from './types/dosleg';
|
|
4
|
+
import { Question } from './types/questions';
|
|
5
|
+
import { Sen } from './types/sens';
|
|
6
|
+
export declare const allFollows: string[];
|
|
7
|
+
export declare class Aggregator {
|
|
8
|
+
follow: Set<string>;
|
|
9
|
+
objectByIdByTableName: {
|
|
10
|
+
[name: string]: {
|
|
11
|
+
[id: string]: object;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
requestedIdsByTableName: {
|
|
15
|
+
[name: string]: Set<string>;
|
|
16
|
+
};
|
|
17
|
+
visitedIdsByTableName: {
|
|
18
|
+
[name: string]: Set<string>;
|
|
19
|
+
};
|
|
20
|
+
constructor(follow: Set<string>);
|
|
21
|
+
addAss(ass: Ass): void;
|
|
22
|
+
addAud(aud: Aud): void;
|
|
23
|
+
addAuteur(auteur: Auteur): void;
|
|
24
|
+
addDateSeance(dateSeance: DateSeance): void;
|
|
25
|
+
addDebat(debat: Debat): void;
|
|
26
|
+
addDeccoc(deccoc: DecCoc): void;
|
|
27
|
+
addDenrap(denrap: DenRap): void;
|
|
28
|
+
addDocatt(docatt: DocAtt): void;
|
|
29
|
+
addEcr(ecr: Ecr): void;
|
|
30
|
+
addEtaloi(etaloi: EtaLoi): void;
|
|
31
|
+
addLecass(lecass: LecAss): void;
|
|
32
|
+
addLecassrap(lecassrap: LecAssRap): void;
|
|
33
|
+
addLecture(lecture: Lecture): void;
|
|
34
|
+
addLoi(loi: Loi): void;
|
|
35
|
+
addOrg(org: Org): void;
|
|
36
|
+
addOritxt(oritxt: OriTxt): void;
|
|
37
|
+
addQua(qua: Qua): void;
|
|
38
|
+
addQuestion(question: Question): void;
|
|
39
|
+
addRap(rap: Rap): void;
|
|
40
|
+
addScr(scr: Scr): void;
|
|
41
|
+
addSen(sen: Sen): void;
|
|
42
|
+
addSes(ses: Ses): void;
|
|
43
|
+
addSub(sub: Sub): void;
|
|
44
|
+
addTexte(texte: Texte): void;
|
|
45
|
+
addTxtAmeli(txtAmeli: TxtAmeli): void;
|
|
46
|
+
addTypatt(typatt: TypAtt): void;
|
|
47
|
+
addTyplec(typlec: TypLec): void;
|
|
48
|
+
addTyploi(typloi: TypLoi): void;
|
|
49
|
+
addTyptxt(typtxt: TypTxt): void;
|
|
50
|
+
addTypurl(typurl: TypUrl): void;
|
|
51
|
+
getAll(): Promise<void>;
|
|
52
|
+
request(tableName: string, id: string): void;
|
|
53
|
+
toJson(): any;
|
|
54
|
+
}
|