Skip to main content

oldp-ingestor

Ingesting legal data like laws and court decisions via OLDP API.

Data sources:

CLI provider Type Source
ris laws + cases Rechtsinformationssystem des Bundes (RIS)
gii laws Gesetze im Internet (gesetze-im-internet.de)
rii cases Rechtsprechung im Internet (RII) — federal courts
by cases Gesetze Bayern — Bavarian courts
nrw cases NRWE Rechtsprechungsdatenbank — NRW courts
ns cases NI-VORIS Niedersachsen
eu cases EUR-Lex — EU court decisions
juris-bb cases Landesrecht Berlin-Brandenburg
juris-bw cases Landesrecht Baden-Württemberg
juris-he cases Landesrecht Hessen
juris-hh cases Landesrecht Hamburg
juris-mv cases Landesrecht Mecklenburg-Vorpommern
juris-rlp cases Landesrecht Rheinland-Pfalz
juris-sa cases Landesrecht Sachsen-Anhalt
juris-sh cases Landesrecht Schleswig-Holstein
juris-sl cases Landesrecht Saarland
juris-th cases Landesrecht Thüringen
dummy laws + cases Django fixture JSON files (for testing)

Installation

pip install oldp-ingestor

Some providers require Playwright browsers. Install them after pip:

playwright install chromium

For development, clone the repo and use Make (auto-detects uv or falls back to pip):

git clone https://github.com/openlegaldata/oldp-ingestor.git
cd oldp-ingestor
make install

Configuration

Set the following environment variables (or add them to a .env file):

