Add DOLE.

This commit is contained in:
Emmanuel 2022-08-13 15:40:13 +02:00
parent 9d4d619d43
commit 00d3281a68
5 changed files with 64 additions and 0 deletions

View file

@ -7,6 +7,13 @@ _Tricoteuses Legal Explorer_ is free and open source software.
- [software repository](https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer)
- [GNU Affero General Public License version 3 or greater](https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer/blob/master/LICENSE.md)
Legal data sources:
- https://www.dila.premier-ministre.gouv.fr/repertoire-des-informations-publiques/les-donnees-juridiques
- DOLE: https://echanges.dila.gouv.fr/OPENDATA/DOLE/
- JORF: https://echanges.dila.gouv.fr/OPENDATA/JORF/
- LEGI: https://echanges.dila.gouv.fr/OPENDATA/LEGI/
## Installation
### Create database

View file

@ -29,6 +29,15 @@ export interface Contexte {
}
}
export interface DossierLegislatif {
META: {
META_COMMUN: MetaCommun
META_DOSSIER_LEGISLATIF: {
TITRE: string
}
}
}
export type Etat = "MODIFIE" | "VIGUEUR"
export interface IdWrapper {
@ -51,6 +60,7 @@ export interface Jo {
export type LegalObject =
| Article
| DossierLegislatif
| IdWrapper
| Jo
| SectionTa
@ -60,6 +70,7 @@ export type LegalObject =
export type LegalObjectType =
| "article"
| "dossier_legislatif"
| "id"
| "jo"
| "section_ta"
@ -159,6 +170,10 @@ export function pathnameFromLegalObject(
switch (type) {
case "article":
return `/article/${(object as Article).META.META_COMMUN.ID}`
case "dossier_legislatif":
return `/dossier_legislatif/${
(object as DossierLegislatif).META.META_COMMUN.ID
}`
case "id":
return `/id/${(object as IdWrapper).eli}`
case "jo":
@ -183,6 +198,8 @@ export function pathnameFromLegalObjectId(
switch (type) {
case "article":
return `/article/${id}`
case "dossier_legislatif":
return `/dossier_legislatif/${id}`
case "id":
// Here, id is an ELI.
return `/id/{id}`

View file

@ -64,6 +64,14 @@ export async function configureDatabase() {
// )
// `
// Table: dossier_legislatif
await db`
CREATE TABLE IF NOT EXISTS dossier_legislatif (
id char(20) PRIMARY KEY,
data jsonb NOT NULL
)
`
// Table: id
await db`
CREATE TABLE IF NOT EXISTS id (

View file

@ -16,6 +16,7 @@ import {
type TexteVersion,
type LienArt,
type VersionsWrapper,
type DossierLegislatif,
} from "$lib/data"
export const summarizeArticleProperties: Summarizer = (access, value) => {
@ -80,6 +81,32 @@ export const summarizeArticleProperties: Summarizer = (access, value) => {
return undefined
}
export const summarizeDossierLegislatifProperties: Summarizer = (
access,
value,
) => {
if (access?.key === "dossier_legislatif" && typeof value !== "number") {
return summarizeLegalObject(access, "dossier_legislatif", value)
}
if (
typeof access?.key === "number" &&
access?.access?.key === "dossier_legislatif"
) {
return summarizeLegalObjectToLink(access, "dossier_legislatif", value)
}
if (access?.key === "CONTENU_DOSSIER_1") {
return { content: value as string, type: "html" }
}
if (access?.key === "CONTENU_DOSSIER_2") {
return { content: value as string, type: "html" }
}
if (access?.key === "EXPOSE_MOTIF") {
return { content: value as string, type: "html" }
}
return undefined
}
export const summarizeIdWrapperProperties: Summarizer = (access, value) => {
if (access?.key === "id" && typeof value !== "number") {
return summarizeLegalObject(access, "id", value)
@ -148,6 +175,10 @@ export function summarizeLegalObject(
type: "concatenation",
}
}
case "dossier_legislatif": {
const dossierLegislatif = value as DossierLegislatif | undefined
return dossierLegislatif?.META.META_DOSSIER_LEGISLATIF.TITRE
}
case "id":
const idWrapper = value as IdWrapper | undefined
return idWrapper?.eli

View file

@ -30,6 +30,7 @@
{
items: [
{ href: "/article", label: "ARTICLE" },
{ href: "/dossier_legislatif", label: "DOSSIER_LEGISLATIF" },
{ href: "/id", label: "ID" },
{ href: "/jo", label: "JO" },
{ href: "/section_ta", label: "SECTION_TA" },