Python library for determining whether a chemical is on Japan's published risk-assessment obligation lists and for surfacing GHS-based hazard notices.
- downloads the requested JOHAS, MHLW, and NITE reference files into
reference/ - converts the published MHLW obligation lists and NITE GHS classifications into a bundled SQLite database
- exposes exact lookup, synonym-aware fuzzy candidate search, and mixture evaluation APIs
https://cheminfo.johas.go.jp/step/list.htmlhttps://www.mhlw.go.jp/content/11300000/001168179.xlsxhttps://www.mhlw.go.jp/content/11300000/001474394.xlsxhttps://www.chem-info.nite.go.jp/chem/ghs/files/list_nite_all.xlsx
If you want to use the library directly from GitHub in another project:
uv add git+https://github.com/Ameyanagi/risk_assessment_list.gitThen import it normally:
from risk_assessment_list import evaluate_substance
result = evaluate_substance("50-00-0")
print(result.legal_ra_required)
print(result.nite_chrip_url)uv sync --extra build --extra test
uv run python scripts/fetch_reference.py
uv run python scripts/build_db.pyfetch_reference.py is offline-first by default. If the files already exist in
reference/ and their sha256 values match reference/manifest.json, the
script uses them as cache hits and skips the network.
uv run python scripts/fetch_reference.py
uv run python scripts/fetch_reference.py --refresh
uv run python scripts/fetch_reference.py --refresh-key nite_list_nite_allscripts/build_db.py now builds the packaged database in stages:
- stage raw MHLW and NITE workbook rows with file, sheet, and row provenance
- normalize them into canonical substance, legal obligation, GHS classification, pictogram, and alias tables
- validate row counts and URL cleanup rules
- publish the SQLite snapshot atomically into
src/risk_assessment_list/data/
The packaged SQLite snapshot is query-oriented rather than blob-oriented. GHS
classifications and fuzzy-search aliases are stored in normalized tables, and
an FTS5 index is built over aliases for runtime discovery.
The build also exports reference/generated_synonyms.sqlite3, a sidecar
database containing synonym groups, identifiers, and aliases for the hazardous
substances covered by the generated data set.
Internally, the repo is split into two private implementation areas:
risk_assessment_list._runtimefor lookup/search/evaluation logicrisk_assessment_list._buildfor fetch/build/export orchestration
The checked-in scripts/*.py commands are thin wrappers over those internal
modules, so the user-facing workflow stays the same while the package internals
remain importable and testable.
from risk_assessment_list import MixtureComponent
from risk_assessment_list import evaluate_mixture
from risk_assessment_list import evaluate_substance
from risk_assessment_list import search_substances
candidates = search_substances("ホルムアルデヒド")
fuzzy_candidates = search_substances("maleik acid", mode="fuzzy")
result = evaluate_substance("50-00-0")
print(result.legal_ra_required)
print(result.ghs_notice_required)
print(result.ghs_pictograms)
print(result.nite_chrip_url)
print(result.nite_chrip_urls)
print(result.model_sds_url)
mixture = evaluate_mixture(
[
MixtureComponent(identifier="50-00-0", weight_percent=0.2),
MixtureComponent(identifier="7732-18-5", weight_percent=99.8),
]
)
print(mixture.legal_ra_required)legal_ra_requiredfollows the published union of the downloaded MHLW lists.ghs_notice_requiredis broader and fires whenever matched NITE data contains an assigned GHS classification, including environmental classes.nite_chrip_urlis the first matched JOHASNITE-CHRIPdetail link returned with the legal/regulatory matches.nite_chrip_urlscontains all matched CHRIP detail links for the result. Some regulatory rows map to multiple CHRIP pages because JOHAS splits one legal row into multiple CAS-specific detail pages.model_label_urlandmodel_sds_urlcome from the NITE GHS workbook and point to the MHLWanzeninfomodel label/SDS pages. They are separate from the JOHASNITE-CHRIPlink.search_substances(..., mode="balanced")is the default. It prefers exact aliases and strong prefix matches, and returns[]for obvious garbage input.search_substances(..., mode="fuzzy")is the broad finder mode. It keeps typo tolerance and can return wider near matches and derivatives.- search returns scored candidates only; it does not perform the legal decision on its own.
- fuzzy search expands explicit aliases and conservative synonyms such as
parenthetical aliases, Greek-letter variants, English/Japanese name pairs,
and a small curated abbreviation set like
PCB,DDT,TCE, andPCE.