pemr
A local-first, family-scale medical record framework that provides a Python CLI engine and MCP server for ingesting, deduplicating, querying, and generating medical records from source documents.
README
pemr
Personal EMR — a local-first, family-scale medical record framework. Source documents (scanned labs, visit notes, etc.) are retained as-is; a SQLite database is the source of truth for structured data. Deterministic work — ingest, deduplication, query, analysis, and brief-generation — lives in a Python CLI engine wrapped by a thin MCP server, so AI agents call typed tools instead of re-inventing the logic on every request.
⚠️ This repository is framework + documentation only. No personal or medical data lives here. The live database, source scans, generated exports, and backups all reside outside the repo in a local data directory.
.gitignorehard-blocks databases, documents, and thedata/ inbox/ sources/ exports/ backups/dirs as a backstop.
What it does
- Ingest without duplication — content-hash on source files (catches re-scans) plus semantic dedup keys on extracted rows (same clinical fact from two documents → one row).
- Query fast — canned + ad-hoc reads over a typed schema (labs, meds, procedures,
appointments) with a generic
observationscatch-all for the long tail. - Generate on demand — master health summary, per-appointment "walk-in readiness" briefs, and a chronological journal, all rendered from the DB so they never drift.
- Extend to the whole family — one DB,
person_idon every row; adding a member is one command, not a fork of the tooling.
Full design — schema, dedup algorithm, ingest pipeline, tool surface, backup — in docs/Architecture.md.
Design decisions
| Area | Choice |
|---|---|
| Structured store | SQLite (source of truth); source scans retained on disk |
| Schema | Hybrid — typed tables + generic observations |
| Multi-person | Single DB, person_id everywhere |
| Generated docs | Rendered views from the DB (disposable) |
| Ingestion | Agent does vision→structure; tools validate + dedup + commit |
| Interface | Python CLI engine + thin MCP wrapper |
| Dedup | Content-hash (documents) + semantic keys (rows) |
| Backup | VACUUM INTO snapshot → cloud-synced folder; live DB stays local |
Status
Pre-implementation. Design is locked; build proceeds in phases (skeleton → ingest/dedup → query → render → MCP → backup → care-gap rules) per the Architecture doc.
Data / privacy posture
Local-first. The live pemr.db sits on a non-synced local path (WAL sidecars corrupt
under cloud sync); only clean VACUUM INTO snapshots sync to Drive/OneDrive. Private-ish,
not encrypted-at-rest by default — an encrypted-snapshot upgrade is a drop-in later. No
HIPAA/PHI compliance layer and no provider interoperability; this is a personal archive, and
it assists appointment prep and research — it does not give clinical advice.
Framework scaffolding (from the template)
This repo was generated from
meridun/model-repo and carries its
documentation-tier system, token-optimizer hooks, role-based model routing, and the agentic
SDLC pipeline. See docs/Documentation.md and
docs/Development_AgenticSDLC.md. The proj- skill/agent
prefix is still the template default and will be renamed to pemr- as the app takes shape.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.