@tricoteuses/senat 3.0.0 → 3.0.2
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/add-js-extensions-v2.d.ts +1 -0
- package/lib/add-js-extensions-v2.js +23 -0
- package/lib/add-js-extensions.d.ts +1 -0
- package/lib/add-js-extensions.js +17 -0
- package/lib/src/databases_postgres.js +1 -1
- package/lib/src/index.d.ts +24 -24
- package/lib/src/index.js +6 -6
- package/lib/src/loaders.d.ts +12 -12
- package/lib/src/loaders.js +4 -4
- package/lib/src/model/agenda.d.ts +1 -1
- package/lib/src/model/agenda.js +1 -1
- package/lib/src/model/ameli.js +1 -1
- package/lib/src/model/commission.d.ts +2 -2
- package/lib/src/model/commission.js +4 -4
- package/lib/src/model/debats.js +1 -1
- package/lib/src/model/documents.js +1 -1
- package/lib/src/model/dosleg.js +1 -1
- package/lib/src/model/index.d.ts +7 -7
- package/lib/src/model/index.js +7 -7
- package/lib/src/model/questions.js +1 -1
- package/lib/src/model/scrutins.js +1 -1
- package/lib/src/model/seance.d.ts +1 -1
- package/lib/src/model/seance.js +4 -4
- package/lib/src/model/sens.js +1 -1
- package/lib/src/parsers/texte.d.ts +1 -1
- package/lib/src/parsers/texte.js +2 -2
- package/lib/src/raw_types/ameli.js +235 -977
- package/lib/src/raw_types/debats.js +73 -324
- package/lib/src/raw_types/dosleg.js +702 -3051
- package/lib/src/raw_types/questions.js +276 -1086
- package/lib/src/raw_types/sens.js +1547 -7285
- package/lib/src/scripts/convert_data.js +10 -10
- package/lib/src/scripts/convert_xml_to_html.js +1 -1
- package/lib/src/scripts/datautil.d.ts +1 -1
- package/lib/src/scripts/retrieve_agenda.js +9 -9
- package/lib/src/scripts/retrieve_cr_commission.js +8 -8
- package/lib/src/scripts/retrieve_cr_seance.d.ts +1 -1
- package/lib/src/scripts/retrieve_cr_seance.js +8 -8
- package/lib/src/scripts/retrieve_documents.d.ts +1 -1
- package/lib/src/scripts/retrieve_documents.js +7 -7
- package/lib/src/scripts/retrieve_open_data.js +9 -9
- package/lib/src/scripts/retrieve_senateurs_photos.js +4 -4
- package/lib/src/scripts/retrieve_videos.js +9 -9
- package/lib/src/scripts/shared/incremental_import_sql.js +1 -1
- package/lib/src/scripts/shared/make_generate_zod_schemas.d.ts +20 -0
- package/lib/src/scripts/shared/make_generate_zod_schemas.js +300 -0
- package/lib/src/scripts/shared/staging_import.d.ts +1 -1
- package/lib/src/scripts/validate_prefixed_tables.js +4 -4
- package/lib/src/types/ameli.d.ts +2 -2
- package/lib/src/types/dosleg.d.ts +4 -4
- package/lib/src/types/questions.d.ts +1 -1
- package/lib/src/types/texte.d.ts +1 -1
- package/lib/src/utils/cr_spliting.d.ts +1 -1
- package/lib/src/utils/cr_spliting.js +4 -4
- package/lib/src/utils/nvs-parsing.js +2 -2
- package/lib/src/utils/reunion_odj_building.d.ts +2 -2
- package/lib/src/utils/reunion_odj_building.js +2 -2
- package/lib/src/utils/reunion_parsing.d.ts +2 -2
- package/lib/src/utils/reunion_parsing.js +2 -2
- package/lib/src/utils/scoring.d.ts +3 -3
- package/lib/src/utils/scoring.js +2 -2
- package/lib/src/videos/config.d.ts +1 -1
- package/lib/src/videos/index.d.ts +5 -5
- package/lib/src/videos/index.js +5 -5
- package/lib/src/videos/match.d.ts +2 -2
- package/lib/src/videos/match.js +5 -5
- package/lib/src/videos/pipeline.d.ts +2 -2
- package/lib/src/videos/pipeline.js +4 -4
- package/lib/src/videos/search.d.ts +2 -2
- package/lib/src/videos/search.js +2 -2
- package/lib/tests/incrementalImportSql.test.js +4 -4
- package/lib/tests/prefixedTables.test.js +1 -1
- package/lib/tests/schemaVersion.test.js +1 -1
- package/lib/tests/test_iter_load.test.js +1 -1
- package/lib/tests/validatePrefixedTables.test.js +2 -2
- package/lib/tests/videoMatching.test.js +4 -4
- package/package.json +1 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import * as cheerio from "cheerio";
|
|
3
|
-
import { AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER } from "../loaders";
|
|
3
|
+
import { AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER } from "../loaders.js";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
|
-
import { sessionStartYearFromDate } from "../model/seance";
|
|
6
|
-
import { frDateToISO, hourShortToStartTime } from "./date";
|
|
7
|
-
import { normalizeSpaces } from "./string_cleaning";
|
|
5
|
+
import { sessionStartYearFromDate } from "../model/seance.js";
|
|
6
|
+
import { frDateToISO, hourShortToStartTime } from "./date.js";
|
|
7
|
+
import { normalizeSpaces } from "./string_cleaning.js";
|
|
8
8
|
function extractWeekStartFromHead($) {
|
|
9
9
|
const og = $('meta[property="og:title"]').attr("content") || $("title").text();
|
|
10
10
|
const m = (og ?? "").toLowerCase().match(/semaine du\s+(\d{1,2}\s+\w+\s+\d{4})/i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { XMLParser } from "fast-xml-parser";
|
|
2
|
-
import { dice, normalize } from "./scoring";
|
|
3
|
-
import { decodeHtmlEntities } from "./string_cleaning";
|
|
2
|
+
import { dice, normalize } from "./scoring.js";
|
|
3
|
+
import { decodeHtmlEntities } from "./string_cleaning.js";
|
|
4
4
|
const CHAPTER_MATCH_THRESHOLD = 0.5;
|
|
5
5
|
const xmlParser = new XMLParser({
|
|
6
6
|
ignoreAttributes: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import commandLineArgs from "command-line-args";
|
|
2
|
-
import { ActeLegislatif, DossierLegislatifResult } from "../model/dosleg";
|
|
3
|
-
import { AgendaEvent, ReunionOdj } from "../types/agenda";
|
|
2
|
+
import { ActeLegislatif, DossierLegislatifResult } from "../model/dosleg.js";
|
|
3
|
+
import { AgendaEvent, ReunionOdj } from "../types/agenda.js";
|
|
4
4
|
type DossierWithActes = DossierLegislatifResult & {
|
|
5
5
|
actes_legislatifs?: ActeLegislatif[] | null;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getSessionsFromStart } from "../types/sessions";
|
|
2
|
-
import { iterLoadSenatDossiersLegislatifs } from "../loaders";
|
|
1
|
+
import { getSessionsFromStart } from "../types/sessions.js";
|
|
2
|
+
import { iterLoadSenatDossiersLegislatifs } from "../loaders.js";
|
|
3
3
|
export function buildOdj(events, dossierBySenatUrl) {
|
|
4
4
|
const byObjet = new Map(); // objet -> set de dossier uids
|
|
5
5
|
let codeEtape = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DateTime } from "luxon";
|
|
2
2
|
import type { AnyNode } from "domhandler";
|
|
3
|
-
import { AgendaEvent, Reunion } from "../types/agenda";
|
|
4
|
-
import { DossierLegislatifResult } from "../model/dosleg";
|
|
3
|
+
import { AgendaEvent, Reunion } from "../types/agenda.js";
|
|
4
|
+
import { DossierLegislatifResult } from "../model/dosleg.js";
|
|
5
5
|
import * as cheerio from "cheerio";
|
|
6
6
|
type KnownType = "SP" | "COM" | "MC" | "OD" | "ID";
|
|
7
7
|
type DossierBySenatUrl = Record<string, DossierLegislatifResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateTime } from "luxon";
|
|
2
|
-
import { buildOdj } from "./reunion_odj_building";
|
|
3
|
-
import { norm } from "./string_cleaning";
|
|
2
|
+
import { buildOdj } from "./reunion_odj_building.js";
|
|
3
|
+
import { norm } from "./string_cleaning.js";
|
|
4
4
|
const PARIS = "Europe/Paris";
|
|
5
5
|
const STOPWORDS = new Set([
|
|
6
6
|
"de",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AgendaEvent, Reunion } from "../types/agenda";
|
|
2
|
-
import { VideoScoreSignals, VideoScoreWeights } from "../videos/types";
|
|
3
|
-
import { L1Chapter } from "./nvs-parsing";
|
|
1
|
+
import { AgendaEvent, Reunion } from "../types/agenda.js";
|
|
2
|
+
import { VideoScoreSignals, VideoScoreWeights } from "../videos/types.js";
|
|
3
|
+
import { L1Chapter } from "./nvs-parsing.js";
|
|
4
4
|
export declare function jaccard(a: Set<string>, b: Set<string>): number;
|
|
5
5
|
export declare function jaccardTokenSim(a: string, b: string): number;
|
|
6
6
|
export declare function isNoiseBlock(text: string): boolean;
|
package/lib/src/utils/scoring.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parseISO } from "./reunion_parsing";
|
|
2
|
-
import { normalizeText } from "./string_cleaning";
|
|
1
|
+
import { parseISO } from "./reunion_parsing.js";
|
|
2
|
+
import { normalizeText } from "./string_cleaning.js";
|
|
3
3
|
export function jaccard(a, b) {
|
|
4
4
|
if (!a.size || !b.size)
|
|
5
5
|
return 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./search";
|
|
3
|
-
export * from "./match";
|
|
4
|
-
export * from "./config";
|
|
5
|
-
export * from "./pipeline";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./search.js";
|
|
3
|
+
export * from "./match.js";
|
|
4
|
+
export * from "./config.js";
|
|
5
|
+
export * from "./pipeline.js";
|
package/lib/src/videos/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./search";
|
|
3
|
-
export * from "./match";
|
|
4
|
-
export * from "./config";
|
|
5
|
-
export * from "./pipeline";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./search.js";
|
|
3
|
+
export * from "./match.js";
|
|
4
|
+
export * from "./config.js";
|
|
5
|
+
export * from "./pipeline.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommandLineOptions } from "command-line-args";
|
|
2
|
-
import { Reunion } from "../types/agenda";
|
|
3
|
-
import { Candidate, MatchResult, MatchWeights } from "./types";
|
|
2
|
+
import { Reunion } from "../types/agenda.js";
|
|
3
|
+
import { Candidate, MatchResult, MatchWeights } from "./types.js";
|
|
4
4
|
export declare function matchOneReunion(args: {
|
|
5
5
|
agenda: Reunion;
|
|
6
6
|
agendaTs: number | null;
|
package/lib/src/videos/match.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isAmbiguousTimeOriginal } from "../utils/date";
|
|
2
|
-
import { buildSenatVodMasterM3u8FromNvs, getLevel1Chapters, parseDataNvs } from "../utils/nvs-parsing";
|
|
3
|
-
import { dice, getOrgKey, normalize, scoreVideo } from "../utils/scoring";
|
|
4
|
-
import { SENAT_DATAS_ROOT, weights } from "./config";
|
|
5
|
-
import { fetchBuffer } from "./search";
|
|
1
|
+
import { isAmbiguousTimeOriginal } from "../utils/date.js";
|
|
2
|
+
import { buildSenatVodMasterM3u8FromNvs, getLevel1Chapters, parseDataNvs } from "../utils/nvs-parsing.js";
|
|
3
|
+
import { dice, getOrgKey, normalize, scoreVideo } from "../utils/scoring.js";
|
|
4
|
+
import { SENAT_DATAS_ROOT, weights } from "./config.js";
|
|
5
|
+
import { fetchBuffer } from "./search.js";
|
|
6
6
|
export async function matchOneReunion(args) {
|
|
7
7
|
const { agenda, agendaTs, timeAmbigious, candidates, weights, fetchDataNvs, options } = args;
|
|
8
8
|
if (!options["silent"])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Reunion } from "../types/agenda";
|
|
2
|
-
import { BestMatch, LastForVideo, MatchContext } from "./types";
|
|
1
|
+
import { Reunion } from "../types/agenda.js";
|
|
2
|
+
import { BestMatch, LastForVideo, MatchContext } from "./types.js";
|
|
3
3
|
import { CommandLineOptions } from "command-line-args";
|
|
4
4
|
type VideoPipelineOptions = CommandLineOptions & {
|
|
5
5
|
silent?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER } from "../loaders";
|
|
2
|
-
import { epochToParisDateTime } from "../utils/date";
|
|
3
|
-
import { SENAT_DATAS_ROOT } from "./config";
|
|
4
|
-
import { fetchText } from "./search";
|
|
1
|
+
import { AGENDA_FOLDER, DATA_TRANSFORMED_FOLDER } from "../loaders.js";
|
|
2
|
+
import { epochToParisDateTime } from "../utils/date.js";
|
|
3
|
+
import { SENAT_DATAS_ROOT } from "./config.js";
|
|
4
|
+
import { fetchText } from "./search.js";
|
|
5
5
|
import fs from "fs-extra";
|
|
6
6
|
import fsp from "fs/promises";
|
|
7
7
|
import path from "path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommandLineOptions } from "command-line-args";
|
|
2
|
-
import { Reunion } from "../types/agenda";
|
|
3
|
-
import { Candidate, SearchParams } from "./types";
|
|
2
|
+
import { Reunion } from "../types/agenda.js";
|
|
3
|
+
import { Candidate, SearchParams } from "./types.js";
|
|
4
4
|
export declare function fetchText(url: string): Promise<string | null>;
|
|
5
5
|
export declare function fetchBuffer(url: string): Promise<Buffer | null>;
|
|
6
6
|
export declare function getAgendaType(agenda: Reunion): string;
|
package/lib/src/videos/search.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toFRDate } from "../utils/date";
|
|
2
|
-
import { MAX_CANDIDATES, SENAT_VIDEOS_SEARCH_AJAX } from "./config";
|
|
1
|
+
import { toFRDate } from "../utils/date.js";
|
|
2
|
+
import { MAX_CANDIDATES, SENAT_VIDEOS_SEARCH_AJAX } from "./config.js";
|
|
3
3
|
import * as cheerio from "cheerio";
|
|
4
4
|
export async function fetchText(url) {
|
|
5
5
|
const res = await fetch(url);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { buildIncrementalDatasetImportSql, buildNormalizeStagingSchemaSql, } from "../src/scripts/shared/incremental_import_sql";
|
|
3
|
-
import { stagingSchemaName } from "../src/scripts/shared/prefixed_tables";
|
|
4
|
-
import { buildExportStagingMetadataStatementsQuery } from "../src/scripts/shared/staging_metadata_sql";
|
|
5
|
-
import { isCopyFromStdinLine, rewriteLineForStagingImport } from "../src/scripts/shared/staging_import";
|
|
2
|
+
import { buildIncrementalDatasetImportSql, buildNormalizeStagingSchemaSql, } from "../src/scripts/shared/incremental_import_sql.js";
|
|
3
|
+
import { stagingSchemaName } from "../src/scripts/shared/prefixed_tables.js";
|
|
4
|
+
import { buildExportStagingMetadataStatementsQuery } from "../src/scripts/shared/staging_metadata_sql.js";
|
|
5
|
+
import { isCopyFromStdinLine, rewriteLineForStagingImport } from "../src/scripts/shared/staging_import.js";
|
|
6
6
|
describe("incremental import SQL", () => {
|
|
7
7
|
it("normalizes staging object names before merge", () => {
|
|
8
8
|
const sql = buildNormalizeStagingSchemaSql("dosleg");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { buildGeneratedTableManifest, extractPrefixedTableNamesFromGeneratedManifest, prefixedName, senatSchemaName, stagingSchemaName, stripDatasetPrefix, } from "../src/scripts/shared/prefixed_tables";
|
|
2
|
+
import { buildGeneratedTableManifest, extractPrefixedTableNamesFromGeneratedManifest, prefixedName, senatSchemaName, stagingSchemaName, stripDatasetPrefix, } from "../src/scripts/shared/prefixed_tables.js";
|
|
3
3
|
describe("prefixed table helpers", () => {
|
|
4
4
|
it("builds prefixed table and staging schema names", () => {
|
|
5
5
|
expect(prefixedName("dosleg", "texte")).toBe("dosleg_texte");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { buildEnsureSchemaVersionTableSql, buildIncrementSchemaVersionSql, buildSchemaStructureFingerprintQuery, } from "../src/scripts/shared/schema_version";
|
|
2
|
+
import { buildEnsureSchemaVersionTableSql, buildIncrementSchemaVersionSql, buildSchemaStructureFingerprintQuery, } from "../src/scripts/shared/schema_version.js";
|
|
3
3
|
describe("schema version SQL", () => {
|
|
4
4
|
it("creates the senat.version table and seeds version zero", () => {
|
|
5
5
|
const sql = buildEnsureSchemaVersionTableSql("senat");
|
|
@@ -2,7 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import os from "os";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { describe, it, expect } from "vitest";
|
|
5
|
-
import { COMPTES_RENDUS_FOLDER, DATA_TRANSFORMED_FOLDER, iterLoadSenatComptesRendusSeances } from "../src/loaders";
|
|
5
|
+
import { COMPTES_RENDUS_FOLDER, DATA_TRANSFORMED_FOLDER, iterLoadSenatComptesRendusSeances } from "../src/loaders.js";
|
|
6
6
|
describe("iterLoadSenatComptesRendusSeances", () => {
|
|
7
7
|
it("loads comptes rendus from transformed/session folder", () => {
|
|
8
8
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "senat-cr-"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { datasets } from "../src/datasets";
|
|
4
|
-
import { extractPrefixedTableNamesFromGeneratedManifest, getGeneratedTableManifestPath, } from "../src/scripts/shared/prefixed_tables";
|
|
3
|
+
import { datasets } from "../src/datasets.js";
|
|
4
|
+
import { extractPrefixedTableNamesFromGeneratedManifest, getGeneratedTableManifestPath, } from "../src/scripts/shared/prefixed_tables.js";
|
|
5
5
|
describe("generated raw types coverage", () => {
|
|
6
6
|
it("maps each generated dataset definition to prefixed senat tables", () => {
|
|
7
7
|
for (const dataset of Object.values(datasets)) {
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
import { describe, it, expect } from "vitest";
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
9
9
|
import * as path from "node:path";
|
|
10
|
-
import { isAmbiguousTimeOriginal, toFRDate } from "../src/utils/date";
|
|
11
|
-
import { dice, getOrgKey, normalize, scoreVideo } from "../src/utils/scoring";
|
|
12
|
-
import { buildSenatVodMasterM3u8FromNvs, getLevel1Chapters, parseDataNvs } from "../src/utils/nvs-parsing";
|
|
13
|
-
import { extractCandidatesFromSearchHtml, fetchAllSearchPages, fetchBuffer, getAgendaType, SENAT_DATAS_ROOT, } from "../src/videos";
|
|
10
|
+
import { isAmbiguousTimeOriginal, toFRDate } from "../src/utils/date.js";
|
|
11
|
+
import { dice, getOrgKey, normalize, scoreVideo } from "../src/utils/scoring.js";
|
|
12
|
+
import { buildSenatVodMasterM3u8FromNvs, getLevel1Chapters, parseDataNvs } from "../src/utils/nvs-parsing.js";
|
|
13
|
+
import { extractCandidatesFromSearchHtml, fetchAllSearchPages, fetchBuffer, getAgendaType, SENAT_DATAS_ROOT, } from "../src/videos/index.js";
|
|
14
14
|
const LIVE_CACHE_DIR = path.join(process.cwd(), "tests", ".cache", "video-matching-live");
|
|
15
15
|
const FIXTURES_ROOT = path.join(process.cwd(), "tests", "fixtures", "data");
|
|
16
16
|
const GOLD_PATH = path.join(FIXTURES_ROOT, "expected-video-matching.json");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tricoteuses/senat",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Handle French Sénat's open data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"France",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"postinstall": "patch-package",
|
|
50
49
|
"build": "tsc",
|
|
51
50
|
"build:types": "tsc --emitDeclarationOnly",
|
|
52
51
|
"data:convert_data": "tsx src/scripts/convert_data.ts",
|
|
@@ -101,8 +100,6 @@
|
|
|
101
100
|
"globals": "^17.0.0",
|
|
102
101
|
"kanel": "^4.0.1",
|
|
103
102
|
"kanel-zod": "^4.0.0",
|
|
104
|
-
"patch-package": "^8.0.1",
|
|
105
|
-
"postinstall-postinstall": "^2.1.0",
|
|
106
103
|
"prettier": "^3.5.3",
|
|
107
104
|
"tsx": "^4.21.0",
|
|
108
105
|
"typescript": "^5.9.3",
|