@tricoteuses/senat 2.9.8 → 2.9.10

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.
@@ -1,11 +1,28 @@
1
1
  import { Kysely } from "kysely";
2
- import { DB as AmeliDatabase } from "./raw_types/ameli";
3
- import { DB as DebatsDatabase } from "./raw_types/debats";
4
- import { DB as DoslegDatabase } from "./raw_types/dosleg";
5
- import { DB as QuestionsDatabase } from "./raw_types/questions";
6
- import { DB as SensDatabase } from "./raw_types/sens";
7
- export declare const dbAmeli: Kysely<AmeliDatabase>;
8
- export declare const dbDebats: Kysely<DebatsDatabase>;
9
- export declare const dbDosleg: Kysely<DoslegDatabase>;
10
- export declare const dbQuestions: Kysely<QuestionsDatabase>;
11
- export declare const dbSens: Kysely<SensDatabase>;
2
+ import { TableTypes as AmeliTableTypes } from "./raw_types/ameli";
3
+ import { TableTypes as DebatsTableTypes } from "./raw_types/debats";
4
+ import { TableTypes as DoslegTableTypes } from "./raw_types/dosleg";
5
+ import { TableTypes as QuestionsTableTypes } from "./raw_types/questions";
6
+ import { TableTypes as SensTableTypes } from "./raw_types/sens";
7
+ type AmeliDb = {
8
+ [K in keyof AmeliTableTypes]: AmeliTableTypes[K]["select"];
9
+ };
10
+ type DebatsDb = {
11
+ [K in keyof DebatsTableTypes]: DebatsTableTypes[K]["select"];
12
+ };
13
+ type DoslegDb = {
14
+ [K in keyof DoslegTableTypes]: DoslegTableTypes[K]["select"];
15
+ };
16
+ type QuestionsDb = {
17
+ [K in keyof QuestionsTableTypes]: QuestionsTableTypes[K]["select"];
18
+ };
19
+ type SensDb = {
20
+ [K in keyof SensTableTypes]: SensTableTypes[K]["select"];
21
+ };
22
+ export declare const dbSenat: Kysely<unknown>;
23
+ export declare const dbAmeli: Kysely<AmeliDb>;
24
+ export declare const dbDebats: Kysely<DebatsDb>;
25
+ export declare const dbDosleg: Kysely<DoslegDb>;
26
+ export declare const dbQuestions: Kysely<QuestionsDb>;
27
+ export declare const dbSens: Kysely<SensDb>;
28
+ export {};
package/lib/databases.js CHANGED
@@ -9,25 +9,24 @@ import { datasets } from "./datasets";
9
9
  pg.types.setTypeParser(types.builtins.INT8, (val) => {
10
10
  return parseInt(val, 10);
11
11
  });
12
- export const dbAmeli = createDb(datasets.ameli.database, datasets.ameli.schema);
13
- export const dbDebats = createDb(datasets.debats.database, datasets.debats.schema);
14
- export const dbDosleg = createDb(datasets.dosleg.database, datasets.dosleg.schema);
15
- export const dbQuestions = createDb(datasets.questions.database, datasets.questions.schema);
16
- export const dbSens = createDb(datasets.sens.database, datasets.sens.schema);
17
- function createDb(database, schema) {
18
- const dialect = new PostgresDialect({
19
- pool: new pg.Pool({
20
- database: database,
21
- host: config.db.host,
22
- user: config.db.user,
23
- password: config.db.password,
24
- port: config.db.port,
25
- max: 10,
26
- }),
27
- cursor: Cursor,
28
- });
29
- return new Kysely({
30
- log: ["error"],
31
- dialect: dialect,
32
- }).withSchema(schema);
33
- }
12
+ const senatPool = new pg.Pool({
13
+ database: "senat",
14
+ host: config.db.host,
15
+ user: config.db.user,
16
+ password: config.db.password,
17
+ port: config.db.port,
18
+ max: 10,
19
+ });
20
+ const senatDialect = new PostgresDialect({
21
+ pool: senatPool,
22
+ cursor: Cursor,
23
+ });
24
+ export const dbSenat = new Kysely({
25
+ log: ["error"],
26
+ dialect: senatDialect,
27
+ });
28
+ export const dbAmeli = dbSenat.withSchema(datasets.ameli.database);
29
+ export const dbDebats = dbSenat.withSchema(datasets.debats.database);
30
+ export const dbDosleg = dbSenat.withSchema(datasets.dosleg.database);
31
+ export const dbQuestions = dbSenat.withSchema(datasets.questions.database);
32
+ export const dbSens = dbSenat.withSchema(datasets.sens.database);
package/lib/datasets.d.ts CHANGED
@@ -2,7 +2,6 @@ export interface Dataset {
2
2
  database: string;
3
3
  repairEncoding: boolean;
4
4
  repairZip?: (dataset: Dataset, dataDir: string) => void;
5
- schema: string;
6
5
  title: string;
7
6
  url: string;
8
7
  }
