Skip to content

Repository files navigation

biohackbot

Personal medical corpus pipeline: install → add PDFs → parse → enrich.

English · Русский · 中文

License: MIT Python 3.11+

Not medical advice. Organizes your documents locally. Does not diagnose or prescribe.

Scope and limitations

  • Package: install as medbots-core from this repo; CLI command is medbots.
  • PDF parsers: built for Russian lab layouts — EMIAS, Medsi, Gemotest. Other vendors need a new parser (docs/ARCHITECTURE.md).
  • No OCR: scanned PDFs without a text layer are not parsed unless you add external OCR or optional private LLM ingest.
  • OpenClaw / Telegram Q&A: optional VPS deploy (deploy/RUNBOOK.md); not required for local corpus use.
  • Try without your PDFs: examples/demo-instance (synthetic pdf_text only).

1. Install

git clone https://github.com/apodobe/biohackbot.git
cd biohackbot
python3 -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e .
medbots --help

2. Configure (first run)

Create a private folder for your data (outside this public repo):

medbots init ~/my-health

This creates:

~/my-health/
├── bot_config.json
├── sources/emias/      ← drop PDFs here
├── sources/medsi/
├── sources/gemotest/
├── sources/apple_health/   ← optional: archived export.zip
└── structured_database/
    ├── manifest.json
    ├── PATIENT_PROFILE.json   ← set your DOB
    ├── pdf_text/
    ├── doc_text/
    └── fitness/               ← Apple Health import

Edit PATIENT_PROFILE.json:

{"dob": "1985-06-15", "full_name_ru": "John Smith", "country": "USA"}

3. Add documents

Copy lab PDFs from EMIAS, Medsi, or Gemotest into the matching sources/ subfolder.

Register them in the manifest:

medbots scan --bot-root ~/my-health
# optional: --source emias --source medsi

4. Parse PDFs

Two steps: extract raw text, then parse into structured doc_text/ and lab rows.

medbots extract-text --bot-root ~/my-health
medbots structure --bot-root ~/my-health
# re-parse everything: add --force
# one vendor only: --source emias

Supported vendors: EMIAS, Medsi, Gemotest (Russian lab layouts).

Apple Health (optional)

Export from iPhone: Health app → profile → Export All Health Data → export.zip

medbots import-apple-health --zip ~/Downloads/export.zip --bot-root ~/my-health --copy-zip
medbots validate-apple-health --corpus ~/my-health/structured_database

Writes structured_database/fitness/BODY_METRICS.json, WORKOUTS.json, APPLE_HEALTH_SUMMARY.md. Raw export.xml is not stored — only aggregated JSON.

5. Enrich corpus

Normalize labs, apply LOINC map, deduplicate, build indexes:

medbots pipeline --bot-root ~/my-health
medbots validate --corpus ~/my-health/structured_database

Output includes LABS_NORMALIZED.json, DISCREPANCIES.json, CORPUS_INDEX.json, and markdown summaries in structured_database/.

6. Optional: VPS (text only)

Sync text + JSON to a server for a private Q&A bot (no PDF binaries):

export VPS=root@YOUR_HOST
export CORPUS=~/my-health/structured_database
cd deploy && ./02-rsync-corpus.sh

Details: deploy/RUNBOOK.md


CLI reference

Command Purpose
medbots init PATH Scaffold instance directory
medbots scan --bot-root PATH Add new PDFs from sources/ to manifest
medbots extract-text --bot-root PATH PDF → pdf_text/*.txt
medbots import-apple-health --zip FILE --bot-root PATH Apple Health → fitness/
medbots structure --bot-root PATH Parse text → doc_text/, lab rows
medbots pipeline --bot-root PATH Merge labs, LOINC, dedup, index
medbots validate --corpus PATH Integrity check
medbots validate-apple-health --corpus PATH Apple Health fitness check

Try the demo (no PDFs)

medbots structure --bot-root examples/demo-instance
medbots pipeline --bot-root examples/demo-instance

See examples/README.md.

Data privacy

  • Keep ~/my-health/ local or in a private git repo.
  • Never commit patient data to this public repository.
  • See SECURITY.md.

Docs

Author: Alexey Podobedov

About

Open-source personal health corpus pipeline: parse Russian lab PDFs (EMIAS, Medsi, Gemotest), Apple Health import, normalized JSON for local or VPS Q&A bots. CLI: medbots.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages