RA Library
Chemical risk assessment library built from publicly documented methodology references.
Overview
This library implements an independent risk assessment workflow with detailed explanations, recommendations, and optional bundled SQLite reference data.
Features
- Verbose Calculations: Every step is explained with references
- Verified Scenario Analysis: Recalculate bounded control ranges and explicit batches
- Auditable Recommendations: Preserve mixture, method version, risk domains, and baseline fingerprint
- Limitation Transparency: Explains when Level I is impossible
- Official Japanese Terminology: v3.2.1 workbook labels with sheet/cell and SHA-256 provenance
Installation
uv add ra-library
Or with pip: pip install ra-library.
Usage
from ra_library import AssessmentInput, Substance
from ra_library.calculators import calculate_inhalation_risk
# Create assessment input
input = AssessmentInput(
title="Toluene handling",
product_property=PropertyType.LIQUID,
amount_level=AmountLevel.MEDIUM,
ventilation=VentilationLevel.INDUSTRIAL,
)
# Calculate risk
result = calculate_inhalation_risk(input, substance)
print(f"Risk Level: {result.risk_level.name}")
print(f"RCR: {result.rcr:.4f}")
Verified control ranges are available from the service layer:
from ra_library.services import calculate_risk
result = calculate_risk(
substances=[{"cas_number": "108-88-3", "content_percent": 100}],
preset="lab_organic",
include_recommendations="verified",
recommendation_scope={
"ventilation": ["local_enclosed", "sealed"],
"hours": [4, 2, 1],
"max_combination_size": 2,
"max_scenarios": 30,
},
language="ja",
)
print(result.data["recommendation_analysis"])
Development
uv sync --group dev
uv run pre-commit install
uv run pre-commit run --all-files
uv run pytest -q
Release
A matching v* tag tests and publishes distributions to PyPI, then attaches
the same artifacts to a GitHub Release.
Notes
- The package includes extracted terminology and provenance, not the original XLSM workbook.
- This is an independent implementation and is not an official MHLW distribution.
- Public methodology documents may be cited for interoperability and validation, but official workbook assets are not redistributed here.
References
- Public CREATE-SIMPLE design and manual documents
- HSE COSHH Essentials
- ECETOC TRA
- Potts-Guy Equation for dermal absorption
Release files for ra-library 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ra_library-0.4.1.tar.gz | 994.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ra_library-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.7 MB
Release files / ra_library-0.4.1.tar.gz
| Download URL | ra_library-0.4.1.tar.gz |
|---|---|
| Size | 994.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e805f77ea4343a04df66051907e74ec73e8d83b08b01aae42323d4896fc42c6
|
|
BLAKE2b-256 checksum How to use checksums |
d1ba875befb43b1f510f5db80dae5e161870e1355e1ae04097f80c0d5fafb172
|
| 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 Aug 31, 2026.
Transparency logRelease files / ra_library-0.4.1-py3-none-any.whl
| Download URL | ra_library-0.4.1-py3-none-any.whl |
|---|---|
| Size | 753.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91a9f2c913f2a06d1228c34fdb85cb1a4c27726c4d19bc294b4d016be7835f83
|
|
BLAKE2b-256 checksum How to use checksums |
82012960ddbe1a51298b6bf5179b6813dfccb876b21fdf85da4aa87850a3b2a5
|
| 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 Aug 31, 2026.
Transparency log