Datasets:
license: etalab-2.0
language:
- fr
tags:
- legal
- french-law
- embeddings
- legifrance
- mistral
size_categories:
- 1K<n<10K
dataset_info:
features:
- name: chunk_text
dtype: string
- name: embedding
list: float32
length: 1024
- name: id_legifrance
dtype: string
- name: code_name
dtype: string
- name: chunk_index
dtype: int32
- name: start_position
dtype: int32
- name: end_position
dtype: int32
- name: code
dtype: string
- name: num
dtype: string
- name: etat
dtype: string
- name: fullSectionsTitre
dtype: string
- name: article_id_legifrance
dtype: string
- name: article_code
dtype: string
- name: article_num
dtype: string
- name: article_cid
dtype: string
- name: article_idEli
dtype: string
- name: article_idEliAlias
dtype: string
- name: article_idTexte
dtype: string
- name: article_cidTexte
dtype: string
- name: article_texte
dtype: string
- name: article_texteHtml
dtype: string
- name: article_nota
dtype: string
- name: article_notaHtml
dtype: string
- name: article_surtitre
dtype: string
- name: article_historique
dtype: string
- name: article_dateDebut
dtype: string
- name: article_dateFin
dtype: string
- name: article_dateDebutExtension
dtype: string
- name: article_dateFinExtension
dtype: string
- name: article_etat
dtype: string
- name: article_type_article
dtype: string
- name: article_nature
dtype: string
- name: article_origine
dtype: string
- name: article_version_article
dtype: string
- name: article_versionPrecedente
dtype: string
- name: article_multipleVersions
dtype: bool
- name: article_sectionParentId
dtype: string
- name: article_sectionParentCid
dtype: string
- name: article_sectionParentTitre
dtype: string
- name: article_fullSectionsTitre
dtype: string
- name: article_ordre
dtype: int32
- name: article_partie
dtype: string
- name: article_livre
dtype: string
- name: article_titre
dtype: string
- name: article_chapitre
dtype: string
- name: article_section
dtype: string
- name: article_sous_section
dtype: string
- name: article_paragraphe
dtype: string
- name: article_infosComplementaires
dtype: string
- name: article_infosComplementairesHtml
dtype: string
- name: article_conditionDiffere
dtype: string
- name: article_infosRestructurationBranche
dtype: string
- name: article_infosRestructurationBrancheHtml
dtype: string
- name: article_renvoi
dtype: string
- name: article_comporteLiensSP
dtype: bool
- name: article_idTechInjection
dtype: string
- name: article_refInjection
dtype: string
- name: article_numeroBo
dtype: string
- name: article_inap
dtype: string
splits:
- name: train
num_bytes: 12463091
num_examples: 1630
download_size: 5174173
dataset_size: 12463091
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
Open Codes
Open dataset of French legal code articles with embeddings.
Chunked articles from 5 French legal codes sourced from Legifrance via the PISTE API, with 1024-dimensional embeddings generated by Mistral AI.
Each row is a text chunk enriched with full article metadata from the parent legal code article.
Dataset Description
- Source: PISTE Legifrance API (official French government legal database)
- License: Licence Ouverte / Etalab 2.0
- Embeddings: Mistral AI
mistral-embed(1024 dimensions) - Update frequency: Daily (nightly sync at 02:00 UTC, dataset push at 06:00 UTC)
- Rows: ~1,630 chunks from ~1,630 articles
Legal codes included
| Code ID | Name |
|---|---|
LEGITEXT000006070633 |
Code general des collectivites territoriales |
LEGITEXT000006070162 |
Code des communes |
LEGITEXT000006070239 |
Code electoral |
LEGITEXT000006074075 |
Code de l'urbanisme |
LEGITEXT000006070721 |
Code civil |
Schema
Chunk fields
| Column | Type | Description |
|---|---|---|
chunk_text |
string | Text content of the chunk |
embedding |
float32[1024] | Mistral AI embedding vector |
id_legifrance |
string | Legifrance article identifier |
code_name |
string | Human-readable code name (e.g. "Code civil") |
chunk_index |
int32 | Chunk position within the article (0-indexed) |
start_position |
int32 | Character offset in original article text |
end_position |
int32 | End character offset in original article text |
code |
string | Legal code identifier (e.g. LEGITEXT000006070721) |
num |
string | Article number (e.g. "L. 1234-5") |
etat |
string | Article status (VIGUEUR, ABROGE, etc.) |
fullSectionsTitre |
string | Full hierarchy path in the code |
Article metadata fields (prefixed article_)
Identifiers
| Column | Type | Description |
|---|---|---|
article_id_legifrance |
string | Legifrance article ID |
article_code |
string | Legal code ID |
article_num |
string | Article number |
article_cid |
string | Consolidated ID |
article_idEli |
string | ELI (European Legislation Identifier) |
article_idEliAlias |
string | ELI alias |
article_idTexte |
string | Text ID |
article_cidTexte |
string | Consolidated text ID |
Content
| Column | Type | Description |
|---|---|---|
article_texte |
string | Full article plain text |
article_texteHtml |
string | Full article HTML |
article_nota |
string | Article notes (plain text) |
article_notaHtml |
string | Article notes (HTML) |
article_surtitre |
string | Article subtitle |
article_historique |
string | Article history |
Dates & Status
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.
To convert to a human-readable date in Python:
from datetime import datetime, timezone
timestamp_ms = "1301529600000"
dt = datetime.fromtimestamp(int(timestamp_ms) / 1000, tz=timezone.utc)
print(dt) # 2011-03-31 00:00:00+00:00
Special value: 32472144000000 (year 2999) means "no end date" — the article is in force indefinitely.
| Column | Type | Description |
|---|---|---|
article_dateDebut |
string | Effective start date (Unix ms) |
article_dateFin |
string | Effective end date (Unix ms, 32472144000000 = indefinite) |
article_dateDebutExtension |
string | Extension start date (Unix ms) |
article_dateFinExtension |
string | Extension end date (Unix ms) |
article_etat |
string | Status: VIGUEUR (in force), ABROGE (repealed), etc. |
article_type_article |
string | Article type |
article_nature |
string | Legal nature |
article_origine |
string | Origin (e.g. LEGI) |
article_version_article |
string | Version identifier |
article_versionPrecedente |
string | Previous version ID |
article_multipleVersions |
bool | Has multiple versions |
Hierarchy
| Column | Type | Description |
|---|---|---|
article_sectionParentId |
string | Parent section ID |
article_sectionParentCid |
string | Parent section consolidated ID |
article_sectionParentTitre |
string | Parent section title |
article_fullSectionsTitre |
string | Full hierarchy path |
article_ordre |
int32 | Sort order within the code |
article_partie |
string | Partie (e.g. "Partie legislative") |
article_livre |
string | Livre |
article_titre |
string | Titre |
article_chapitre |
string | Chapitre |
article_section |
string | Section |
article_sous_section |
string | Sous-section |
article_paragraphe |
string | Paragraphe |
Extras
| Column | Type | Description |
|---|---|---|
article_infosComplementaires |
string | Additional info (plain text) |
article_infosComplementairesHtml |
string | Additional info (HTML) |
article_conditionDiffere |
string | Deferred condition |
article_infosRestructurationBranche |
string | Branch restructuring info |
article_infosRestructurationBrancheHtml |
string | Branch restructuring (HTML) |
article_renvoi |
string | Cross-references |
article_comporteLiensSP |
bool | Contains SP links |
article_idTechInjection |
string | Technical injection ID |
article_refInjection |
string | Injection reference |
article_numeroBo |
string | BO number |
article_inap |
string | INAP code |
Usage
from datasets import load_dataset
from datetime import datetime, timezone
ds = load_dataset("ArthurSrz/open_codes", split="train")
# Access a chunk with its embedding and article metadata
row = ds[0]
print(row["code_name"]) # e.g. "Code civil"
print(row["chunk_text"][:200])
print(len(row["embedding"])) # 1024
# Convert dates from Unix ms to datetime
date_debut = datetime.fromtimestamp(int(row["article_dateDebut"]) / 1000, tz=timezone.utc)
print(date_debut) # e.g. 2011-03-31 00:00:00+00:00
# Filter by legal code
code_civil = ds.filter(lambda x: x["code_name"] == "Code civil")
# Filter active articles only
en_vigueur = ds.filter(lambda x: x["article_etat"] == "VIGUEUR")
# Use embeddings for semantic search
import numpy as np
query_emb = np.array(ds[0]["embedding"])
Provenance
Built by the marIAnne project. Sync pipeline fetches articles nightly from PISTE Legifrance, chunks them, and generates embeddings via Mistral AI.