ArthurSrz/open_codes
Open Codes Open dataset of French legal code articles with embeddings. Chunked articles from 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. Legal codes included The list of legal codes is dynamic and managed in the LEX_codes_piste table. Adding a new code there (with actif=true) automatically… See the full description on the dataset page: https://huggingface.co/datasets/ArthurSrz/open_codes.
Open Codes
Open dataset of French legal code articles with embeddings.
Chunked articles from 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 07:00 UTC)
- Codes: Dynamically sourced from
LEX_codes_piste(active codes only) - Quality: Dedup + stale-chunk filtering applied before every push
Legal codes included
The list of legal codes is dynamic and managed in the LEX_codes_piste table. Adding a new code there (with actif=true) automatically includes it in the next sync and export.
Schema
Chunk fields
Article metadata fields (prefixed article_)
Identifiers
Content
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:00Special value: 32472144000000 (year 2999) means "no end date" — the article is in force indefinitely.
Hierarchy
Extras
Configs
Usage
from datasets import load_dataset
from datetime import datetime, timezone
# Load default config (code articles)
ds = load_dataset("ArthurSrz/open_codes", split="train")
# Load jurisprudence config (court decisions)
juris = load_dataset("ArthurSrz/open_codes", "jurisprudence", 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.
