Personal health data archive: consolidate medical records from multiple EHR systems into a single queryable SQLite database
Project description
health-memex
Personal health data archive: consolidate medical records from multiple EHR systems into a single queryable SQLite database. Part of the *-memex ecosystem.
Query, analyze, and export your aggregated clinical data via CLI, MCP server (for LLM-assisted analysis), or self-contained HTML SPA.
Features
- Multi-EHR data consolidation: Import from Epic MyChart, MEDITECH Expanse, and athenahealth
- SQLite database: 17 clinical tables with full audit trail
- MCP server: 31 tools for LLM-assisted analysis with Claude
- Export formats: Self-contained HTML SPA, Arkiv (JSONL + README.md + schema.yaml)
- AI chat: Ask questions about your record in the HTML SPA via Claude, with inline charts (optional, requires proxy)
- Visit prep: See what's new since your last visit, directly in the SPA
- Print summary: One-page printable view for your doctor
- Personal notes: Tag and annotate any clinical record
Installation
pip install health-memex
# With MCP server support (for Claude integration)
pip install "health-memex[mcp]"
Development Setup
git clone https://github.com/queelius/health-memex.git
cd health-memex
pip install -e ".[dev,mcp]"
Quick Start
Load Data from EHR Exports
# Load from individual sources
health-memex load epic ~/exports/epic/
health-memex load meditech ~/exports/meditech/
health-memex load athena ~/exports/athena/
# Or load all at once
health-memex load all \
--epic-dir ~/exports/epic/ \
--meditech-dir ~/exports/meditech/ \
--athena-dir ~/exports/athena/
Query and Inspect
# View database summary
health-memex summary
# Run SQL queries
health-memex query "SELECT test_name, value, result_date FROM lab_results ORDER BY result_date DESC LIMIT 10"
# What's new since your last visit
health-memex diff 2025-01-01
Export Your Data
# Self-contained HTML SPA with embedded SQLite (all data stays client-side)
health-memex export html --output summary.html
health-memex export html --output summary.html --embed-images --config health_memex.toml
health-memex export html --output summary.html --ai-chat --proxy-url https://proxy.example.com/v1/messages
# Arkiv universal record format (primary backup/restore, round-trip capable)
health-memex export arkiv --output ./arkiv/
health-memex export arkiv --output ./arkiv/ --embed
# Import from arkiv archive
health-memex import ./arkiv/ --db new.db
health-memex import ./arkiv/ --validate-only
MCP Server
# Start MCP server (matches ecosystem pattern: memex mcp, btk mcp)
health-memex mcp --db health_memex.db
Claude Code Configuration
{
"mcpServers": {
"health-memex": {
"command": "python",
"args": ["-m", "health_memex", "mcp", "--db", "/path/to/health_memex.db"]
}
}
}
Personal Notes
health-memex notes list --limit 20
health-memex notes search --tag oncology --query "CEA"
Supported EHR Sources
| Source | Format | Description |
|---|---|---|
| Epic MyChart | CDA R2 XML | IHE XDM exports from Epic MyChart |
| Epic MyChart (MHTML) | MHTML | Visit notes and genomic test results (e.g., Tempus XF) |
| MEDITECH Expanse | CCDA XML + FHIR JSON | Dual-format bulk exports (merged and deduplicated) |
| athenahealth | FHIR R4 XML | Ambulatory summary exports |
Database Schema
17 clinical tables, all dates ISO YYYY-MM-DD, every record carries a source field:
| Category | Tables |
|---|---|
| Core | patients, documents, encounters |
| Labs & Vitals | lab_results, vitals |
| Medications | medications, allergies |
| Conditions | conditions |
| Procedures | procedures, pathology_reports, imaging_reports |
| Genomics | genetic_variants |
| Notes | clinical_notes |
| History | immunizations, social_history, family_history, mental_status |
| System | load_log, notes/note_tags, analyses/analysis_tags, source_assets |
Configuration
health-memex init-config
Generates health_memex.toml with lab tests to chart based on what's in your database.
Requirements
- Python 3.11+
- Dependencies:
lxml,pyyaml - Optional:
mcp(FastMCP) for MCP server
License
MIT
Project details
Release history Release notifications | RSS feed
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 health_memex-2.1.0.tar.gz.
File metadata
- Download URL: health_memex-2.1.0.tar.gz
- Upload date:
- Size: 910.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6174c6a7b79982bfc08e122ee82677ab75e1462fb1c475db3643faf004db8803
|
|
| MD5 |
05531bfebc7adff1d421768c65f8823b
|
|
| BLAKE2b-256 |
440eeb4523eb77817c4c36f5f561bf8c4599499e35bd65080aa7c086da82ab5d
|
File details
Details for the file health_memex-2.1.0-py3-none-any.whl.
File metadata
- Download URL: health_memex-2.1.0-py3-none-any.whl
- Upload date:
- Size: 523.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f62986d0683b8e02df56bbf3bd0de798f17a4578ce769a6b2a5d431da06e300
|
|
| MD5 |
54178d5ae62847fe4600abe65c1d7496
|
|
| BLAKE2b-256 |
fdbbdce92b716054b727bcb8d04574a824073db1edef69de827d8479976041e9
|