Datasets:
Update dataset card
Browse files
README.md
CHANGED
|
@@ -1,340 +1,62 @@
|
|
| 1 |
---
|
| 2 |
license: etalab-2.0
|
| 3 |
language:
|
| 4 |
-
- fr
|
| 5 |
tags:
|
| 6 |
-
- legal
|
| 7 |
-
- french-law
|
| 8 |
-
- embeddings
|
| 9 |
-
- legifrance
|
| 10 |
-
-
|
| 11 |
-
- circulaires
|
| 12 |
-
- mistral
|
| 13 |
size_categories:
|
| 14 |
-
- 10K<n<100K
|
| 15 |
configs:
|
| 16 |
-
- config_name:
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
- config_name:
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
- config_name:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
- config_name: reponses_legis
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
dataset_info:
|
| 33 |
-
- config_name: circulaires
|
| 34 |
-
features:
|
| 35 |
-
- name: chunk_text
|
| 36 |
-
dtype: string
|
| 37 |
-
- name: embedding
|
| 38 |
-
list: float32
|
| 39 |
-
length: 1024
|
| 40 |
-
- name: source_id
|
| 41 |
-
dtype: string
|
| 42 |
-
- name: chunk_index
|
| 43 |
-
dtype: int32
|
| 44 |
-
- name: numero
|
| 45 |
-
dtype: string
|
| 46 |
-
- name: date_parution
|
| 47 |
-
dtype: string
|
| 48 |
-
- name: ministere
|
| 49 |
-
dtype: string
|
| 50 |
-
- name: objet
|
| 51 |
-
dtype: string
|
| 52 |
-
- name: url_legifrance
|
| 53 |
-
dtype: string
|
| 54 |
-
splits:
|
| 55 |
-
- name: train
|
| 56 |
-
num_bytes: 564022
|
| 57 |
-
num_examples: 115
|
| 58 |
-
download_size: 519498
|
| 59 |
-
dataset_size: 564022
|
| 60 |
-
- config_name: default
|
| 61 |
-
features:
|
| 62 |
-
- name: chunk_text
|
| 63 |
-
dtype: string
|
| 64 |
-
- name: embedding
|
| 65 |
-
list: float32
|
| 66 |
-
length: 1024
|
| 67 |
-
- name: id_legifrance
|
| 68 |
-
dtype: string
|
| 69 |
-
- name: code_name
|
| 70 |
-
dtype: string
|
| 71 |
-
- name: chunk_index
|
| 72 |
-
dtype: int32
|
| 73 |
-
- name: start_position
|
| 74 |
-
dtype: int32
|
| 75 |
-
- name: end_position
|
| 76 |
-
dtype: int32
|
| 77 |
-
- name: code
|
| 78 |
-
dtype: string
|
| 79 |
-
- name: num
|
| 80 |
-
dtype: string
|
| 81 |
-
- name: etat
|
| 82 |
-
dtype: string
|
| 83 |
-
- name: fullSectionsTitre
|
| 84 |
-
dtype: string
|
| 85 |
-
- name: article_id_legifrance
|
| 86 |
-
dtype: string
|
| 87 |
-
- name: article_code
|
| 88 |
-
dtype: string
|
| 89 |
-
- name: article_num
|
| 90 |
-
dtype: string
|
| 91 |
-
- name: article_cid
|
| 92 |
-
dtype: string
|
| 93 |
-
- name: article_idEli
|
| 94 |
-
dtype: string
|
| 95 |
-
- name: article_idEliAlias
|
| 96 |
-
dtype: string
|
| 97 |
-
- name: article_idTexte
|
| 98 |
-
dtype: string
|
| 99 |
-
- name: article_cidTexte
|
| 100 |
-
dtype: string
|
| 101 |
-
- name: article_texte
|
| 102 |
-
dtype: string
|
| 103 |
-
- name: article_texteHtml
|
| 104 |
-
dtype: string
|
| 105 |
-
- name: article_nota
|
| 106 |
-
dtype: string
|
| 107 |
-
- name: article_notaHtml
|
| 108 |
-
dtype: string
|
| 109 |
-
- name: article_surtitre
|
| 110 |
-
dtype: string
|
| 111 |
-
- name: article_historique
|
| 112 |
-
dtype: string
|
| 113 |
-
- name: article_dateDebut
|
| 114 |
-
dtype: string
|
| 115 |
-
- name: article_dateFin
|
| 116 |
-
dtype: string
|
| 117 |
-
- name: article_dateDebutExtension
|
| 118 |
-
dtype: string
|
| 119 |
-
- name: article_dateFinExtension
|
| 120 |
-
dtype: string
|
| 121 |
-
- name: article_etat
|
| 122 |
-
dtype: string
|
| 123 |
-
- name: article_type_article
|
| 124 |
-
dtype: string
|
| 125 |
-
- name: article_nature
|
| 126 |
-
dtype: string
|
| 127 |
-
- name: article_origine
|
| 128 |
-
dtype: string
|
| 129 |
-
- name: article_version_article
|
| 130 |
-
dtype: string
|
| 131 |
-
- name: article_versionPrecedente
|
| 132 |
-
dtype: string
|
| 133 |
-
- name: article_multipleVersions
|
| 134 |
-
dtype: bool
|
| 135 |
-
- name: article_sectionParentId
|
| 136 |
-
dtype: string
|
| 137 |
-
- name: article_sectionParentCid
|
| 138 |
-
dtype: string
|
| 139 |
-
- name: article_sectionParentTitre
|
| 140 |
-
dtype: string
|
| 141 |
-
- name: article_fullSectionsTitre
|
| 142 |
-
dtype: string
|
| 143 |
-
- name: article_ordre
|
| 144 |
-
dtype: int32
|
| 145 |
-
- name: article_partie
|
| 146 |
-
dtype: string
|
| 147 |
-
- name: article_livre
|
| 148 |
-
dtype: string
|
| 149 |
-
- name: article_titre
|
| 150 |
-
dtype: string
|
| 151 |
-
- name: article_chapitre
|
| 152 |
-
dtype: string
|
| 153 |
-
- name: article_section
|
| 154 |
-
dtype: string
|
| 155 |
-
- name: article_sous_section
|
| 156 |
-
dtype: string
|
| 157 |
-
- name: article_paragraphe
|
| 158 |
-
dtype: string
|
| 159 |
-
- name: article_infosComplementaires
|
| 160 |
-
dtype: string
|
| 161 |
-
- name: article_infosComplementairesHtml
|
| 162 |
-
dtype: string
|
| 163 |
-
- name: article_conditionDiffere
|
| 164 |
-
dtype: string
|
| 165 |
-
- name: article_infosRestructurationBranche
|
| 166 |
-
dtype: string
|
| 167 |
-
- name: article_infosRestructurationBrancheHtml
|
| 168 |
-
dtype: string
|
| 169 |
-
- name: article_renvoi
|
| 170 |
-
dtype: string
|
| 171 |
-
- name: article_comporteLiensSP
|
| 172 |
-
dtype: bool
|
| 173 |
-
- name: article_idTechInjection
|
| 174 |
-
dtype: string
|
| 175 |
-
- name: article_refInjection
|
| 176 |
-
dtype: string
|
| 177 |
-
- name: article_numeroBo
|
| 178 |
-
dtype: string
|
| 179 |
-
- name: article_inap
|
| 180 |
-
dtype: string
|
| 181 |
-
splits:
|
| 182 |
-
- name: train
|
| 183 |
-
num_bytes: 181131033
|
| 184 |
-
num_examples: 23360
|
| 185 |
-
download_size: 119905697
|
| 186 |
-
dataset_size: 181131033
|
| 187 |
-
- config_name: jurisprudence
|
| 188 |
-
features:
|
| 189 |
-
- name: chunk_text
|
| 190 |
-
dtype: string
|
| 191 |
-
- name: embedding
|
| 192 |
-
list: float32
|
| 193 |
-
length: 1024
|
| 194 |
-
- name: source_id
|
| 195 |
-
dtype: string
|
| 196 |
-
- name: chunk_index
|
| 197 |
-
dtype: int32
|
| 198 |
-
- name: jurisdiction
|
| 199 |
-
dtype: string
|
| 200 |
-
- name: chamber
|
| 201 |
-
dtype: string
|
| 202 |
-
- name: date_decision
|
| 203 |
-
dtype: string
|
| 204 |
-
- name: solution
|
| 205 |
-
dtype: string
|
| 206 |
-
- name: fiche_arret
|
| 207 |
-
dtype: string
|
| 208 |
-
- name: url_judilibre
|
| 209 |
-
dtype: string
|
| 210 |
-
- name: zone
|
| 211 |
-
dtype: string
|
| 212 |
-
splits:
|
| 213 |
-
- name: train
|
| 214 |
-
num_bytes: 8210587
|
| 215 |
-
num_examples: 744
|
| 216 |
-
download_size: 5090893
|
| 217 |
-
dataset_size: 8210587
|
| 218 |
-
- config_name: reponses_legis
|
| 219 |
-
features:
|
| 220 |
-
- name: chunk_text
|
| 221 |
-
dtype: string
|
| 222 |
-
- name: embedding
|
| 223 |
-
list: float32
|
| 224 |
-
length: 1024
|
| 225 |
-
- name: source_id
|
| 226 |
-
dtype: string
|
| 227 |
-
- name: chunk_index
|
| 228 |
-
dtype: int32
|
| 229 |
-
- name: numero_question
|
| 230 |
-
dtype: string
|
| 231 |
-
- name: date_reponse
|
| 232 |
-
dtype: string
|
| 233 |
-
- name: ministere
|
| 234 |
-
dtype: string
|
| 235 |
-
- name: question_text
|
| 236 |
-
dtype: string
|
| 237 |
-
- name: url_legifrance
|
| 238 |
-
dtype: string
|
| 239 |
-
splits:
|
| 240 |
-
- name: train
|
| 241 |
-
num_bytes: 24436913
|
| 242 |
-
num_examples: 3787
|
| 243 |
-
download_size: 19828616
|
| 244 |
-
dataset_size: 24436913
|
| 245 |
---
|
| 246 |
|
| 247 |
# Open Codes
|
| 248 |
|
| 249 |
-
Open dataset of French legal
|
| 250 |
|
| 251 |
-
Chunked
|
|
|
|
| 252 |
with 1024-dimensional embeddings generated by Mistral AI.
|
| 253 |
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
| Source | Description | Config | Volume |
|
| 257 |
-
|--------|-------------|--------|--------|
|
| 258 |
-
| **Codes** | 14 legal codes from Legifrance | `default` | ~26K chunks |
|
| 259 |
-
| **Decisions de justice** | Court decisions from Judilibre | `jurisprudence` | ~82K decisions |
|
| 260 |
-
| **Circulaires** | Government circulars | `circulaires` | ~10K circulaires |
|
| 261 |
-
| **Questions & Reponses** | Parliamentary Q&A (reponses ministerielles) | `reponses_legis` | ~40K reponses |
|
| 262 |
|
| 263 |
## Dataset Description
|
| 264 |
|
| 265 |
-
- **
|
| 266 |
- **License**: [Licence Ouverte / Etalab 2.0](https://www.etalab.gouv.fr/licence-ouverte-open-licence/)
|
| 267 |
- **Embeddings**: Mistral AI `mistral-embed` (1024 dimensions)
|
| 268 |
-
- **Update frequency**: Daily (nightly sync at 02:00 UTC, dataset push at
|
|
|
|
| 269 |
- **Quality**: Dedup + stale-chunk filtering applied before every push
|
| 270 |
|
| 271 |
-
### Legal codes included
|
| 272 |
-
|
| 273 |
-
| Code | Domain |
|
| 274 |
-
|------|--------|
|
| 275 |
-
| Code civil | Core private law |
|
| 276 |
-
| Code de commerce | Commercial law |
|
| 277 |
-
| Code de la consommation | Consumer protection |
|
| 278 |
-
| Code de la propriete intellectuelle | Intellectual property |
|
| 279 |
-
| Code de la route | Traffic law |
|
| 280 |
-
| Code de l'urbanisme | Urban planning |
|
| 281 |
-
| Code de procedure civile | Civil procedure |
|
| 282 |
-
| Code de procedure penale | Criminal procedure |
|
| 283 |
-
| Code des communes | Municipal law |
|
| 284 |
-
| Code des procedures civiles d'execution | Civil enforcement |
|
| 285 |
-
| Code du travail | Labor law |
|
| 286 |
-
| Code electoral | Electoral law |
|
| 287 |
-
| Code general des collectivites territoriales | Local government |
|
| 288 |
-
| Code penal | Criminal law |
|
| 289 |
|
| 290 |
The list of legal codes is dynamic and managed in the `LEX_codes_piste` table.
|
| 291 |
Adding a new code there (with `actif=true`) automatically includes it in the next sync and export.
|
| 292 |
|
| 293 |
-
## Usage
|
| 294 |
-
|
| 295 |
-
```python
|
| 296 |
-
from datasets import load_dataset
|
| 297 |
-
|
| 298 |
-
# Load code articles (default config)
|
| 299 |
-
codes = load_dataset("ArthurSrz/open_codes", split="train")
|
| 300 |
-
|
| 301 |
-
# Load other sources
|
| 302 |
-
jurisprudence = load_dataset("ArthurSrz/open_codes", "jurisprudence", split="train")
|
| 303 |
-
circulaires = load_dataset("ArthurSrz/open_codes", "circulaires", split="train")
|
| 304 |
-
reponses = load_dataset("ArthurSrz/open_codes", "reponses_legis", split="train")
|
| 305 |
-
|
| 306 |
-
# Browse a chunk
|
| 307 |
-
row = codes[0]
|
| 308 |
-
print(row["code_name"]) # e.g. "Code civil"
|
| 309 |
-
print(row["chunk_text"][:200])
|
| 310 |
-
print(len(row["embedding"])) # 1024
|
| 311 |
-
|
| 312 |
-
# Convert dates from Unix ms to datetime
|
| 313 |
-
from datetime import datetime, timezone
|
| 314 |
-
date_debut = datetime.fromtimestamp(int(row["article_dateDebut"]) / 1000, tz=timezone.utc)
|
| 315 |
-
print(date_debut) # e.g. 2011-03-31 00:00:00+00:00
|
| 316 |
-
|
| 317 |
-
# Use embeddings for semantic search
|
| 318 |
-
import numpy as np
|
| 319 |
-
query_emb = get_embedding("responsabilite civile") # your embedding function
|
| 320 |
-
scores = np.dot(np.array(codes["embedding"]), query_emb)
|
| 321 |
-
top_k = np.argsort(scores)[-5:][::-1]
|
| 322 |
-
for i in top_k:
|
| 323 |
-
print(f"{codes[i]['code_name']} {codes[i]['num']}: {codes[i]['chunk_text'][:100]}")
|
| 324 |
-
```
|
| 325 |
-
|
| 326 |
## Schema
|
| 327 |
|
| 328 |
-
###
|
| 329 |
-
|
| 330 |
-
| Config | Description | Source |
|
| 331 |
-
|--------|-------------|--------|
|
| 332 |
-
| `default` | Code articles + chunks from Legifrance PISTE API | `REF_codes_legifrance` + `REF_article_chunks` |
|
| 333 |
-
| `jurisprudence` | Court decisions from Judilibre API | `REF_decisions_judilibre` + `REF_legal_chunks` |
|
| 334 |
-
| `circulaires` | Government circulars | `REF_circulaires` + `REF_legal_chunks` |
|
| 335 |
-
| `reponses_legis` | Parliamentary written answers | `REF_reponses_ministerial` + `REF_legal_chunks` |
|
| 336 |
-
|
| 337 |
-
### Default config — Chunk fields
|
| 338 |
| Column | Type | Description |
|
| 339 |
|--------|------|-------------|
|
| 340 |
| `chunk_text` | string | Text content of the chunk |
|
|
@@ -349,7 +71,7 @@ for i in top_k:
|
|
| 349 |
| `etat` | string | Article status (VIGUEUR, ABROGE, etc.) |
|
| 350 |
| `fullSectionsTitre` | string | Full hierarchy path in the code |
|
| 351 |
|
| 352 |
-
###
|
| 353 |
|
| 354 |
#### Identifiers
|
| 355 |
| Column | Type | Description |
|
|
@@ -375,72 +97,109 @@ for i in top_k:
|
|
| 375 |
|
| 376 |
#### Dates & Status
|
| 377 |
|
| 378 |
-
**Date format**: `article_dateDebut` and `article_dateFin` are stored as **Unix timestamps in milliseconds** (string type).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
| Column | Type | Description |
|
| 381 |
|--------|------|-------------|
|
| 382 |
| `article_dateDebut` | string | Effective start date (Unix ms) |
|
| 383 |
| `article_dateFin` | string | Effective end date (Unix ms, `32472144000000` = indefinite) |
|
|
|
|
|
|
|
| 384 |
| `article_etat` | string | Status: `VIGUEUR` (in force), `ABROGE` (repealed), etc. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
#### Hierarchy
|
| 387 |
| Column | Type | Description |
|
| 388 |
|--------|------|-------------|
|
|
|
|
|
|
|
|
|
|
| 389 |
| `article_fullSectionsTitre` | string | Full hierarchy path |
|
|
|
|
| 390 |
| `article_partie` | string | Partie (e.g. "Partie legislative") |
|
| 391 |
| `article_livre` | string | Livre |
|
| 392 |
| `article_titre` | string | Titre |
|
| 393 |
| `article_chapitre` | string | Chapitre |
|
| 394 |
| `article_section` | string | Section |
|
| 395 |
| `article_sous_section` | string | Sous-section |
|
|
|
|
| 396 |
|
| 397 |
-
###
|
| 398 |
| Column | Type | Description |
|
| 399 |
|--------|------|-------------|
|
| 400 |
-
| `
|
| 401 |
-
| `
|
| 402 |
-
| `
|
| 403 |
-
| `
|
| 404 |
-
| `
|
| 405 |
-
| `
|
| 406 |
-
| `
|
| 407 |
-
| `
|
| 408 |
-
| `
|
| 409 |
-
| `
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
|
| 415 |
-
|
|
| 416 |
-
| `
|
| 417 |
-
| `
|
| 418 |
-
| `
|
| 419 |
-
| `
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
## Provenance
|
| 438 |
|
| 439 |
Built by the [marIAnne](https://github.com/ArthurSrz/open_codes) project.
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
- Jurisprudence: [Judilibre / Cour de cassation](https://www.courdecassation.fr/acces-rapide-judilibre)
|
| 443 |
-
- Reponses ministerielles: [DILA / Journal officiel](https://journal-officiel.gouv.fr/)
|
| 444 |
-
- Embeddings: [Mistral AI](https://mistral.ai/)
|
| 445 |
-
- Backend: [Xano](https://www.xano.com/)
|
| 446 |
-
- Dataset hosting: [HuggingFace Hub](https://huggingface.co/)
|
|
|
|
| 1 |
---
|
| 2 |
license: etalab-2.0
|
| 3 |
language:
|
| 4 |
+
- fr
|
| 5 |
tags:
|
| 6 |
+
- legal
|
| 7 |
+
- french-law
|
| 8 |
+
- embeddings
|
| 9 |
+
- legifrance
|
| 10 |
+
- mistral
|
|
|
|
|
|
|
| 11 |
size_categories:
|
| 12 |
+
- 10K<n<100K
|
| 13 |
configs:
|
| 14 |
+
- config_name: default
|
| 15 |
+
data_files:
|
| 16 |
+
- split: train
|
| 17 |
+
path: data/train-*.parquet
|
| 18 |
+
- config_name: jurisprudence
|
| 19 |
+
data_files:
|
| 20 |
+
- split: train
|
| 21 |
+
path: jurisprudence/train-*.parquet
|
| 22 |
+
- config_name: circulaires
|
| 23 |
+
data_files:
|
| 24 |
+
- split: train
|
| 25 |
+
path: circulaires/train-*.parquet
|
| 26 |
+
- config_name: reponses_legis
|
| 27 |
+
data_files:
|
| 28 |
+
- split: train
|
| 29 |
+
path: reponses_legis/train-*.parquet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
---
|
| 31 |
|
| 32 |
# Open Codes
|
| 33 |
|
| 34 |
+
Open dataset of French legal code articles with embeddings.
|
| 35 |
|
| 36 |
+
Chunked articles from French legal codes sourced from
|
| 37 |
+
[Legifrance](https://www.legifrance.gouv.fr/) via the PISTE API,
|
| 38 |
with 1024-dimensional embeddings generated by Mistral AI.
|
| 39 |
|
| 40 |
+
Each row is a text chunk enriched with full article metadata from the parent
|
| 41 |
+
legal code article.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
## Dataset Description
|
| 44 |
|
| 45 |
+
- **Source**: [PISTE Legifrance API](https://piste.gouv.fr/) (official French government legal database)
|
| 46 |
- **License**: [Licence Ouverte / Etalab 2.0](https://www.etalab.gouv.fr/licence-ouverte-open-licence/)
|
| 47 |
- **Embeddings**: Mistral AI `mistral-embed` (1024 dimensions)
|
| 48 |
+
- **Update frequency**: Daily (nightly sync at 02:00 UTC, dataset push at 06:00 UTC)
|
| 49 |
+
- **Codes**: Dynamically sourced from `LEX_codes_piste` (active codes only)
|
| 50 |
- **Quality**: Dedup + stale-chunk filtering applied before every push
|
| 51 |
|
| 52 |
+
### Legal codes included
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
The list of legal codes is dynamic and managed in the `LEX_codes_piste` table.
|
| 55 |
Adding a new code there (with `actif=true`) automatically includes it in the next sync and export.
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
## Schema
|
| 58 |
|
| 59 |
+
### Chunk fields
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
| Column | Type | Description |
|
| 61 |
|--------|------|-------------|
|
| 62 |
| `chunk_text` | string | Text content of the chunk |
|
|
|
|
| 71 |
| `etat` | string | Article status (VIGUEUR, ABROGE, etc.) |
|
| 72 |
| `fullSectionsTitre` | string | Full hierarchy path in the code |
|
| 73 |
|
| 74 |
+
### Article metadata fields (prefixed `article_`)
|
| 75 |
|
| 76 |
#### Identifiers
|
| 77 |
| Column | Type | Description |
|
|
|
|
| 97 |
|
| 98 |
#### Dates & Status
|
| 99 |
|
| 100 |
+
**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.
|
| 101 |
+
|
| 102 |
+
To convert to a human-readable date in Python:
|
| 103 |
+
|
| 104 |
+
```python
|
| 105 |
+
from datetime import datetime, timezone
|
| 106 |
+
|
| 107 |
+
timestamp_ms = "1301529600000"
|
| 108 |
+
dt = datetime.fromtimestamp(int(timestamp_ms) / 1000, tz=timezone.utc)
|
| 109 |
+
print(dt) # 2011-03-31 00:00:00+00:00
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
Special value: `32472144000000` (year 2999) means "no end date" — the article is in force indefinitely.
|
| 113 |
|
| 114 |
| Column | Type | Description |
|
| 115 |
|--------|------|-------------|
|
| 116 |
| `article_dateDebut` | string | Effective start date (Unix ms) |
|
| 117 |
| `article_dateFin` | string | Effective end date (Unix ms, `32472144000000` = indefinite) |
|
| 118 |
+
| `article_dateDebutExtension` | string | Extension start date (Unix ms) |
|
| 119 |
+
| `article_dateFinExtension` | string | Extension end date (Unix ms) |
|
| 120 |
| `article_etat` | string | Status: `VIGUEUR` (in force), `ABROGE` (repealed), etc. |
|
| 121 |
+
| `article_type_article` | string | Article type |
|
| 122 |
+
| `article_nature` | string | Legal nature |
|
| 123 |
+
| `article_origine` | string | Origin (e.g. `LEGI`) |
|
| 124 |
+
| `article_version_article` | string | Version identifier |
|
| 125 |
+
| `article_versionPrecedente` | string | Previous version ID |
|
| 126 |
+
| `article_multipleVersions` | bool | Has multiple versions |
|
| 127 |
|
| 128 |
#### Hierarchy
|
| 129 |
| Column | Type | Description |
|
| 130 |
|--------|------|-------------|
|
| 131 |
+
| `article_sectionParentId` | string | Parent section ID |
|
| 132 |
+
| `article_sectionParentCid` | string | Parent section consolidated ID |
|
| 133 |
+
| `article_sectionParentTitre` | string | Parent section title |
|
| 134 |
| `article_fullSectionsTitre` | string | Full hierarchy path |
|
| 135 |
+
| `article_ordre` | int32 | Sort order within the code |
|
| 136 |
| `article_partie` | string | Partie (e.g. "Partie legislative") |
|
| 137 |
| `article_livre` | string | Livre |
|
| 138 |
| `article_titre` | string | Titre |
|
| 139 |
| `article_chapitre` | string | Chapitre |
|
| 140 |
| `article_section` | string | Section |
|
| 141 |
| `article_sous_section` | string | Sous-section |
|
| 142 |
+
| `article_paragraphe` | string | Paragraphe |
|
| 143 |
|
| 144 |
+
#### Extras
|
| 145 |
| Column | Type | Description |
|
| 146 |
|--------|------|-------------|
|
| 147 |
+
| `article_infosComplementaires` | string | Additional info (plain text) |
|
| 148 |
+
| `article_infosComplementairesHtml` | string | Additional info (HTML) |
|
| 149 |
+
| `article_conditionDiffere` | string | Deferred condition |
|
| 150 |
+
| `article_infosRestructurationBranche` | string | Branch restructuring info |
|
| 151 |
+
| `article_infosRestructurationBrancheHtml` | string | Branch restructuring (HTML) |
|
| 152 |
+
| `article_renvoi` | string | Cross-references |
|
| 153 |
+
| `article_comporteLiensSP` | bool | Contains SP links |
|
| 154 |
+
| `article_idTechInjection` | string | Technical injection ID |
|
| 155 |
+
| `article_refInjection` | string | Injection reference |
|
| 156 |
+
| `article_numeroBo` | string | BO number |
|
| 157 |
+
| `article_inap` | string | INAP code |
|
| 158 |
+
|
| 159 |
+
## Configs
|
| 160 |
+
|
| 161 |
+
| Config | Description | Source |
|
| 162 |
+
|--------|-------------|--------|
|
| 163 |
+
| `default` | Code articles + chunks from Legifrance PISTE API | `REF_codes_legifrance` + `REF_article_chunks` |
|
| 164 |
+
| `jurisprudence` | Court decisions from Judilibre API | `REF_decisions_judilibre` + `REF_legal_chunks` |
|
| 165 |
+
| `circulaires` | Government circulars | `REF_circulaires` + `REF_legal_chunks` |
|
| 166 |
+
| `reponses_legis` | Parliamentary written answers | `REF_reponses_ministerial` + `REF_legal_chunks` |
|
| 167 |
+
|
| 168 |
+
## Usage
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
from datasets import load_dataset
|
| 172 |
+
from datetime import datetime, timezone
|
| 173 |
+
|
| 174 |
+
# Load default config (code articles)
|
| 175 |
+
ds = load_dataset("ArthurSrz/open_codes", split="train")
|
| 176 |
+
|
| 177 |
+
# Load jurisprudence config (court decisions)
|
| 178 |
+
juris = load_dataset("ArthurSrz/open_codes", "jurisprudence", split="train")
|
| 179 |
+
|
| 180 |
+
# Access a chunk with its embedding and article metadata
|
| 181 |
+
row = ds[0]
|
| 182 |
+
print(row["code_name"]) # e.g. "Code civil"
|
| 183 |
+
print(row["chunk_text"][:200])
|
| 184 |
+
print(len(row["embedding"])) # 1024
|
| 185 |
+
|
| 186 |
+
# Convert dates from Unix ms to datetime
|
| 187 |
+
date_debut = datetime.fromtimestamp(int(row["article_dateDebut"]) / 1000, tz=timezone.utc)
|
| 188 |
+
print(date_debut) # e.g. 2011-03-31 00:00:00+00:00
|
| 189 |
+
|
| 190 |
+
# Filter by legal code
|
| 191 |
+
code_civil = ds.filter(lambda x: x["code_name"] == "Code civil")
|
| 192 |
+
|
| 193 |
+
# Filter active articles only
|
| 194 |
+
en_vigueur = ds.filter(lambda x: x["article_etat"] == "VIGUEUR")
|
| 195 |
+
|
| 196 |
+
# Use embeddings for semantic search
|
| 197 |
+
import numpy as np
|
| 198 |
+
query_emb = np.array(ds[0]["embedding"])
|
| 199 |
+
```
|
| 200 |
|
| 201 |
## Provenance
|
| 202 |
|
| 203 |
Built by the [marIAnne](https://github.com/ArthurSrz/open_codes) project.
|
| 204 |
+
Sync pipeline fetches articles nightly from PISTE Legifrance, chunks them,
|
| 205 |
+
and generates embeddings via Mistral AI.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|