Variable Description
OLDP_API_URL Base URL of the OLDP instance (e.g. http://localhost:8000)
OLDP_API_TOKEN API authentication token
OLDP_API_HTTP_AUTH Optional HTTP basic auth in user:password format

Usage

Show API info

oldp-ingestor info

Ingest laws

From the RIS API (rechtsinformationen.bund.de)

# Ingest all available legislation
oldp-ingestor laws --provider ris

# Search for specific legislation
oldp-ingestor laws --provider ris --search-term "EinbTestV"

# Limit the number of law books to ingest
oldp-ingestor laws --provider ris --limit 5

# Combine search and limit
oldp-ingestor laws --provider ris --search-term "BGB" --limit 1

Incremental fetching and request pacing

# Only fetch legislation adopted since a given date
oldp-ingestor laws --provider ris --date-from 2025-12-01

# Fetch legislation within a date range
oldp-ingestor laws --provider ris --date-from 2025-01-01 --date-to 2025-06-30

# Override the default request delay (0.2s) for slower pacing
oldp-ingestor laws --provider ris --request-delay 0.5

From gesetze-im-internet.de (gii)

Pulls all German federal laws from the official BMJ/juris feed. See docs/providers/de/gii.md for usage, incremental-run setup, and continuous-ingestion examples.

From a JSON fixture file (dummy provider)

oldp-ingestor laws --provider dummy --path /path/to/fixture.json

Ingest cases

From the RIS API (rechtsinformationen.bund.de)

# Ingest all cases from all federal courts
oldp-ingestor cases --provider ris

# Filter by court and date range
oldp-ingestor cases --provider ris --court BGH --date-from 2026-01-01

# Limit for testing
oldp-ingestor cases --provider ris --limit 10 -v

From a JSON fixture file (dummy provider)

oldp-ingestor cases --provider dummy --path /path/to/fixture.json

# Limit the number of cases to ingest
oldp-ingestor cases --provider dummy --path /path/to/fixture.json --limit 10

The fixture file should contain Django fixture entries with courts.court and cases.case models. Court foreign keys are resolved to court_name strings for the OLDP cases API.

Targeted citation-based lookup

When OLDP can't resolve an extracted citation, an AI agent can use the lookup subcommand group to fetch the specific decision from the right upstream portal. Each call is a single upstream request returning JSON with a three-status contract (ok / not_found / error).

# What lookup-capable providers exist + which courts they cover?
oldp-ingestor lookup providers

# Search RIS by ECLI
oldp-ingestor lookup search --provider ris \
    --ecli "ECLI:DE:BGH:2026:020626BVIAZR482.23.0"

# Search a juris state portal by Aktenzeichen
oldp-ingestor lookup search --provider juris-rlp --file-number "5 T 16/26"

# Fetch the full case (no OLDP write)
oldp-ingestor lookup fetch --provider ris --doc-id KORE615402026

# Fetch + POST to OLDP (idempotent: 409 → already_exists)
oldp-ingestor lookup ingest --provider ris --doc-id KORE615402026

See docs/lookup.md for the full agent loop, JSON schema, and per-provider capability matrix.

Output sinks

By default, data is written to the OLDP REST API. Use --sink json-file to write JSON files to disk instead:

# Export laws to local files
oldp-ingestor --sink json-file --output-dir /tmp/export \
    laws --provider ris --search-term BGB --limit 1

# Export cases to local files
oldp-ingestor --sink json-file --output-dir /tmp/export \
    cases --provider ris --court BGH --limit 5

See docs/sinks.md for details on directory structure and implementing custom sinks.

Architecture

The ingestor uses a provider-based architecture. Each data source implements a provider class (LawProvider or CaseProvider), and shared RIS HTTP logic (retry, pacing, User-Agent) lives in RISBaseClient. Output is routed through a sink (ApiSink or JSONFileSink).

Provider
├── LawProvider   →  DummyLawProvider, RISProvider
└── CaseProvider  →  DummyCaseProvider, RISCaseProvider,
                     RiiCaseProvider, ByCaseProvider,
                     NrwCaseProvider, NsCaseProvider,
                     EuCaseProvider, JurisCaseProvider (10 state variants)

Sink
├── ApiSink        →  OLDP REST API (default)
└── JSONFileSink   →  local JSON files

See docs/architecture.md for the full design.

Politeness and rate limiting

The RIS API allows 600 req/min. The ingestor stays under this with:

  • Request pacing — 0.2 s delay between requests (configurable)
  • Retry with backoff — exponential backoff on 429/503, respects Retry-After
  • Descriptive User-Agent — oldp-ingestor/0.1.0

See docs/politeness.md for details.

Further documentation

Provider docs

Detailed documentation about each provider can be found in docs/providers/.

Provider Doc
RIS (laws + cases) docs/providers/de/ris.md
GII (laws) docs/providers/de/gii.md
RII (federal courts) docs/providers/de/rii.md
Bayern docs/providers/de/by.md
NRW docs/providers/de/nrw.md
Niedersachsen docs/providers/de/ns.md
EUR-Lex (EU) docs/providers/de/eu.md
Bremen docs/providers/de/hb.md
Sachsen OVG docs/providers/de/sn_ovg.md
Sachsen ESAMOSplus docs/providers/de/sn.md
Sachsen VerfGH docs/providers/de/sn_verfgh.md
Juris (10 states) docs/providers/de/juris.md
Dummy (test/dev) docs/providers/dummy/dummy.md

Development

# Run tests
make test

# Run tests with coverage
make test-cov

# Lint
make lint

# Auto-format
make format

See CONTRIBUTING.md for the full development setup, how to add new providers, and pull request guidelines.

Metadata

Release files for oldp-ingestor 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oldp-ingestor 0.1.9
File Size Uploaded
oldp_ingestor-0.1.9.tar.gz 348.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oldp-ingestor 0.1.9
File Interpreter ABI Platform
oldp_ingestor-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 477.8 kB

Release files / oldp_ingestor-0.1.9.tar.gz

Download URL oldp_ingestor-0.1.9.tar.gz
Size 348.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9c31cfcd080760cd910a7a1c05099b3c9bb4e7bc0005deada7cb4b0001306baa
BLAKE2b-256 checksum
How to use checksums
afcd702af4dc5649b88848552edf770b209c46869a7d47a665d5916060818cec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / oldp_ingestor-0.1.9-py3-none-any.whl

Download URL oldp_ingestor-0.1.9-py3-none-any.whl
Size 129.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f73dd959a6566b4f7c69ba74b653a25f62f6af2290071568134dd39777e76a8a
BLAKE2b-256 checksum
How to use checksums
812e4fd9716be85f35297926012541235cf97acc8e8a3083d1819eaea35c1736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.11

2 release files

0.1.10

2 release files

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page