ra-law-db
Public dataset workspace and installable runtime library for Japanese chemical law screening.
ra-law-db is now the canonical non-MCP API for direct law-screening consumers.
ra-law-mcp is a thin wrapper over this package.
Direct package usage
Most consumers should install the package and use the bundled SQLite database directly:
pip install ra-law-db
uv add ra-law-db
from ra_law_db import get_law_screening_database
db = get_law_screening_database()
lookup_result = db.lookup(cas_number="75-09-2", language="ja")
search_result = db.search(query="ジクロロメタン", mode="auto", limit=10, min_score=0.6)
Public runtime API:
get_law_screening_database(law_db_path: str | None = None)LawScreeningDatabase.lookup(cas_number=None, substance_name=None, language="ja")LawScreeningDatabase.search(query, mode="auto", law_id=None, limit=20, min_score=0.6)
Default behavior:
- If
law_db_pathis omitted,ra-law-dbuses the packaged bundled SQLite database. law_db_pathmay optionally point to:- a direct SQLite file
- a checked-out
ra-law-dbdirectory containingregulatory.sqlite3and compatibility artifacts
Runtime artifact
The canonical runtime artifact is the bundled SQLite database:
- packaged path:
src/ra_law_db/data/regulatory.sqlite3 - published repo artifact:
regulatory.sqlite3
Normal installed consumers should rely on the packaged bundled database. CSV/JSONL files remain published for compatibility, inspection, and debugging, but they are not required for normal runtime use.
At runtime, the bundled database is resolved safely via importlib.resources and opened through a real filesystem path using importlib.resources.as_file(...).
MCP usage
ra-law-mcp consumes this package directly. In the normal case it does not need a separate ra-law-db checkout.
RA_LAW_DB_PATH is still supported as an override when you want to point the MCP server at:
- a custom SQLite bundle
- a local development checkout of
ra-law-db
Directory layout
regulatory.sqlite3: published SQLite bundlesrc/ra_law_db/data/regulatory.sqlite3: packaged SQLite bundle used by installsparsed/: normalized parsed entries and source snapshot manifestssource_snapshots.jsonllaw_entries.jsonl
mappings/: CAS mapping outputs and unresolved entriescas_mappings.jsonlunresolved_entries.jsonl
exports/: compatibility export filesregulatory_substances.csv
masters/: public-safe law master datasets and alias rows
Generation and releases
This repository is published by the private ra-law-scraper pipeline. The public repo contains the generated dataset and compatibility exports, not the private scraping workflow itself.
Release model:
- the package version moves with the bundled SQLite database
- a new bundled DB refresh should be released as a new
ra-law-dbpackage version - direct consumers receive data updates by upgrading
ra-law-db
Development
uv sync --group dev
uv run pre-commit install
uv run pre-commit run --all-files
uv run pytest -q
Release
PyPI publishing is handled by GitHub Actions only when a matching v* tag is
pushed. See docs/release.md for the cleanup and release
checklist.
Notes
- SQLite is the canonical runtime format for downstream consumers.
- Alias data is published in
masters/substance_aliases.csvand bundled intoregulatory.sqlite3. - Unresolved law entries are tracked in
mappings/unresolved_entries.jsonlfor manual review. ra-law-dbremains law-source-driven. It is not replaced by CREATE-SIMPLE workbook data whenra-library/ra-mcpadopt a newer CREATE-SIMPLE methodology version.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ra_law_db-0.2.1.tar.gz.
File metadata
- Download URL: ra_law_db-0.2.1.tar.gz
- Upload date:
- Size: 580.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de74268d3d8b79a574fd359f8ce63140a1d45ad2fc0eef69467ae5dcf97f48d4
|
|
| MD5 |
8ed784a020af905f663036673d6a860b
|
|
| BLAKE2b-256 |
ead2523c3248a6466ca9dae17e5e2725e99d89223f0cf8b6e8baebb1851ba36f
|
Provenance
The following attestation bundles were made for ra_law_db-0.2.1.tar.gz:
Publisher:
publish.yml on Ameyanagi/ra-law-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ra_law_db-0.2.1.tar.gz -
Subject digest:
de74268d3d8b79a574fd359f8ce63140a1d45ad2fc0eef69467ae5dcf97f48d4 - Sigstore transparency entry: 2226253365
- Sigstore integration time:
-
Permalink:
Ameyanagi/ra-law-db@ed664e5608e03e5ba3549379b639bce968cf05a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Ameyanagi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed664e5608e03e5ba3549379b639bce968cf05a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ra_law_db-0.2.1-py3-none-any.whl.
File metadata
- Download URL: ra_law_db-0.2.1-py3-none-any.whl
- Upload date:
- Size: 602.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
419d77e0497a62c4299af087c0a87bc0c284e59985c975b7f397940100c6b939
|
|
| MD5 |
bab24ef4800c53f04ad5e6fb7d5f9dbe
|
|
| BLAKE2b-256 |
2f650ee7e4c5f1ae1c007097c791d1803b7914907f1e6d6985a11fdf14ec05fb
|
Provenance
The following attestation bundles were made for ra_law_db-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on Ameyanagi/ra-law-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ra_law_db-0.2.1-py3-none-any.whl -
Subject digest:
419d77e0497a62c4299af087c0a87bc0c284e59985c975b7f397940100c6b939 - Sigstore transparency entry: 2226253481
- Sigstore integration time:
-
Permalink:
Ameyanagi/ra-law-db@ed664e5608e03e5ba3549379b639bce968cf05a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Ameyanagi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed664e5608e03e5ba3549379b639bce968cf05a0 -
Trigger Event:
push
-
Statement type: