Extractions quotidiennes des codes de loi de la base LEGI depuis l'API legifrance.gouv.fr
Les données sont disponibles au format JSON ou via une API TypeScript.
ex pour récupérer le "code du travail" complet :
const code = require("@socialgouv/legi-data/data/LEGITEXT000006072050.json");
La structure du JSON est basée sur unified
Actuellement, seuls 4 codes sont versionnés ici :
Id | Description |
---|---|
LEGITEXT000006072050 | Code du travail |
LEGITEXT000022197698 | Code de la sécurité sociale |
LEGITEXT000022197698 | Code rural et de la pêche maritime |
LEGITEXT000031366350 | Code des relations entre le public et l'administration |
Postez une issue si vous souhaitez en voir d'autres.
npm i @socialgouv/legi-data
# or if you only need the Typescript types
npm i -D @socialgouv/legi-data-types
Get a code article unist node with its parent sections.
Parameter | Type | Default | Description |
---|---|---|---|
articleIdOrCid |
string |
required | Article ID or CID |
Return Type
LegiData.CodeArticleWithParentSections;
Get a full code unist node with its sections and articles.
Parameter | Type | Default | Description |
---|---|---|---|
codeId |
string |
required | Code ID |
Return Type
LegiData.Code;
Get a full code unist node with its sections and articles.
Each node has a
parent
property with a pointer to its parent node.
Parameter | Type | Default | Description |
---|---|---|---|
codeId |
string |
required | Code ID |
Return Type
LegiData.CodeWithParents;
Get an indexed articles.
Parameter | Type | Default | Description |
---|---|---|---|
articleIdOrCid |
string |
required | Article ID or CID |
Return Type
LegiData.IndexedArticle;
Get the full list of indexed articles.
Return Type
LegiData.IndexedArticle[]
Get the full list of indexed codes.
Return Type
LegiData.IndexedCode[]
Check if an article is available.
Parameter | Type | Default | Description |
---|---|---|---|
articleIdOrCid |
string |
required | Article ID or CID |
Return Type
boolean;
Check if an code is available.
Parameter | Type | Default | Description |
---|---|---|---|
codeId |
string |
required | Code ID |
Return Type
boolean;
First, you'll need to create an application on PISTE and select DILA - Légifrance Beta API.
Then:
yarn
yarn setup
This will automatically prompt and store your OAuth Client ID & Secret.
yarn data:update
will automatically fetch, list and match data package codes with their
articles.
yarn data:fetch
: Update codes articles from DILA API.yarn data:match
: Update codes articles index (matching articles ID & CID with their codes ID).yarn data:list
UpdateREFERENCES.md
file.
yarn test:lint
: Lint codebase.yarn test:type
: Check typings.yarn test:unit
Launch unit tests.yarn test:update
Update unit tests snapshots.yarn test:watch
Launch unit tests in watching mode.
The agreement references list is available here.
- Code du travail numérique
- dila-api-client : Client JavaScript pour l'API DILA AIFE
- kali-data : base conventions collectives KALI
- fiches-vdd : Fiches vos droits et démarches