Datasets:
Update dataset card
Browse files
README.md
CHANGED
|
@@ -1,134 +1,179 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
- name: chunk_index
|
| 14 |
-
dtype: int32
|
| 15 |
-
- name: start_position
|
| 16 |
-
dtype: int32
|
| 17 |
-
- name: end_position
|
| 18 |
-
dtype: int32
|
| 19 |
-
- name: code
|
| 20 |
-
dtype: string
|
| 21 |
-
- name: num
|
| 22 |
-
dtype: string
|
| 23 |
-
- name: etat
|
| 24 |
-
dtype: string
|
| 25 |
-
- name: fullSectionsTitre
|
| 26 |
-
dtype: string
|
| 27 |
-
- name: article_id_legifrance
|
| 28 |
-
dtype: string
|
| 29 |
-
- name: article_code
|
| 30 |
-
dtype: string
|
| 31 |
-
- name: article_num
|
| 32 |
-
dtype: string
|
| 33 |
-
- name: article_cid
|
| 34 |
-
dtype: string
|
| 35 |
-
- name: article_idEli
|
| 36 |
-
dtype: string
|
| 37 |
-
- name: article_idEliAlias
|
| 38 |
-
dtype: string
|
| 39 |
-
- name: article_idTexte
|
| 40 |
-
dtype: string
|
| 41 |
-
- name: article_cidTexte
|
| 42 |
-
dtype: string
|
| 43 |
-
- name: article_texte
|
| 44 |
-
dtype: string
|
| 45 |
-
- name: article_texteHtml
|
| 46 |
-
dtype: string
|
| 47 |
-
- name: article_nota
|
| 48 |
-
dtype: string
|
| 49 |
-
- name: article_notaHtml
|
| 50 |
-
dtype: string
|
| 51 |
-
- name: article_surtitre
|
| 52 |
-
dtype: string
|
| 53 |
-
- name: article_historique
|
| 54 |
-
dtype: string
|
| 55 |
-
- name: article_dateDebut
|
| 56 |
-
dtype: string
|
| 57 |
-
- name: article_dateFin
|
| 58 |
-
dtype: string
|
| 59 |
-
- name: article_dateDebutExtension
|
| 60 |
-
dtype: string
|
| 61 |
-
- name: article_dateFinExtension
|
| 62 |
-
dtype: string
|
| 63 |
-
- name: article_etat
|
| 64 |
-
dtype: string
|
| 65 |
-
- name: article_type_article
|
| 66 |
-
dtype: string
|
| 67 |
-
- name: article_nature
|
| 68 |
-
dtype: string
|
| 69 |
-
- name: article_origine
|
| 70 |
-
dtype: string
|
| 71 |
-
- name: article_version_article
|
| 72 |
-
dtype: string
|
| 73 |
-
- name: article_versionPrecedente
|
| 74 |
-
dtype: string
|
| 75 |
-
- name: article_multipleVersions
|
| 76 |
-
dtype: bool
|
| 77 |
-
- name: article_sectionParentId
|
| 78 |
-
dtype: string
|
| 79 |
-
- name: article_sectionParentCid
|
| 80 |
-
dtype: string
|
| 81 |
-
- name: article_sectionParentTitre
|
| 82 |
-
dtype: string
|
| 83 |
-
- name: article_fullSectionsTitre
|
| 84 |
-
dtype: string
|
| 85 |
-
- name: article_ordre
|
| 86 |
-
dtype: int32
|
| 87 |
-
- name: article_partie
|
| 88 |
-
dtype: string
|
| 89 |
-
- name: article_livre
|
| 90 |
-
dtype: string
|
| 91 |
-
- name: article_titre
|
| 92 |
-
dtype: string
|
| 93 |
-
- name: article_chapitre
|
| 94 |
-
dtype: string
|
| 95 |
-
- name: article_section
|
| 96 |
-
dtype: string
|
| 97 |
-
- name: article_sous_section
|
| 98 |
-
dtype: string
|
| 99 |
-
- name: article_paragraphe
|
| 100 |
-
dtype: string
|
| 101 |
-
- name: article_infosComplementaires
|
| 102 |
-
dtype: string
|
| 103 |
-
- name: article_infosComplementairesHtml
|
| 104 |
-
dtype: string
|
| 105 |
-
- name: article_conditionDiffere
|
| 106 |
-
dtype: string
|
| 107 |
-
- name: article_infosRestructurationBranche
|
| 108 |
-
dtype: string
|
| 109 |
-
- name: article_infosRestructurationBrancheHtml
|
| 110 |
-
dtype: string
|
| 111 |
-
- name: article_renvoi
|
| 112 |
-
dtype: string
|
| 113 |
-
- name: article_comporteLiensSP
|
| 114 |
-
dtype: bool
|
| 115 |
-
- name: article_idTechInjection
|
| 116 |
-
dtype: string
|
| 117 |
-
- name: article_refInjection
|
| 118 |
-
dtype: string
|
| 119 |
-
- name: article_numeroBo
|
| 120 |
-
dtype: string
|
| 121 |
-
- name: article_inap
|
| 122 |
-
dtype: string
|
| 123 |
-
splits:
|
| 124 |
-
- name: train
|
| 125 |
-
num_bytes: 12463091
|
| 126 |
-
num_examples: 1630
|
| 127 |
-
download_size: 5131937
|
| 128 |
-
dataset_size: 12463091
|
| 129 |
-
configs:
|
| 130 |
-
- config_name: default
|
| 131 |
-
data_files:
|
| 132 |
-
- split: train
|
| 133 |
-
path: data/train-*
|
| 134 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# Open Codes
|
| 16 |
+
|
| 17 |
+
Open dataset of French legal code articles with embeddings.
|
| 18 |
+
|
| 19 |
+
Chunked articles from 5 French legal codes sourced from
|
| 20 |
+
[Legifrance](https://www.legifrance.gouv.fr/) via the PISTE API,
|
| 21 |
+
with 1024-dimensional embeddings generated by Mistral AI.
|
| 22 |
+
|
| 23 |
+
Each row is a text chunk enriched with full article metadata from the parent
|
| 24 |
+
legal code article.
|
| 25 |
+
|
| 26 |
+
## Dataset Description
|
| 27 |
+
|
| 28 |
+
- **Source**: [PISTE Legifrance API](https://piste.gouv.fr/) (official French government legal database)
|
| 29 |
+
- **License**: [Licence Ouverte / Etalab 2.0](https://www.etalab.gouv.fr/licence-ouverte-open-licence/)
|
| 30 |
+
- **Embeddings**: Mistral AI `mistral-embed` (1024 dimensions)
|
| 31 |
+
- **Update frequency**: Daily (nightly sync at 02:00 UTC, dataset push at 06:00 UTC)
|
| 32 |
+
- **Rows**: ~1,630 chunks from ~1,630 articles
|
| 33 |
+
|
| 34 |
+
### Legal codes included
|
| 35 |
+
|
| 36 |
+
| Code ID | Name |
|
| 37 |
+
|---------|------|
|
| 38 |
+
| `LEGITEXT000006070633` | Code general des collectivites territoriales |
|
| 39 |
+
| `LEGITEXT000006070162` | Code des communes |
|
| 40 |
+
| `LEGITEXT000006070239` | Code electoral |
|
| 41 |
+
| `LEGITEXT000006074075` | Code de l'urbanisme |
|
| 42 |
+
| `LEGITEXT000006070721` | Code civil |
|
| 43 |
+
|
| 44 |
+
## Schema
|
| 45 |
+
|
| 46 |
+
### Chunk fields
|
| 47 |
+
| Column | Type | Description |
|
| 48 |
+
|--------|------|-------------|
|
| 49 |
+
| `chunk_text` | string | Text content of the chunk |
|
| 50 |
+
| `embedding` | float32[1024] | Mistral AI embedding vector |
|
| 51 |
+
| `id_legifrance` | string | Legifrance article identifier |
|
| 52 |
+
| `code_name` | string | Human-readable code name (e.g. "Code civil") |
|
| 53 |
+
| `chunk_index` | int32 | Chunk position within the article (0-indexed) |
|
| 54 |
+
| `start_position` | int32 | Character offset in original article text |
|
| 55 |
+
| `end_position` | int32 | End character offset in original article text |
|
| 56 |
+
| `code` | string | Legal code identifier (e.g. LEGITEXT000006070721) |
|
| 57 |
+
| `num` | string | Article number (e.g. "L. 1234-5") |
|
| 58 |
+
| `etat` | string | Article status (VIGUEUR, ABROGE, etc.) |
|
| 59 |
+
| `fullSectionsTitre` | string | Full hierarchy path in the code |
|
| 60 |
+
|
| 61 |
+
### Article metadata fields (prefixed `article_`)
|
| 62 |
+
|
| 63 |
+
#### Identifiers
|
| 64 |
+
| Column | Type | Description |
|
| 65 |
+
|--------|------|-------------|
|
| 66 |
+
| `article_id_legifrance` | string | Legifrance article ID |
|
| 67 |
+
| `article_code` | string | Legal code ID |
|
| 68 |
+
| `article_num` | string | Article number |
|
| 69 |
+
| `article_cid` | string | Consolidated ID |
|
| 70 |
+
| `article_idEli` | string | ELI (European Legislation Identifier) |
|
| 71 |
+
| `article_idEliAlias` | string | ELI alias |
|
| 72 |
+
| `article_idTexte` | string | Text ID |
|
| 73 |
+
| `article_cidTexte` | string | Consolidated text ID |
|
| 74 |
+
|
| 75 |
+
#### Content
|
| 76 |
+
| Column | Type | Description |
|
| 77 |
+
|--------|------|-------------|
|
| 78 |
+
| `article_texte` | string | Full article plain text |
|
| 79 |
+
| `article_texteHtml` | string | Full article HTML |
|
| 80 |
+
| `article_nota` | string | Article notes (plain text) |
|
| 81 |
+
| `article_notaHtml` | string | Article notes (HTML) |
|
| 82 |
+
| `article_surtitre` | string | Article subtitle |
|
| 83 |
+
| `article_historique` | string | Article history |
|
| 84 |
+
|
| 85 |
+
#### Dates & Status
|
| 86 |
+
|
| 87 |
+
**Date format**: `article_dateDebut` and `article_dateFin` are stored as **Unix timestamps in milliseconds** (string type). This is the raw format returned by the Legifrance PISTE API.
|
| 88 |
+
|
| 89 |
+
To convert to a human-readable date in Python:
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from datetime import datetime, timezone
|
| 93 |
+
|
| 94 |
+
timestamp_ms = "1301529600000"
|
| 95 |
+
dt = datetime.fromtimestamp(int(timestamp_ms) / 1000, tz=timezone.utc)
|
| 96 |
+
print(dt) # 2011-03-31 00:00:00+00:00
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Special value: `32472144000000` (year 2999) means "no end date" — the article is in force indefinitely.
|
| 100 |
+
|
| 101 |
+
| Column | Type | Description |
|
| 102 |
+
|--------|------|-------------|
|
| 103 |
+
| `article_dateDebut` | string | Effective start date (Unix ms) |
|
| 104 |
+
| `article_dateFin` | string | Effective end date (Unix ms, `32472144000000` = indefinite) |
|
| 105 |
+
| `article_dateDebutExtension` | string | Extension start date (Unix ms) |
|
| 106 |
+
| `article_dateFinExtension` | string | Extension end date (Unix ms) |
|
| 107 |
+
| `article_etat` | string | Status: `VIGUEUR` (in force), `ABROGE` (repealed), etc. |
|
| 108 |
+
| `article_type_article` | string | Article type |
|
| 109 |
+
| `article_nature` | string | Legal nature |
|
| 110 |
+
| `article_origine` | string | Origin (e.g. `LEGI`) |
|
| 111 |
+
| `article_version_article` | string | Version identifier |
|
| 112 |
+
| `article_versionPrecedente` | string | Previous version ID |
|
| 113 |
+
| `article_multipleVersions` | bool | Has multiple versions |
|
| 114 |
+
|
| 115 |
+
#### Hierarchy
|
| 116 |
+
| Column | Type | Description |
|
| 117 |
+
|--------|------|-------------|
|
| 118 |
+
| `article_sectionParentId` | string | Parent section ID |
|
| 119 |
+
| `article_sectionParentCid` | string | Parent section consolidated ID |
|
| 120 |
+
| `article_sectionParentTitre` | string | Parent section title |
|
| 121 |
+
| `article_fullSectionsTitre` | string | Full hierarchy path |
|
| 122 |
+
| `article_ordre` | int32 | Sort order within the code |
|
| 123 |
+
| `article_partie` | string | Partie (e.g. "Partie legislative") |
|
| 124 |
+
| `article_livre` | string | Livre |
|
| 125 |
+
| `article_titre` | string | Titre |
|
| 126 |
+
| `article_chapitre` | string | Chapitre |
|
| 127 |
+
| `article_section` | string | Section |
|
| 128 |
+
| `article_sous_section` | string | Sous-section |
|
| 129 |
+
| `article_paragraphe` | string | Paragraphe |
|
| 130 |
+
|
| 131 |
+
#### Extras
|
| 132 |
+
| Column | Type | Description |
|
| 133 |
+
|--------|------|-------------|
|
| 134 |
+
| `article_infosComplementaires` | string | Additional info (plain text) |
|
| 135 |
+
| `article_infosComplementairesHtml` | string | Additional info (HTML) |
|
| 136 |
+
| `article_conditionDiffere` | string | Deferred condition |
|
| 137 |
+
| `article_infosRestructurationBranche` | string | Branch restructuring info |
|
| 138 |
+
| `article_infosRestructurationBrancheHtml` | string | Branch restructuring (HTML) |
|
| 139 |
+
| `article_renvoi` | string | Cross-references |
|
| 140 |
+
| `article_comporteLiensSP` | bool | Contains SP links |
|
| 141 |
+
| `article_idTechInjection` | string | Technical injection ID |
|
| 142 |
+
| `article_refInjection` | string | Injection reference |
|
| 143 |
+
| `article_numeroBo` | string | BO number |
|
| 144 |
+
| `article_inap` | string | INAP code |
|
| 145 |
+
|
| 146 |
+
## Usage
|
| 147 |
+
|
| 148 |
+
```python
|
| 149 |
+
from datasets import load_dataset
|
| 150 |
+
from datetime import datetime, timezone
|
| 151 |
+
|
| 152 |
+
ds = load_dataset("ArthurSrz/open_codes", split="train")
|
| 153 |
+
|
| 154 |
+
# Access a chunk with its embedding and article metadata
|
| 155 |
+
row = ds[0]
|
| 156 |
+
print(row["code_name"]) # e.g. "Code civil"
|
| 157 |
+
print(row["chunk_text"][:200])
|
| 158 |
+
print(len(row["embedding"])) # 1024
|
| 159 |
+
|
| 160 |
+
# Convert dates from Unix ms to datetime
|
| 161 |
+
date_debut = datetime.fromtimestamp(int(row["article_dateDebut"]) / 1000, tz=timezone.utc)
|
| 162 |
+
print(date_debut) # e.g. 2011-03-31 00:00:00+00:00
|
| 163 |
+
|
| 164 |
+
# Filter by legal code
|
| 165 |
+
code_civil = ds.filter(lambda x: x["code_name"] == "Code civil")
|
| 166 |
+
|
| 167 |
+
# Filter active articles only
|
| 168 |
+
en_vigueur = ds.filter(lambda x: x["article_etat"] == "VIGUEUR")
|
| 169 |
+
|
| 170 |
+
# Use embeddings for semantic search
|
| 171 |
+
import numpy as np
|
| 172 |
+
query_emb = np.array(ds[0]["embedding"])
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
## Provenance
|
| 176 |
+
|
| 177 |
+
Built by the [marIAnne](https://github.com/ArthurSrz/open_codes) project.
|
| 178 |
+
Sync pipeline fetches articles nightly from PISTE Legifrance, chunks them,
|
| 179 |
+
and generates embeddings via Mistral AI.
|