materia is a cited clinical decision-support engine for naturopathic and integrative practitioners. Blood tests in; cited patterns, supplement/herb options, safety screens and a grounded conversation out.
It is not a replacement for a licensed practitioner. It does not issue a final diagnosis or a prescription. Every option is a suggestion for a practitioner to accept, modify or reject.
Core recommendations come from deterministic rules and need no model. MiniCPM5-2B is an optional chat layer that explains the assessment. The chat contract tests below are not clinical validation.

What Works Now
- Reads lab PDFs from the text layer first, with OCR only for pages without text; extracted rows pass a plausibility gate and require human confirmation.
- Matches cited patterns such as iron, B12 and folate deficiency, vitamin D insufficiency, liver enzyme elevation, elevated triglycerides, thyroid dysfunction, dysglycaemia and high homocysteine — more than twenty in total.
- Returns ranked options with a dose range, source chunk, monitoring and safety flags — oral iron, B12, vitamin D3, magnesium, omega-3 and more. Lifestyle and referral steps are dose-less and ranked explicitly.
- Withholds options when a context veto or a citation/dose check fails, and shows them as withheld.
- Flags medication context: PPIs with iron/B12/magnesium, thiazides with vitamin D, antiplatelets and anticoagulants with fish oil — each flag carries its source.
- Critical-value gate: extreme potassium, glucose, sodium, calcium, haemoglobin, platelets, INR and similar values withhold all supplement/herb options and keep referral/lifestyle steps visible.
- Records practitioner decisions (accept / modify / reject) to a local JSONL file as labels for calibrating the ranking, each tied to the rule version that produced it.
Where MiniCPM5-2B Fits
The recommendation engine is deterministic. With no model configured, a deterministic responder answers questions straight from the assessment.
For a conversational layer, serve MiniCPM5-2B on CPU with llama.cpp. The model only explains the assessment it is given and receives a bounded conversation history for follow-ups. Any answer that introduces a dose or citation outside the assessment is rejected.
./llama-server \
-m ~/models/minicpm5/MiniCPM5-2B-Q4_K_M.gguf \
-c 4096 -np 2 -t 4 --jinja --no-reasoning-preserve --port 8099
export MATERIA_CHAT_BASE_URL="http://127.0.0.1:8099/v1"
export MATERIA_CHAT_MODEL="minicpm5-2b-q4"
No GPU, no vLLM, no closed API. Q4 (1.5 GB) is the low-RAM baseline; Q8 (2.7 GB) is the higher-quality CPU baseline.
Quick Start
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m materia.cli doctor
.venv/bin/python -m materia.cli serve --port 8765 --open
The default sample is a synthetic nutrient/lipid panel and works with no model. From the CLI:
# blood test rows -> cited assessment
.venv/bin/python -m materia.cli recommend case.json
# ask about that assessment
.venv/bin/python -m materia.cli chat case.json "What dose of iron, and what should I recheck?"
Evidence and Safety
- Sources include regulatory monographs (Health Canada NNHPD, EMA), CC-BY primary literature, public-domain compendia (MedlinePlus, NCCIH, NCI) and traditional-use claims, each shown with its tier. The corpus has 401 documents and 5,207 chunks.
- A dose must be a substring of the cited chunk. A rule whose citation does not resolve is withheld.
- Context vetoes (iron in haemochromatosis, vitamin D in hypercalcaemia, fish oil in fish allergy) run before ranking; flags for pregnancy, kidney disease and anticoagulants stay visible.
- Patterns are labelled
possibleorlikely, never a confirmed diagnosis.
Tests
- 164 tests.
- CPU chat contract tests: 29/29 single-turn and 17/17 multi-turn pass, with non-compliant model answers rejected. These check the citation contract, not prose quality.
- 73 self-authored synthetic vignettes pass on pattern match, top option, withheld options, safety flags and citation integrity. The author notes this is a contract set, not clinical validation.
Links
- GitHub: RegeneratusLabs/materia