package/lib/datasets.js CHANGED
@@ -16,35 +16,31 @@ export var EnabledDatasets;
16
16
  export const datasets = {
17
17
  ameli: {
18
18
  database: "ameli",
19
- repairEncoding: false,
19
+ repairEncoding: true,
20
20
  repairZip: (dataset, dataDir) => {
21
21
  const sqlFilename = `${dataset.database}.sql`;
22
22
  const sqlFilePath = path.join(dataDir, sqlFilename);
23
23
  fs.removeSync(sqlFilePath);
24
24
  fs.moveSync(path.join(dataDir, "var", "opt", "opendata", sqlFilename), sqlFilePath);
25
25
  },
26
- schema: "public",
27
26
  title: "Amendements",
28
27
  url: "https://data.senat.fr/data/ameli/ameli.zip",
29
28
  },
30
29
  debats: {
31
30
  database: "debats",
32
31
  repairEncoding: true,
33
- schema: "public",
34
32
  title: "Informations relatives aux comptes rendus intégraux de la séance publique",
35
33
  url: "https://data.senat.fr/data/debats/debats.zip",
36
34
  },
37
35
  dosleg: {
38
36
  database: "dosleg",
39
37
  repairEncoding: true,
40
- schema: "public",
41
38
  title: "Dossiers législatifs",
42
39
  url: "https://data.senat.fr/data/dosleg/dosleg.zip",
43
40
  },
44
41
  questions: {
45
42
  database: "questions",
46
43
  repairEncoding: true,
47
- schema: "questions",
48
44
  title: "Questions écrites et orales posées par les sénateurs au Gouvernement",
49
45
  url: "https://data.senat.fr/data/questions/questions.zip",
50
46
  },
@@ -57,7 +53,6 @@ export const datasets = {
57
53
  fs.removeSync(sqlFilePath);
58
54
  fs.moveSync(path.join(dataDir, "export_sens.sql"), sqlFilePath);
59
55
  },
60
- schema: "public",
61
56
  title: "Sénateurs (y compris organes et présence)",
62
57
  url: "https://data.senat.fr/data/senateurs/export_sens.zip",
63
58
  },
package/lib/loaders.d.ts CHANGED
@@ -26,7 +26,7 @@ export type IterItem<T> = {
26
26
  };
