Skip to main content
Glama

PyPI 版本 星标 下载量

许可证 Python 版本 构建状态 AI 辅助开发 DOI

Substack Discord

智能体读取临床数据很容易——但正确写回数据才是难点,而通用智能体框架并不会校验这一点。HealthChain 为任何模型或智能体提供类型安全、经过验证的 FHIR 工具,让它们值得信赖:来自正确系统的正确代码,作用于正确的患者,并带有有效的状态。此外还提供实时 EHR 连接和生产部署能力——让你构建的东西在演示之外同样经得起考验。

安装

pip install healthchain

Related MCP server: FhirMCP

快速开始

# Scaffold a FHIR Gateway project
healthchain new my-app -t fhir-gateway
cd my-app

# Run locally
healthchain serve

编辑 app.py 以添加你的模型,并编辑 healthchain.yaml 以配置部署设置。

查看 CLI 参考 了解所有命令。

核心功能

为 AI 开发者和研究人员提供最快捷的医疗 AI 交付方式——开箱即用,随你扩展。

为什么选择 HealthChain?

每个严肃的医疗 AI 项目都在从零构建相同的集成基础设施。无论你部署的是逻辑回归、700 亿参数模型还是智能体工作流,训练模型与实时临床系统之间的壁垒都是一样的:真实的 FHIR API、经过验证的写入、多站点部署、可审计的治理。市面上没有现成的解决方案,而同时精通 AI 和医疗协议的工程师既稀缺又难以留住。

HealthChain 帮你处理这些复杂性,让你专注于真正重要的事情:模型和患者。

  • 为实时而优化 - 连接实时 FHIR API 和集成点,而不是过时的数据导出

  • 内置验证 - 类型安全的 FHIR 资源和验证报告,在数据发布前捕获错误数据——包括仅靠类型检查无法发现的规范无效临床编码

  • 不虚构事实 - 辅助工具绝不会添加你没有提供的临床声明:不自动生成时间戳,不猜测状态——进入记录的内容与你的模型产出的完全一致

  • 支持任何模型或智能体 - LLM、智能体或经典机器学习——都能输出经过验证的 FHIR

  • 与你现有的技术栈兼容 - 与 FastAPI、MCP 和 LangChain 集成

  • 生产级基础 - Docker 化部署、可配置的安全机制,以及为 NHS 和 HIPAA 环境设计的架构

🏆 认可与社区

特色与演讲:

🤝 合作与生产使用

正在为你的产品或组织探索 HealthChain?联系我们 讨论集成、试点或合作,或加入我们的 Discord 与社区交流。

使用示例

创建 Gateway [文档]

from healthchain.gateway import HealthChainAPI, FHIRGateway
from healthchain.fhir.r4b import Patient

# Create healthcare application
app = HealthChainAPI(title="Multi-EHR Patient Data")

# Connect to multiple FHIR sources
fhir = FHIRGateway()
fhir.add_source("epic", "fhir://fhir.epic.com/r4?client_id=epic_client_id")
fhir.add_source("cerner", "fhir://fhir.cerner.com/r4?client_id=cerner_client_id")

@fhir.aggregate(Patient)
def enrich_patient_data(id: str, source: str) -> Patient:
    """Get patient data from any connected EHR and add AI enhancements"""
    bundle = fhir.search(
        Patient,
        {"_id": id},
        source,
        add_provenance=True,
        provenance_tag="ai-enhanced",
    )
    return bundle

app.register_gateway(fhir)

# Available at: GET /fhir/transform/Patient/123?source=epic
# Available at: GET /fhir/transform/Patient/123?source=cerner

if __name__ == "__main__":
    app.run(port=8888)

为智能体提供 FHIR 工具 [文档]

from healthchain.tools import FHIRToolkit

# One toolkit: build, validate, read, and code FHIR — as typed agent tools
kit = FHIRToolkit(bundle="patient_bundle.json")

kit.as_mcp().run()          # serve to Claude or any MCP client
tools = kit.as_langchain()  # or drop into a LangChain agent

或者直接在终端中操作,无需编写代码:

healthchain mcp --bundle patient_bundle.json

使用 AI 助手进行构建

安装 HealthChain 插件,为 Claude Code 或 Codex 提供最新的 API、CLI 和配方:

# Claude Code
/plugin marketplace add healthchainai/HealthChain
/plugin install healthchain@healthchain

# Codex
codex plugin marketplace add healthchainai/HealthChain
codex plugin add healthchain@healthchain

或者让任何助手访问 llms.txt 获取当前 API 文档的索引。

