@socialgouv/kali-data
v3.392.0
Published
[![License][img-license]][link-license] [![NPM Version][img-npm]][link-npm] [![Code Coverage][img-coverage]][link-coverage]
Readme
@socialgouv/kali-data
Dump JSON régulier des conventions collectives publiées par l'API DILA.
:warning: Experimental, for internal usage only :warning:
Extracted with dila-api-client from DILA API API using unist (Univeral Syntax Tree) structure.
Usage
Getting started
npm i @socialgouv/kali-dataDefinitions
Agreement
An agreement is a labor agreement (convention collective in French). Only national agreements are available at the moment. Each agreement is made up of articles wrapped within sections.
Article
An article always refers to an agreement article.
API
This package is typed with Typescript, you can check the returns type details there.
Data
It's possible to require any of the available agreements JSON unist tree straight from the data directory:
const JournalismAgreement = require("@socialgouv/kali-data/data/KALITEXT000005652402.json");And the list of available agreements with :
const agreements = require("@socialgouv/kali-data/data/index.json");Return Type
KaliData.AgreementgetAgreement()
Get a full agreement unist tree with its sections and articles.
| Parameter | Type | Default | Description |
| ------------------- | ------------------ | ------------ | -------------------- |
| agreementIdOrIdcc | number \| string | required | Agreement ID or IDCC |
Return Type
KaliData.AgreementgetAgreementArticlesWithParentSections()
:warning: Deprecated: Use getAgreementArticlesWithPath() instead.
Get a flat unist array of all the articles an agreement contains.
Each article includes a list of its parent sections.
| Parameter | Type | Default | Description |
| ------------------- | ------------------ | ------------ | -------------------- |
| agreementIdOrIdcc | number \| string | required | Agreement ID or IDCC |
Return Type
KaliData.AgreementArticleWithParentSections[]getAgreementArticlesWithPath()
Get a flat unist array of all the articles an agreement contains.
Each article includes its parent sections path, as an ordered list of their titles.
| Parameter | Type | Default | Description |
| ------------------- | ------------------ | ------------ | -------------------- |
| agreementIdOrIdcc | number \| string | required | Agreement ID or IDCC |
Return Type
KaliData.AgreementArticleWithPath[]getAgreementIdFromIdOrIdcc()
Convert any agreement ID or IDCC into a normalized agreement ID.
| Parameter | Type | Default | Description |
| ------------------- | ------------------ | ------------ | -------------------- |
| agreementIdOrIdcc | number \| string | required | Agreement ID or IDCC |
Return Type
stringgetAgreements()
Get the full list of indexed agreements.
Return Type
KaliData.IndexedAgreement[]getArticles()
Get the full list of indexed articles.
Return Type
KaliData.IndexedArticle[]getArticleWithParentSections()
:warning: Deprecated: Use getArticleWithPath() instead.
Get an agreement article unist node with its parent sections.
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| articleIdOrCid | string | required | Article ID or CID |
Return Type
KaliData.AgreementArticleWithParentSectionsgetArticleWithPath()
Get an agreement article unist node with its parent sections path.
The parent sections path is represented as an ordered array of their titles.
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| articleIdOrCid | string | required | Article ID or CID |
Return Type
KaliData.AgreementArticleWithPathgetIndexedArticle()
Get an indexed article.
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| articleIdOrCid | string | required | Article ID or CID |
Return Type
KaliData.IndexedArticlehasAgreement()
Check if an agreement is available.
| Parameter | Type | Default | Description |
| ------------------- | ------------------ | ------------ | -------------------- |
| agreementIdOrIdcc | number \| string | required | Agreement ID or IDCC |
Return Type
booleanhasArticle()
Check if an article is available.
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| articleIdOrCid | string | required | Article ID or CID |
Return Type
booleanContributing
Getting started
First, you'll need to create an application on PISTE and select DILA - Légifrance Beta API.
Then:
yarn
yarn setupThis will automatically prompt and store your OAuth Client ID & Secret.
Data Generation
yarn data:update will automatically fetch, match, list and check data package agreements with
their articles.
yarn data:checkCheck agreements consistency.yarn data:fetch: Update agreements articles from DILA API.yarn data:match: Update agreements articles index (matching articles ID & CID with their agreements ID).yarn data:listUpdateREFERENCES.mdfile.
Tests
yarn test:lint: Lint codebase.yarn test:type: Check typings.yarn test:unitLaunch unit tests.yarn test:updateUpdate unit tests snapshots.yarn test:watchLaunch unit tests in watching mode.
References
The agreement references list is available here.
See Also
- Code du travail numérique
- dila-api-client : Client JavaScript pour l'API DILA AIFE
- legi-data : base LEGI
- fiches-vdd : Fiches vos droits et démarches