27
27
  export interface TexteMetadata {
28
28
  name: string;
29
- session: string | null | undefined;
29
+ session: number | null | undefined;
30
30
  url_expose_des_motifs?: URL;
31
31
  url_xml: URL;
32
32
  url_html: URL;
@@ -34,7 +34,7 @@ export interface TexteMetadata {
34
34
  }
35
35
  export interface RapportMetadata {
36
36
  name: string;
37
- session: string | null | undefined;
37
+ session: number | null | undefined;
38
38
  url_html: URL;
39
39
  url_pdf: URL;
40
40
  }
@@ -45,13 +45,13 @@ export interface DossierLegislatifDocumentResult {
45
45
  type_lecture: string;
46
46
  libelle_lecture: string;
47
47
  libelle_organisme: string | null;
48
- numero: string | null;
48
+ numero: number | null;
49
49
  id: string | null;
50
50
  url: string;
51
51
  origine?: string | null | undefined;
52
52
  type: string;
53
53
  date: string;
54
- session: string | null;
54
+ session: number | null;
55
55
  auteurs: {
56
56
  prenom: string | null;
57
57
  nom_usuel: string;
package/lib/loaders.js CHANGED
@@ -99,14 +99,14 @@ export function* iterLoadSenatDossiersLegislatifsTexteUrls(dataDir, session) {
99
99
  }
100
100
  export function* iterLoadSenatDossiersLegislatifsDocuments(dataDir, session, documentType, options = {}) {
101
101
  for (const { item: dossierLegislatif } of iterLoadSenatDossiersLegislatifs(dataDir, session, options)) {
102
- for (const lecture of dossierLegislatif.lectures) {
102
+ for (const lecture of dossierLegislatif["lectures"]) {
103
103
  const lecturesSenat = lecture.lectures_assemblee.filter((lectureAssemblee) => lectureAssemblee.assemblee === "Sénat");
104
104
  for (const lectureSenat of lecturesSenat) {
105
105
  for (const document of lectureSenat[documentType]) {
106
106
  const enrichedDocument = {
107
- signet_dossier: dossierLegislatif.signet,
108
- url_dossier_senat: dossierLegislatif.url,
109
- url_dossier_assemblee_nationale: dossierLegislatif.url_dossier_assemblee_nationale,
107
+ signet_dossier: dossierLegislatif["signet"],
108
+ url_dossier_senat: dossierLegislatif["url"],
109
+ url_dossier_assemblee_nationale: dossierLegislatif["url_dossier_assemblee_nationale"],
110
110
  type_lecture: lecture.type_lecture,
111
111
  libelle_lecture: lecture.libelle,
112
112
  libelle_organisme: lectureSenat.libelle_organisme,
@@ -2,101 +2,123 @@ import { InferResult } from "kysely";
2
2
  export type AmendementResult = InferResult<typeof findAllQuery>[0];
3
3
  declare const findAllQuery: import("kysely").SelectQueryBuilder<{
4
4
  amd: import("../raw_types/ameli").Amd;
5
- amdsen: import("../raw_types/ameli").Amdsen;
5
+ mot: import("../raw_types/ameli").Mot;
6
+ sub: import("kysely").Nullable<import("../raw_types/ameli").Sub>;
7
+ ent: import("../raw_types/ameli").Ent;
8
+ sor: import("kysely").Nullable<import("../raw_types/ameli").Sor>;
6
9
  avicom: import("kysely").Nullable<import("../raw_types/ameli").Avicom>;
7
10
  avigvt: import("kysely").Nullable<import("../raw_types/ameli").Avigvt>;
11
+ irr: import("kysely").Nullable<import("../raw_types/ameli").Irr>;
12
+ txt_ameli: import("kysely").Nullable<import("../raw_types/ameli").TxtAmeli>;
13
+ typrect: import("../raw_types/ameli").Typrect;
14
+ amdsen: import("../raw_types/ameli").Amdsen;
15
+ sen_ameli: import("../raw_types/ameli").SenAmeli;
16
+ grppol_ameli: import("kysely").Nullable<import("../raw_types/ameli").GrppolAmeli>;
8
17
  cab: import("kysely").Nullable<import("../raw_types/ameli").Cab>;
9
18
  com_ameli: import("kysely").Nullable<import("../raw_types/ameli").ComAmeli>;
10
- ent: import("../raw_types/ameli").Ent;
11
19
  etatxt: import("../raw_types/ameli").Etatxt;
12
20
  fbu: import("../raw_types/ameli").Fbu;
13
- grppol_ameli: import("kysely").Nullable<import("../raw_types/ameli").GrppolAmeli>;
21
+ ses: import("kysely").Nullable<import("../raw_types/ameli").Ses>;
14
22
  gvt: import("../raw_types/ameli").Gvt;
15
23
  intora: import("../raw_types/ameli").Intora;
16
- irr: import("kysely").Nullable<import("../raw_types/ameli").Irr>;
24
+ sea: import("../raw_types/ameli").Sea;
25
+ orarol: import("../raw_types/ameli").Orarol;
17
26
  lec_ameli: import("kysely").Nullable<import("../raw_types/ameli").LecAmeli>;
18
- mot: import("../raw_types/ameli").Mot;
19
27
  nat: import("kysely").Nullable<import("../raw_types/ameli").Nat>;
20
- orarol: import("../raw_types/ameli").Orarol;
21
28
  sai: import("../raw_types/ameli").Sai;
22
29
  saisen: import("../raw_types/ameli").Saisen;
23
- sea: import("../raw_types/ameli").Sea;
24
- sen_ameli: import("../raw_types/ameli").SenAmeli;
25
- ses: import("kysely").Nullable<import("../raw_types/ameli").Ses>;
26
- sor: import("kysely").Nullable<import("../raw_types/ameli").Sor>;
27
- sub: import("kysely").Nullable<import("../raw_types/ameli").Sub>;
28
- txt_ameli: import("kysely").Nullable<import("../raw_types/ameli").TxtAmeli>;
29
- typrect: import("../raw_types/ameli").Typrect;
30
30
  typses: import("../raw_types/ameli").Typses;
31
31
  typsub: import("kysely").Nullable<import("../raw_types/ameli").Typsub>;
32
32
  w_nivrec: import("../raw_types/ameli").WNivrec;
33
- }, "amd" | "avicom" | "avigvt" | "cab" | "com_ameli" | "grppol_ameli" | "irr" | "lec_ameli" | "nat" | "ses" | "sor" | "sub" | "txt_ameli" | "typsub", {
34
- session: string | null;
33
+ }, "amd" | "sub" | "sor" | "avicom" | "avigvt" | "irr" | "txt_ameli" | "grppol_ameli" | "cab" | "com_ameli" | "ses" | "lec_ameli" | "nat" | "typsub", {
34
+ session: number | null;
35
35
  signet_dossier_legislatif: string | null;
36
36
  nature_texte: string | null;
37
37
  numero_texte: number | null;
38
+ numero_adoption_texte: number | null;
38
39
  intitule_texte: string | null;
39
40
  lecture: string | null;
40
41
  nature: string;
41
42
  id: number;
42
43
  parent_id: number | null;
44
+ rendu_similaire_id: number | null;
45
+ identique_id: number | null;
43
46
  numero: string | null;
44
- numero_absolu: string | null;
45
- ordre: string | null;
47
+ numero_absolu: number | null;
48
+ ordre: number | null;
49
+ accepte_gouvernement: string | null;
46
50
  subdivision_libelle: string | null;
47
51
  subdivision_libelle_court: string | null;
48
52
  subdivision_type: string | null;
49
53
  alinea: number | null;
54
+ commentaire_probleme: string | null;
55
+ observations: string | null;
56
+ observations_additionnelles: string | null;
50
57
  date_depot: string;
51
58
  dispositif: string | null;
59
+ discussion_commune_id: number | null;
52
60
  objet: string | null;
53
61
  etat: string;
54
62
  avis_commission: string | null;
55
63
  avis_gouvernement: string | null;
56
64
  sort: string | null;
57
- revision: string;
65
+ revision: number;
58
66
  url: string;
59
67
  au_nom_de_groupe_politique: string | null;
60
68
  au_nom_de_commission: string | null;
61
69
  auteur_est_gouvernement: boolean;
62
70
  auteurs: {
63
71
  prenom: string | null;
72
+ homonyme: string | null;
64
73
  nom: string | null;
74
+ qualite: string | null;
75
+ rang: number | null;
65
76
  matricule: string | null;
66
77
  }[];
67
78
  }>;
68
79
  export declare function findAll(): AsyncIterableIterator<{
69
- session: string | null;
80
+ session: number | null;
70
81
  signet_dossier_legislatif: string | null;
71
82
  nature_texte: string | null;
72
83
  numero_texte: number | null;
84
+ numero_adoption_texte: number | null;
73
85
  intitule_texte: string | null;
74
86
  lecture: string | null;
75
87
  nature: string;
76
88
  id: number;
77
89
  parent_id: number | null;
90
+ rendu_similaire_id: number | null;
91
+ identique_id: number | null;
78
92
  numero: string | null;
79
- numero_absolu: string | null;
80
- ordre: string | null;
93
+ numero_absolu: number | null;
94
+ ordre: number | null;
95
+ accepte_gouvernement: string | null;
81
96
  subdivision_libelle: string | null;
82
97
  subdivision_libelle_court: string | null;
83
98
  subdivision_type: string | null;
84
99
  alinea: number | null;
100
+ commentaire_probleme: string | null;
101
+ observations: string | null;
102
+ observations_additionnelles: string | null;
85
103
  date_depot: string;
86
104
  dispositif: string | null;
105
+ discussion_commune_id: number | null;
87
106
  objet: string | null;
88
107
  etat: string;
89
108
  avis_commission: string | null;
90
109
  avis_gouvernement: string | null;
91
110
  sort: string | null;
92
- revision: string;
111
+ revision: number;
93
112
  url: string;
94
113
  au_nom_de_groupe_politique: string | null;
95
114
  au_nom_de_commission: string | null;
96
115
  auteur_est_gouvernement: boolean;
97
116
  auteurs: {
98
117
  prenom: string | null;
118
+ homonyme: string | null;
99
119
  nom: string | null;
120
+ qualite: string | null;
121
+ rang: number | null;
100
122
  matricule: string | null;
101
123
  }[];
102
124
  }>;
@@ -8,7 +8,10 @@ function auteurs(amendementId) {
8
8
  .where("amdsen.amdid", "=", amendementId)
9
9
  .select([
10
10
  "amdsen.prenomuse as prenom",
11
+ "amdsen.hom as homonyme",
11
12
  "amdsen.nomuse as nom",
13
+ "amdsen.qua as qualite",
14
+ "amdsen.rng as rang",
12
15
  "sen_ameli.mat as matricule",
13
16
  ])
14
17
  .orderBy("amdsen.rng asc"));
@@ -33,6 +36,7 @@ const findAllQuery = dbAmeli
33
36
  "txt_ameli.doslegsignet as signet_dossier_legislatif",
34
37
  "nat.libcourt as nature_texte",
35
38
  "txt_ameli.numabs as numero_texte",
39
+ "txt_ameli.numado as numero_adoption_texte",
36
40
  "txt_ameli.int as intitule_texte",
37
41
  "lec_ameli.lib as lecture",
38
42
  eb
@@ -48,15 +52,22 @@ const findAllQuery = dbAmeli
48
52
  .as("nature"),
49
53
  "amd.id as id",
50
54
  "amd.amdperid as parent_id",
55
+ "amd.amdrendusim as rendu_similaire_id",
56
+ "amd.ideid as identique_id",
51
57
  "amd.num as numero",
52
58
  "amd.numabs as numero_absolu",
53
59
  "amd.ord as ordre",
60
+ "amd.accgou as accepte_gouvernement",
54
61
  "sub.lib as subdivision_libelle",
55
62
  "sub.lic as subdivision_libelle_court",
56
63
  "typsub.lib as subdivision_type",
57
64
  "amd.alinea as alinea",
65
+ "amd.commentprobleme as commentaire_probleme",
66
+ "amd.obs as observations",
67
+ "amd.mot as observations_additionnelles",
58
68
  toDateString(ref("amd.datdep")).as("date_depot"),
59
69
  "amd.dis as dispositif",
70
+ "amd.discomid as discussion_commune_id",
60
71
  "amd.obj as objet",
61
72
  eb
62
73
  .case()
@@ -1,20 +1,29 @@
1
1
  import { InferResult } from "kysely";
2
2
  export type DebatResult = InferResult<typeof findAllQuery>[0];
3
- declare const findAllQuery: import("kysely").SelectQueryBuilder<import("../raw_types/debats").DB, "debats", {
3
+ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
4
+ debats: import("../raw_types/debats").Debats;
5
+ intdivers: import("../raw_types/debats").Intdivers;
6
+ intpjl: import("../raw_types/debats").Intpjl;
7
+ lecassdeb: import("../raw_types/debats").Lecassdeb;
8
+ secdis: import("../raw_types/debats").Secdis;
9
+ secdivers: import("../raw_types/debats").Secdivers;
10
+ syndeb: import("../raw_types/debats").Syndeb;
11
+ typsec: import("../raw_types/debats").Typsec;
12
+ }, "debats", {
4
13
  id: string;
5
14
  date_seance: string;
6
- numero: string | null;
15
+ numero: number | null;
7
16
  url: string | null;
8
17
  etat_synchronisation: string | null;
9
18
  sections: {
10
- id: string | null;
19
+ id: number | null;
11
20
  numero: string | null;
12
21
  objet: string | null;
13
22
  url: string | null;
14
23
  type: string | null;
15
24
  categorie: string | null;
16
25
  interventions: {
17
- id: string | null;
26
+ id: number | null;
18
27
  auteur_code: string;
19
28
  fonction_intervenant: string | null;
20
29
  url: string | null;
@@ -28,7 +37,7 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<import("../raw_t
28
37
  libelle: string | null;
29
38
  objet: string | null;
30
39
  interventions: {
31
- id: string | null;
40
+ id: number | null;
32
41
  auteur_code: string;
33
42
  fonction_intervenant: string | null;
34
43
  url: string | null;
@@ -42,18 +51,18 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<import("../raw_t
42
51
  export declare function findAll(): AsyncIterableIterator<{
43
52
  id: string;
44
53
  date_seance: string;
45
- numero: string | null;
54
+ numero: number | null;
46
55
  url: string | null;
47
56
  etat_synchronisation: string | null;
48
57
  sections: {
49
- id: string | null;
58
+ id: number | null;
50
59
  numero: string | null;
51
60
  objet: string | null;
52
61
  url: string | null;
53
62
  type: string | null;
54
63
  categorie: string | null;
55
64
  interventions: {
56
- id: string | null;
65
+ id: number | null;
57
66
  auteur_code: string;
58
67
  fonction_intervenant: string | null;
59
68
  url: string | null;
@@ -67,7 +76,7 @@ export declare function findAll(): AsyncIterableIterator<{
67
76
  libelle: string | null;
68
77
  objet: string | null;
69
78
  interventions: {
70
- id: string | null;
79
+ id: number | null;
71
80
  auteur_code: string;
72
81
  fonction_intervenant: string | null;
73
82
  url: string | null;