🛣️ 我们的开发路线

  • 🔒 安全基础 — API 密钥认证、审计日志和 TLS,通过 healthchain.yaml 配置并由网关中间件强制执行

  • 📋 治理即配置 — 将临床安全、数据访问协议以及 NHS/HIPAA 部署的合规标准作为 healthchain.yaml 中的一等部署工件

  • 🔌 更深入的 EHR 连接 — 更多 FHIR 数据源、实时数据模式,以及来自试点部署的真实集成示例

  • 📊 可观测性 — 面向医疗系统的部署遥测和审计追踪

  • 🤖 临床 AI 智能体工具包 — 内置验证和术语的类型化 FHIR 工具,通过 MCP 和 LangChain 提供

🤝 贡献

HealthChain 由下一代医疗开发者构建并服务于他们——这些研究者将模型从回顾性数据带入实时系统,AI 开发者不想花几个月学习 FHIR 才能交付任何东西。最好的贡献来自那些遇到过真实问题并有具体见解的人。

开始参与:

🤗 致谢

本项目基于 fhir.resources 以及由 HL7 和 波士顿儿童医院 制定的 CDS Hooks 标准。

另请参阅 groundeval —— 面向医疗 AI 智能体的开源评估框架。


© 2024–2026 dotimplement ai。HealthChain 是由 dotimplement ai 维护的开源项目。

Available Tools

8 tools
build_resourceA

Build a FHIR resource from flat fields and validate it. Call this instead of writing FHIR JSON by hand — it does the nesting (CodeableConcepts, Dosage) and returns {ok, resource} or {ok: false, issues} to correct. Supported resource_type values: Condition, MedicationStatement, Observation, AllergyIntolerance, Patient. Use a code returned by lookup_code, never an invented one.

Inputs: resource_type (required), code, unit, onset, +12 more.

get_coded_entriesA

Read the coded identity of every resource of a type in the loaded bundle as flat records (code/display/system/status/authored_on/value/unit). Call this first for questions about conditions, medications, allergies, or observations — it resolves medicationReference to the actual Medication for you. Optionally filter by status (e.g. 'active').

Inputs: resource_type (required), status.

get_resourcesA

Get all resources of a type from the loaded bundle as full FHIR JSON. Call this when you need fields the flattened get_coded_entries view doesn't carry.

Inputs: resource_type (required).

list_codesA

List every code in the local terminology catalog, optionally filtered to one code system URI. Call this to browse what codes are available (e.g. to build a mention list); use lookup_code to search by name.

Inputs: system.

load_bundleA

Load a FHIR Bundle from a file path or JSON string and make it the working bundle for the read tools. Call this first when given bundle data. Invalid bundles return issues[] locating each problem (e.g. Bundle.entry[2].resource.subject).

Inputs: source (required).

lookup_codeA

Search the terminology catalog for codes matching free text (e.g. 'metoprolol 25', 'type 2 diabetes'). Call this whenever you need a code — use a returned candidate, never invent or recall one. Results are ranked tightest-match-first; optionally restrict to one code system URI.

Inputs: query (required), system.

resolve_referenceA

Resolve a FHIR reference (e.g. 'Patient/123', 'urn:uuid:...') to its target resource within the loaded bundle. For a contained reference ('#med1'), also pass parent_resource_id — the id of the resource the reference appears in.

Inputs: reference (required), parent_resource_id.

validate_resourceA

Validate a FHIR resource (JSON object) against the spec, including required value-set bindings. Call this after constructing or editing FHIR JSON yourself; read issues[] (severity/diagnostics/expression) and correct the resource. Never raises.

Inputs: resource (required), resource_type.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clear, distinct purpose: building, validating, loading, retrieving, resolving references, and terminology lookup. No two tools overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using lowercase and underscores, e.g., build_resource, load_bundle, get_resources, lookup_code. This makes the API predictable.

    Tool Count5/5

    With 8 tools, the set is well-scoped for a FHIR utility server, covering essential operations without being bloated or too sparse.

    Completeness4/5

    The set covers building, validating, loading, and reading FHIR resources, as well as reference resolution and terminology lookup. Minor gaps like missing update/delete tools or limited build resource types prevent a perfect score.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables LLM-based agents to interact with FHIR healthcare data through natural language prompts, providing full CRUD operations on FHIR resources, document processing, and semantic search capabilities.
      13
      102
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables LLMs to securely interact with FHIR healthcare servers and HL7 terminology services. Provides comprehensive healthcare data operations with built-in PHI protection, audit logging, and SMART on FHIR authentication.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Provides seamless integration with FHIR APIs, enabling AI/LLM tools to search, retrieve, and analyze clinical healthcare data with support for SMART-on-FHIR authentication and multiple transport protocols.
      7
      1,087 PyPI
      139
      Apache 2.0
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables LLM-based agents and MCP-compatible clients to query and manipulate FHIR resources through full CRUD tools, with document ingestion, semantic search, LOINC terminology lookup, and OAuth2-authenticated FHIR API integration.
      -