@tricoteuses/senat 1.3.1 → 1.3.4
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/config.d.ts +1 -0
- package/lib/config.js +14 -45
- package/lib/databases.js +86 -143
- package/lib/datasets.js +78 -83
- package/lib/index.d.ts +12 -4
- package/lib/index.js +42 -419
- package/lib/loaders.js +149 -654
- package/lib/model/ameli.js +83 -21
- package/lib/model/debats.js +0 -1
- package/lib/model/dosleg.d.ts +1 -1
- package/lib/model/dosleg.js +179 -73
- package/lib/model/index.d.ts +3 -3
- package/lib/model/index.js +12 -46
- package/lib/model/questions.js +68 -39
- package/lib/model/sens.d.ts +1 -1
- package/lib/model/sens.js +383 -113
- package/lib/model/texte.js +220 -290
- package/lib/model/util.js +9 -26
- package/lib/raw_types/ameli.js +5 -6
- package/lib/raw_types/debats.js +5 -6
- package/lib/raw_types/dosleg.js +5 -6
- package/lib/raw_types/questions.js +5 -6
- package/lib/raw_types/sens.js +5 -6
- package/lib/raw_types_schemats/ameli.js +1 -43
- package/lib/raw_types_schemats/debats.js +1 -22
- package/lib/raw_types_schemats/dosleg.js +1 -96
- package/lib/raw_types_schemats/questions.js +1 -22
- package/lib/raw_types_schemats/sens.js +1 -112
- package/lib/scripts/convert_data.js +181 -631
- package/lib/scripts/datautil.js +17 -60
- package/lib/scripts/parse_textes.js +46 -129
- package/lib/scripts/retrieve_documents.js +247 -513
- package/lib/scripts/retrieve_open_data.js +211 -368
- package/lib/scripts/retrieve_senateurs_photos.js +144 -239
- package/lib/scripts/shared/cli_helpers.js +30 -30
- package/lib/scripts/shared/util.js +28 -94
- package/lib/strings.js +20 -45
- package/lib/types/ameli.d.ts +1 -1
- package/lib/types/ameli.js +14 -25
- package/lib/types/debats.d.ts +1 -1
- package/lib/types/debats.js +3 -21
- package/lib/types/dosleg.d.ts +1 -1
- package/lib/types/dosleg.js +152 -119
- package/lib/types/questions.d.ts +1 -1
- package/lib/types/questions.js +1 -13
- package/lib/types/sens.d.ts +1 -1
- package/lib/types/sens.js +1 -13
- package/lib/types/sessions.js +44 -49
- package/lib/types/texte.js +17 -22
- package/lib/validators/config.js +47 -111
- package/lib/validators/senat.js +1 -5
- package/package.json +18 -40
- package/lib/aggregates.d.ts +0 -52
- package/lib/aggregates.mjs +0 -930
- package/lib/aggregates.ts +0 -833
- package/lib/config.mjs +0 -16
- package/lib/config.ts +0 -26
- package/lib/data/legislatures.json +0 -38
- package/lib/databases.mjs +0 -57
- package/lib/databases.ts +0 -71
- package/lib/datasets.mjs +0 -78
- package/lib/datasets.ts +0 -118
- package/lib/fields.d.ts +0 -10
- package/lib/fields.mjs +0 -68
- package/lib/fields.ts +0 -29
- package/lib/index.mjs +0 -4
- package/lib/index.ts +0 -42
- package/lib/inserters.d.ts +0 -98
- package/lib/inserters.mjs +0 -500
- package/lib/inserters.ts +0 -521
- package/lib/loaders.mjs +0 -158
- package/lib/loaders.ts +0 -271
- package/lib/model/ameli.mjs +0 -84
- package/lib/model/ameli.ts +0 -100
- package/lib/model/debats.mjs +0 -1
- package/lib/model/debats.ts +0 -0
- package/lib/model/dosleg.mjs +0 -196
- package/lib/model/dosleg.ts +0 -240
- package/lib/model/index.mjs +0 -4
- package/lib/model/index.ts +0 -14
- package/lib/model/questions.mjs +0 -71
- package/lib/model/questions.ts +0 -93
- package/lib/model/sens.mjs +0 -415
- package/lib/model/sens.ts +0 -516
- package/lib/model/texte.mjs +0 -208
- package/lib/model/texte.ts +0 -229
- package/lib/model/util.mjs +0 -19
- package/lib/model/util.ts +0 -32
- package/lib/raw_types/ameli.mjs +0 -5
- package/lib/raw_types/ameli.ts +0 -951
- package/lib/raw_types/debats.mjs +0 -5
- package/lib/raw_types/debats.ts +0 -222
- package/lib/raw_types/dosleg.mjs +0 -5
- package/lib/raw_types/dosleg.ts +0 -3625
- package/lib/raw_types/questions.mjs +0 -5
- package/lib/raw_types/questions.ts +0 -427
- package/lib/raw_types/sens.mjs +0 -5
- package/lib/raw_types/sens.ts +0 -4499
- package/lib/raw_types_kysely/ameli.d.ts +0 -6
- package/lib/raw_types_kysely/ameli.mjs +0 -7
- package/lib/raw_types_kysely/ameli.ts +0 -6
- package/lib/raw_types_kysely/debats.d.ts +0 -6
- package/lib/raw_types_kysely/debats.mjs +0 -7
- package/lib/raw_types_kysely/debats.ts +0 -6
- package/lib/raw_types_kysely/dosleg.d.ts +0 -6
- package/lib/raw_types_kysely/dosleg.mjs +0 -7
- package/lib/raw_types_kysely/dosleg.ts +0 -6
- package/lib/raw_types_kysely/questions.d.ts +0 -6
- package/lib/raw_types_kysely/questions.mjs +0 -7
- package/lib/raw_types_kysely/questions.ts +0 -6
- package/lib/raw_types_kysely/sens.d.ts +0 -6
- package/lib/raw_types_kysely/sens.mjs +0 -7
- package/lib/raw_types_kysely/sens.ts +0 -6
- package/lib/raw_types_kysely/texte.d.ts +0 -45
- package/lib/raw_types_kysely/texte.mjs +0 -7
- package/lib/raw_types_kysely/texte.ts +0 -53
- package/lib/raw_types_schemats/ameli.mjs +0 -2
- package/lib/raw_types_schemats/ameli.ts +0 -601
- package/lib/raw_types_schemats/debats.mjs +0 -2
- package/lib/raw_types_schemats/debats.ts +0 -145
- package/lib/raw_types_schemats/dosleg.mjs +0 -2
- package/lib/raw_types_schemats/dosleg.ts +0 -2195
- package/lib/raw_types_schemats/questions.mjs +0 -2
- package/lib/raw_types_schemats/questions.ts +0 -251
- package/lib/raw_types_schemats/sens.mjs +0 -2
- package/lib/raw_types_schemats/sens.ts +0 -2907
- package/lib/scripts/convert_data.mjs +0 -181
- package/lib/scripts/convert_data.ts +0 -243
- package/lib/scripts/datautil.mjs +0 -16
- package/lib/scripts/datautil.ts +0 -19
- package/lib/scripts/images/transparent_150x192.jpg +0 -0
- package/lib/scripts/images/transparent_155x225.jpg +0 -0
- package/lib/scripts/parse_textes.mjs +0 -46
- package/lib/scripts/parse_textes.ts +0 -65
- package/lib/scripts/retrieve_documents.mjs +0 -249
- package/lib/scripts/retrieve_documents.ts +0 -298
- package/lib/scripts/retrieve_open_data.mjs +0 -217
- package/lib/scripts/retrieve_open_data.ts +0 -274
- package/lib/scripts/retrieve_senateurs_photos.mjs +0 -147
- package/lib/scripts/retrieve_senateurs_photos.ts +0 -177
- package/lib/scripts/retrieve_textes.d.ts +0 -1
- package/lib/scripts/retrieve_textes.mjs +0 -328
- package/lib/scripts/retrieve_textes.ts +0 -143
- package/lib/scripts/shared/cli_helpers.ts +0 -36
- package/lib/scripts/shared/util.ts +0 -33
- package/lib/src/aggregates.d.ts +0 -52
- package/lib/src/aggregates.mjs +0 -726
- package/lib/src/config.d.ts +0 -2
- package/lib/src/config.mjs +0 -16
- package/lib/src/databases.d.ts +0 -18
- package/lib/src/databases.mjs +0 -55
- package/lib/src/datasets.d.ts +0 -28
- package/lib/src/datasets.mjs +0 -78
- package/lib/src/fields.d.ts +0 -10
- package/lib/src/fields.mjs +0 -22
- package/lib/src/index.d.ts +0 -8
- package/lib/src/index.mjs +0 -7
- package/lib/src/inserters.d.ts +0 -98
- package/lib/src/inserters.mjs +0 -360
- package/lib/src/loaders.d.ts +0 -36
- package/lib/src/loaders.mjs +0 -107
- package/lib/src/model/ameli.d.ts +0 -4
- package/lib/src/model/ameli.js +0 -57
- package/lib/src/model/debats.d.ts +0 -4
- package/lib/src/model/debats.js +0 -43
- package/lib/src/model/dosleg.d.ts +0 -197
- package/lib/src/model/dosleg.js +0 -169
- package/lib/src/model/index.d.ts +0 -4
- package/lib/src/model/index.js +0 -4
- package/lib/src/model/questions.d.ts +0 -89
- package/lib/src/model/questions.js +0 -76
- package/lib/src/model/sens.d.ts +0 -390
- package/lib/src/model/sens.js +0 -339
- package/lib/src/model/texte.d.ts +0 -7
- package/lib/src/model/texte.js +0 -183
- package/lib/src/raw_types_kysely/ameli.d.ts +0 -915
- package/lib/src/raw_types_kysely/ameli.js +0 -5
- package/lib/src/raw_types_kysely/debats.d.ts +0 -207
- package/lib/src/raw_types_kysely/debats.js +0 -5
- package/lib/src/raw_types_kysely/dosleg.d.ts +0 -3532
- package/lib/src/raw_types_kysely/dosleg.js +0 -5
- package/lib/src/raw_types_kysely/questions.d.ts +0 -414
- package/lib/src/raw_types_kysely/questions.js +0 -5
- package/lib/src/raw_types_kysely/sens.d.ts +0 -4394
- package/lib/src/raw_types_kysely/sens.js +0 -5
- package/lib/src/raw_types_schemats/ameli.d.ts +0 -541
- package/lib/src/raw_types_schemats/ameli.js +0 -2
- package/lib/src/raw_types_schemats/debats.d.ts +0 -127
- package/lib/src/raw_types_schemats/debats.js +0 -2
- package/lib/src/raw_types_schemats/dosleg.d.ts +0 -2027
- package/lib/src/raw_types_schemats/dosleg.js +0 -2
- package/lib/src/raw_types_schemats/questions.d.ts +0 -231
- package/lib/src/raw_types_schemats/questions.js +0 -2
- package/lib/src/raw_types_schemats/sens.d.ts +0 -2709
- package/lib/src/raw_types_schemats/sens.js +0 -2
- package/lib/src/scripts/convert_data.d.ts +0 -1
- package/lib/src/scripts/convert_data.js +0 -95
- package/lib/src/scripts/datautil.d.ts +0 -5
- package/lib/src/scripts/datautil.js +0 -16
- package/lib/src/scripts/parse_textes.d.ts +0 -1
- package/lib/src/scripts/parse_textes.js +0 -47
- package/lib/src/scripts/retrieve_documents.d.ts +0 -1
- package/lib/src/scripts/retrieve_documents.js +0 -258
- package/lib/src/scripts/retrieve_open_data.d.ts +0 -1
- package/lib/src/scripts/retrieve_open_data.js +0 -214
- package/lib/src/scripts/retrieve_senateurs_photos.d.ts +0 -1
- package/lib/src/scripts/retrieve_senateurs_photos.js +0 -147
- package/lib/src/scripts/shared/cli_helpers.d.ts +0 -44
- package/lib/src/scripts/shared/cli_helpers.js +0 -32
- package/lib/src/scripts/shared/util.d.ts +0 -3
- package/lib/src/scripts/shared/util.js +0 -28
- package/lib/src/strings.d.ts +0 -1
- package/lib/src/strings.mjs +0 -18
- package/lib/src/types/ameli.d.ts +0 -10
- package/lib/src/types/ameli.js +0 -13
- package/lib/src/types/debats.d.ts +0 -4
- package/lib/src/types/debats.js +0 -2
- package/lib/src/types/dosleg.d.ts +0 -98
- package/lib/src/types/dosleg.js +0 -151
- package/lib/src/types/questions.d.ts +0 -2
- package/lib/src/types/questions.js +0 -1
- package/lib/src/types/sens.d.ts +0 -10
- package/lib/src/types/sens.js +0 -1
- package/lib/src/types/sessions.d.ts +0 -42
- package/lib/src/types/sessions.js +0 -43
- package/lib/src/types/texte.d.ts +0 -61
- package/lib/src/types/texte.js +0 -16
- package/lib/src/validators/config.d.ts +0 -1
- package/lib/src/validators/config.js +0 -54
- package/lib/src/validators/senat.d.ts +0 -0
- package/lib/src/validators/senat.js +0 -24
- package/lib/strings.mjs +0 -18
- package/lib/strings.ts +0 -26
- package/lib/types/ameli.mjs +0 -13
- package/lib/types/ameli.ts +0 -21
- package/lib/types/debats.mjs +0 -2
- package/lib/types/debats.ts +0 -6
- package/lib/types/dosleg.mjs +0 -151
- package/lib/types/dosleg.ts +0 -284
- package/lib/types/questions.mjs +0 -1
- package/lib/types/questions.ts +0 -3
- package/lib/types/sens.mjs +0 -1
- package/lib/types/sens.ts +0 -12
- package/lib/types/sessions.mjs +0 -43
- package/lib/types/sessions.ts +0 -42
- package/lib/types/texte.mjs +0 -16
- package/lib/types/texte.ts +0 -76
- package/lib/typings/windows-1252.d.js +0 -2
- package/lib/typings/windows-1252.d.mjs +0 -2
- package/lib/typings/windows-1252.d.ts +0 -11
- package/lib/validators/config.mjs +0 -54
- package/lib/validators/config.ts +0 -79
- package/lib/validators/senat.mjs +0 -24
- package/lib/validators/senat.ts +0 -26
package/lib/src/config.d.ts
DELETED
package/lib/src/config.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require("dotenv").config();
|
|
2
|
-
import { validateConfig } from "./validators/config";
|
|
3
|
-
const config = {
|
|
4
|
-
db: {
|
|
5
|
-
host: process.env.TRICOTEUSES_SENAT_DB_HOST || "localhost",
|
|
6
|
-
password: process.env.TRICOTEUSES_SENAT_DB_PASSWORD || "opendata",
|
|
7
|
-
port: process.env.TRICOTEUSES_SENAT_DB_PORT || 5432,
|
|
8
|
-
user: process.env.TRICOTEUSES_SENAT_DB_USER || "opendata",
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
const [validConfig, error] = validateConfig(config);
|
|
12
|
-
if (error !== null) {
|
|
13
|
-
console.error(`Error in configuration:\n${JSON.stringify(validConfig, null, 2)}\nError:\n${JSON.stringify(error, null, 2)}`);
|
|
14
|
-
process.exit(-1);
|
|
15
|
-
}
|
|
16
|
-
export default validConfig;
|
package/lib/src/databases.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Kysely } from "kysely";
|
|
2
|
-
import PgPromise from "pg-promise";
|
|
3
|
-
import { DB as DoslegDatabase } from "./raw_types_kysely/dosleg";
|
|
4
|
-
import { DB as QuestionsDatabase } from "./raw_types_kysely/questions";
|
|
5
|
-
import { DB as SensDatabase } from "./raw_types_kysely/sens";
|
|
6
|
-
export declare const pgPromise: PgPromise.IMain<{}, import("pg-promise/typescript/pg-subset").IClient>;
|
|
7
|
-
export declare const dbNames: string[];
|
|
8
|
-
export declare const dbByName: {
|
|
9
|
-
[name: string]: any;
|
|
10
|
-
};
|
|
11
|
-
export declare const dbDosleg: Kysely<DoslegDatabase>;
|
|
12
|
-
export declare const dbQuestions: Kysely<QuestionsDatabase>;
|
|
13
|
-
export declare const dbSens: Kysely<SensDatabase>;
|
|
14
|
-
export declare let dbSharedConnectionObjectByName: {
|
|
15
|
-
[name: string]: PgPromise.IConnected<unknown, any>;
|
|
16
|
-
};
|
|
17
|
-
export declare function checkDatabase(name: string): Promise<any>;
|
|
18
|
-
export declare function checkDatabases(): Promise<void>;
|
package/lib/src/databases.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Kysely, PostgresDialect } from "kysely";
|
|
2
|
-
import * as pg from "pg";
|
|
3
|
-
import Cursor from "pg-cursor";
|
|
4
|
-
import PgPromise from "pg-promise";
|
|
5
|
-
import config from "./config";
|
|
6
|
-
import { datasets } from "./datasets";
|
|
7
|
-
const int8TypeId = 20;
|
|
8
|
-
// Map int8 to number.
|
|
9
|
-
pg.types.setTypeParser(int8TypeId, (val) => {
|
|
10
|
-
return parseInt(val, 10);
|
|
11
|
-
});
|
|
12
|
-
export const pgPromise = PgPromise();
|
|
13
|
-
export const dbNames = ["ameli", "debats", "dosleg"];
|
|
14
|
-
export const dbByName = {};
|
|
15
|
-
for (const name of dbNames) {
|
|
16
|
-
dbByName[name] = pgPromise({
|
|
17
|
-
database: name,
|
|
18
|
-
host: config.db.host,
|
|
19
|
-
password: config.db.password,
|
|
20
|
-
port: config.db.port,
|
|
21
|
-
user: config.db.user,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function createDb(database, schema) {
|
|
25
|
-
const dialect = new PostgresDialect({
|
|
26
|
-
pool: new pg.Pool({
|
|
27
|
-
database: database,
|
|
28
|
-
host: config.db.host,
|
|
29
|
-
user: config.db.user,
|
|
30
|
-
password: config.db.password,
|
|
31
|
-
port: config.db.port,
|
|
32
|
-
max: 10,
|
|
33
|
-
}),
|
|
34
|
-
cursor: Cursor,
|
|
35
|
-
});
|
|
36
|
-
return new Kysely({
|
|
37
|
-
log: ["error"],
|
|
38
|
-
dialect: dialect,
|
|
39
|
-
}).withSchema(schema);
|
|
40
|
-
}
|
|
41
|
-
export const dbDosleg = createDb(datasets.dosleg.database, datasets.dosleg.schema);
|
|
42
|
-
export const dbQuestions = createDb(datasets.questions.database, datasets.questions.schema);
|
|
43
|
-
export const dbSens = createDb(datasets.sens.database, datasets.sens.schema);
|
|
44
|
-
export let dbSharedConnectionObjectByName = {};
|
|
45
|
-
export async function checkDatabase(name) {
|
|
46
|
-
// Check that database exists.
|
|
47
|
-
const db = dbByName[name];
|
|
48
|
-
dbSharedConnectionObjectByName[name] = await db.connect();
|
|
49
|
-
return db;
|
|
50
|
-
}
|
|
51
|
-
export async function checkDatabases() {
|
|
52
|
-
for (const name of dbNames) {
|
|
53
|
-
await checkDatabase(name);
|
|
54
|
-
}
|
|
55
|
-
}
|
package/lib/src/datasets.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface Dataset {
|
|
2
|
-
database: string;
|
|
3
|
-
repairEncoding: boolean;
|
|
4
|
-
repairZip?: (dataset: Dataset, dataDir: string) => void;
|
|
5
|
-
schema: string;
|
|
6
|
-
title: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}
|
|
9
|
-
export interface Datasets {
|
|
10
|
-
ameli: Dataset;
|
|
11
|
-
debats: Dataset;
|
|
12
|
-
dosleg: Dataset;
|
|
13
|
-
questions: Dataset;
|
|
14
|
-
sens: Dataset;
|
|
15
|
-
}
|
|
16
|
-
export declare enum EnabledDatasets {
|
|
17
|
-
None = 0,
|
|
18
|
-
Ameli = 1,
|
|
19
|
-
Debats = 2,
|
|
20
|
-
DosLeg = 4,
|
|
21
|
-
Questions = 8,
|
|
22
|
-
Sens = 16,
|
|
23
|
-
PhotosSenateurs = 32,
|
|
24
|
-
All = 63
|
|
25
|
-
}
|
|
26
|
-
export declare const datasets: Datasets;
|
|
27
|
-
export declare function getEnabledDatasets(categories: any): EnabledDatasets;
|
|
28
|
-
export declare function getChosenFromEnabledDatasets(categories: any): Dataset[];
|
package/lib/src/datasets.mjs
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import assert from "assert";
|
|
4
|
-
export var EnabledDatasets;
|
|
5
|
-
(function (EnabledDatasets) {
|
|
6
|
-
EnabledDatasets[EnabledDatasets["None"] = 0] = "None";
|
|
7
|
-
EnabledDatasets[EnabledDatasets["Ameli"] = 1] = "Ameli";
|
|
8
|
-
EnabledDatasets[EnabledDatasets["Debats"] = 2] = "Debats";
|
|
9
|
-
EnabledDatasets[EnabledDatasets["DosLeg"] = 4] = "DosLeg";
|
|
10
|
-
EnabledDatasets[EnabledDatasets["Questions"] = 8] = "Questions";
|
|
11
|
-
EnabledDatasets[EnabledDatasets["Sens"] = 16] = "Sens";
|
|
12
|
-
EnabledDatasets[EnabledDatasets["PhotosSenateurs"] = 32] = "PhotosSenateurs";
|
|
13
|
-
EnabledDatasets[EnabledDatasets["All"] = 63] = "All";
|
|
14
|
-
})(EnabledDatasets || (EnabledDatasets = {}));
|
|
15
|
-
export const datasets = {
|
|
16
|
-
ameli: {
|
|
17
|
-
database: "ameli",
|
|
18
|
-
repairEncoding: false,
|
|
19
|
-
repairZip: (dataset, dataDir) => {
|
|
20
|
-
const sqlFilename = `${dataset.database}.sql`;
|
|
21
|
-
const sqlFilePath = path.join(dataDir, sqlFilename);
|
|
22
|
-
fs.removeSync(sqlFilePath);
|
|
23
|
-
fs.moveSync(path.join(dataDir, "var", "opt", "opendata", sqlFilename), sqlFilePath);
|
|
24
|
-
},
|
|
25
|
-
schema: "public",
|
|
26
|
-
title: "Amendements",
|
|
27
|
-
url: "https://data.senat.fr/data/ameli/ameli.zip",
|
|
28
|
-
},
|
|
29
|
-
debats: {
|
|
30
|
-
database: "debats",
|
|
31
|
-
repairEncoding: true,
|
|
32
|
-
schema: "public",
|
|
33
|
-
title: "Informations relatives aux comptes rendus intégraux de la séance publique",
|
|
34
|
-
url: "https://data.senat.fr/data/debats/debats.zip",
|
|
35
|
-
},
|
|
36
|
-
dosleg: {
|
|
37
|
-
database: "dosleg",
|
|
38
|
-
repairEncoding: true,
|
|
39
|
-
schema: "public",
|
|
40
|
-
title: "Dossiers législatifs",
|
|
41
|
-
url: "https://data.senat.fr/data/dosleg/dosleg.zip",
|
|
42
|
-
},
|
|
43
|
-
questions: {
|
|
44
|
-
database: "questions",
|
|
45
|
-
repairEncoding: true,
|
|
46
|
-
schema: "questions",
|
|
47
|
-
title: "Questions écrites et orales posées par les sénateurs au Gouvernement",
|
|
48
|
-
url: "https://data.senat.fr/data/questions/questions.zip",
|
|
49
|
-
},
|
|
50
|
-
sens: {
|
|
51
|
-
database: "sens",
|
|
52
|
-
repairEncoding: true,
|
|
53
|
-
repairZip: (dataset, dataDir) => {
|
|
54
|
-
const sqlFilename = `${dataset.database}.sql`;
|
|
55
|
-
const sqlFilePath = path.join(dataDir, sqlFilename);
|
|
56
|
-
fs.removeSync(sqlFilePath);
|
|
57
|
-
fs.moveSync(path.join(dataDir, "export_sens.sql"), sqlFilePath);
|
|
58
|
-
},
|
|
59
|
-
schema: "public",
|
|
60
|
-
title: "Sénateurs (y compris organes et présence)",
|
|
61
|
-
url: "https://data.senat.fr/data/senateurs/export_sens.zip",
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
export function getEnabledDatasets(categories) {
|
|
65
|
-
categories.map((datasetName) => assert.notStrictEqual(EnabledDatasets[datasetName], undefined, `Unknown name of dataset: ${datasetName}`));
|
|
66
|
-
return categories.reduce((enabledDatasets, datasetName) => enabledDatasets |
|
|
67
|
-
EnabledDatasets[datasetName], EnabledDatasets.None);
|
|
68
|
-
}
|
|
69
|
-
export function getChosenFromEnabledDatasets(categories) {
|
|
70
|
-
const enabledDatasets = getEnabledDatasets(categories);
|
|
71
|
-
return [
|
|
72
|
-
enabledDatasets & EnabledDatasets.Ameli ? datasets.ameli : null,
|
|
73
|
-
enabledDatasets & EnabledDatasets.Debats ? datasets.debats : null,
|
|
74
|
-
enabledDatasets & EnabledDatasets.DosLeg ? datasets.dosleg : null,
|
|
75
|
-
enabledDatasets & EnabledDatasets.Questions ? datasets.questions : null,
|
|
76
|
-
enabledDatasets & EnabledDatasets.Sens ? datasets.sens : null,
|
|
77
|
-
].filter((dataset) => dataset !== null);
|
|
78
|
-
}
|
package/lib/src/fields.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function parseIntFields(fieldsNames: string[], entry: {
|
|
2
|
-
[fieldName: string]: any;
|
|
3
|
-
} | null): {
|
|
4
|
-
[fieldName: string]: any;
|
|
5
|
-
} | null;
|
|
6
|
-
export declare function trimFieldsRight(fieldsNames: string[], entry: {
|
|
7
|
-
[fieldName: string]: any;
|
|
8
|
-
} | null): {
|
|
9
|
-
[fieldName: string]: any;
|
|
10
|
-
} | null;
|
package/lib/src/fields.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function parseIntFields(fieldsNames, entry) {
|
|
2
|
-
if (entry === null) {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
for (const fieldName of fieldsNames) {
|
|
6
|
-
if (entry[fieldName] !== null) {
|
|
7
|
-
entry[fieldName] = parseInt(entry[fieldName]);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return entry;
|
|
11
|
-
}
|
|
12
|
-
export function trimFieldsRight(fieldsNames, entry) {
|
|
13
|
-
if (entry === null) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
for (const fieldName of fieldsNames) {
|
|
17
|
-
if (entry[fieldName] != null) {
|
|
18
|
-
entry[fieldName] = entry[fieldName].trimEnd();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return entry;
|
|
22
|
-
}
|
package/lib/src/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { allFollows, Aggregator, } from "./aggregates";
|
|
2
|
-
export { insertAudReferences, insertDateSeanceReferences, insertAuteurReferences, insertDocAttReferences, insertEcrReferences, insertLecassReferences, insertLecassrapReferences, insertLectureReferences, insertLoiReferences, insertRapReferences, insertTexteReferences, OutputData, } from "./inserters";
|
|
3
|
-
export { Ses, sesFieldsToParseInt, sesFieldsToTrim, Sub, subFieldsToParseInt, subFieldsToTrim, TxtAmeli, txtAmeliFieldsToTrim, } from "./types/ameli";
|
|
4
|
-
export { Debat, debatsFieldsToTrim, LecAssDeb, lecassdebFieldsToTrim, } from "./types/debats";
|
|
5
|
-
export { Ass, assFieldsToTrim, Aud, audFieldsToTrim, Auteur, auteurFieldsToTrim, DateSeance, dateSeanceFieldsToTrim, DecCoc, deccocFieldsToTrim, DenRap, denrapFieldsToTrim, DocAtt, docattFieldsToParseInt, docattFieldsToTrim, Ecr, ecrFieldsToTrim, EtaLoi, etaloiFieldsToTrim, LecAss, lecassFieldsToTrim, LecAssRap, lecassrapFieldsToTrim, Lecture, lectureFieldsToTrim, Loi, loiFieldsToTrim, Org, orgFieldsToTrim, OriTxt, oritxtFieldsToTrim, Qua, quaFieldsToTrim, Rap, rapFieldsToParseInt, rapFieldsToTrim, RapOrg, raporgFieldsToTrim, Scr, scrFieldsToTrim, Texte, texteFieldsToParseInt, texteFieldsToTrim, TypAtt, typattFieldsToTrim, TypLec, typlecFieldsToTrim, TypLoi, typloiFieldsToTrim, TypTxt, typtxtFieldsToTrim, TypUrl, typurlFieldsToTrim, } from "./types/dosleg";
|
|
6
|
-
export { Photo, Sen, } from "./types/sens";
|
|
7
|
-
export { Session } from "./types/sessions";
|
|
8
|
-
export { parseIntFields, trimFieldsRight, } from "./fields";
|
package/lib/src/index.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { allFollows, Aggregator, } from "./aggregates";
|
|
2
|
-
export { insertAudReferences, insertDateSeanceReferences, insertAuteurReferences, insertDocAttReferences, insertEcrReferences, insertLecassReferences, insertLecassrapReferences, insertLectureReferences, insertLoiReferences, insertRapReferences, insertTexteReferences, } from "./inserters";
|
|
3
|
-
export { sesFieldsToParseInt, sesFieldsToTrim, subFieldsToParseInt, subFieldsToTrim, txtAmeliFieldsToTrim, } from "./types/ameli";
|
|
4
|
-
export { debatsFieldsToTrim, lecassdebFieldsToTrim, } from "./types/debats";
|
|
5
|
-
export { assFieldsToTrim, audFieldsToTrim, auteurFieldsToTrim, dateSeanceFieldsToTrim, deccocFieldsToTrim, denrapFieldsToTrim, docattFieldsToParseInt, docattFieldsToTrim, ecrFieldsToTrim, etaloiFieldsToTrim, lecassFieldsToTrim, lecassrapFieldsToTrim, lectureFieldsToTrim, loiFieldsToTrim, orgFieldsToTrim, oritxtFieldsToTrim, quaFieldsToTrim, rapFieldsToParseInt, rapFieldsToTrim, raporgFieldsToTrim, scrFieldsToTrim, texteFieldsToParseInt, texteFieldsToTrim, typattFieldsToTrim, typlecFieldsToTrim, typloiFieldsToTrim, typtxtFieldsToTrim, typurlFieldsToTrim, } from "./types/dosleg";
|
|
6
|
-
export { Session } from "./types/sessions";
|
|
7
|
-
export { parseIntFields, trimFieldsRight, } from "./fields";
|
package/lib/src/inserters.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { 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
|
-
export interface OutputData {
|
|
5
|
-
readonly ass?: {
|
|
6
|
-
[id: string]: Ass;
|
|
7
|
-
};
|
|
8
|
-
readonly aud?: {
|
|
9
|
-
[id: string]: Aud;
|
|
10
|
-
};
|
|
11
|
-
readonly auteur?: {
|
|
12
|
-
[id: string]: Auteur;
|
|
13
|
-
};
|
|
14
|
-
readonly date_seance?: {
|
|
15
|
-
[id: string]: DateSeance;
|
|
16
|
-
};
|
|
17
|
-
readonly debats?: {
|
|
18
|
-
[id: string]: Debat;
|
|
19
|
-
};
|
|
20
|
-
readonly deccoc?: {
|
|
21
|
-
[id: string]: DecCoc;
|
|
22
|
-
};
|
|
23
|
-
readonly denrap?: {
|
|
24
|
-
[id: string]: DenRap;
|
|
25
|
-
};
|
|
26
|
-
readonly docatt?: {
|
|
27
|
-
[id: string]: DocAtt;
|
|
28
|
-
};
|
|
29
|
-
readonly ecr?: {
|
|
30
|
-
[id: string]: Ecr;
|
|
31
|
-
};
|
|
32
|
-
readonly etaloi?: {
|
|
33
|
-
[id: string]: EtaLoi;
|
|
34
|
-
};
|
|
35
|
-
readonly lecass?: {
|
|
36
|
-
[id: string]: LecAss;
|
|
37
|
-
};
|
|
38
|
-
readonly lecassrap?: {
|
|
39
|
-
[id: string]: LecAssRap;
|
|
40
|
-
};
|
|
41
|
-
readonly lecture?: {
|
|
42
|
-
[id: string]: Lecture;
|
|
43
|
-
};
|
|
44
|
-
readonly loi?: {
|
|
45
|
-
[id: string]: Loi;
|
|
46
|
-
};
|
|
47
|
-
readonly org?: {
|
|
48
|
-
[id: string]: Org;
|
|
49
|
-
};
|
|
50
|
-
readonly oritxt?: {
|
|
51
|
-
[id: string]: OriTxt;
|
|
52
|
-
};
|
|
53
|
-
readonly qua?: {
|
|
54
|
-
[id: string]: Qua;
|
|
55
|
-
};
|
|
56
|
-
readonly rap?: {
|
|
57
|
-
[id: string]: Rap;
|
|
58
|
-
};
|
|
59
|
-
readonly scr?: {
|
|
60
|
-
[id: string]: Scr;
|
|
61
|
-
};
|
|
62
|
-
readonly texte?: {
|
|
63
|
-
[id: string]: Texte;
|
|
64
|
-
};
|
|
65
|
-
readonly typatt?: {
|
|
66
|
-
[id: string]: TypAtt;
|
|
67
|
-
};
|
|
68
|
-
readonly typlec?: {
|
|
69
|
-
[id: string]: TypLec;
|
|
70
|
-
};
|
|
71
|
-
readonly typloi?: {
|
|
72
|
-
[id: string]: TypLoi;
|
|
73
|
-
};
|
|
74
|
-
readonly typtxt?: {
|
|
75
|
-
[id: string]: TypTxt;
|
|
76
|
-
};
|
|
77
|
-
readonly typurl?: {
|
|
78
|
-
[id: string]: TypUrl;
|
|
79
|
-
};
|
|
80
|
-
readonly txt_ameli?: {
|
|
81
|
-
[id: string]: TxtAmeli;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
type VisitedIdsByTableName = {
|
|
85
|
-
[tableName: string]: Set<number | string>;
|
|
86
|
-
};
|
|
87
|
-
export declare function insertAudReferences(aud: Aud, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Aud;
|
|
88
|
-
export declare function insertAuteurReferences(auteur: Auteur, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Auteur;
|
|
89
|
-
export declare function insertDateSeanceReferences(dateSeance: DateSeance, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): DateSeance;
|
|
90
|
-
export declare function insertDocAttReferences(docatt: DocAtt, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName, performInsertRapReferences?: boolean): DocAtt;
|
|
91
|
-
export declare function insertEcrReferences(ecr: Ecr, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Ecr;
|
|
92
|
-
export declare function insertLecassrapReferences(lecassrap: LecAssRap, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): LecAssRap;
|
|
93
|
-
export declare function insertLecassReferences(lecass: LecAss, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): LecAss;
|
|
94
|
-
export declare function insertLectureReferences(lecture: Lecture, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Lecture;
|
|
95
|
-
export declare function insertLoiReferences(loi: Loi, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Loi;
|
|
96
|
-
export declare function insertRapReferences(rap: Rap, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Rap;
|
|
97
|
-
export declare function insertTexteReferences(texte: Texte, data: OutputData, visitedIdsByTableName: VisitedIdsByTableName): Texte;
|
|
98
|
-
export {};
|