/healthclaw-guardrails:healthex-exportfrom healthclaw-guardrails
Automates export of personal health records from a local HealthClaw FHIR store as a portable, de-identified FHIR R4 transaction bundle. Supports migration, archiving, and sharing with providers.
Ships in healthclaw-guardrails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
scripts/export_healthex.py automates the full pipeline from local HealthClaw
FHIR store → de-identified, Curatr-pre-tagged FHIR R4 transaction Bundle.
Replaces the manual Claude session pull for personal health data export.
# Basic export — all clinical resource types for a tenant
python scripts/export_healthex.py --tenant-id my-tenant
# Export + immediately import into a second tenant
python scripts/export_healthex.py \
--tenant-id my-tenant \
--import \
--import-tenant my-archive-tenant \
--step-up-secret $STEP_UP_SECRET
# Preview what would be exported (no file written)
python scripts/export_healthex.py --tenant-id my-tenant --dry-run
# Export specific resource types
python scripts/export_healthex.py \
--tenant-id my-tenant \
--types Condition Observation AllergyIntolerance Immunization MedicationRequest
Bundle written to exports/healthex-<YYYY-MM-DD>.json by default.
Override with --output /path/to/file.json.
Format: FHIR R4 transaction Bundle ("type": "transaction") with PUT entries,
ready for POST /Bundle/$ingest-context or direct use with import_healthex.py.
| Type | Notes |
|---|---|
| Patient | De-identified: name/address/telecom removed, EHR identifiers stripped |
| Condition | Full — diagnoses, clinical/verification status, onset/abatement |
| Observation | Full — labs, vitals, social history (smoking, BMI, etc.) |
| AllergyIntolerance | Full |
| Immunization | Full |
| MedicationRequest | Full |
| Procedure | Full |
| DiagnosticReport | Full |
| CarePlan | Full |
| Coverage | Full |
| Encounter | Full |
Pass --types <ResourceType> ... to limit to a subset.
Applied automatically (skip with --no-deidentify).
Removed from Patient:
name — full nameaddress — street, city, state, ziptelecom — phone, emailphoto — base64 imagescontact — emergency contactsPreserved:
birthDate — full date (patient-controlled export; use $deidentify for the
de-identification preview, which strips it — that endpoint is not a legal
Safe Harbor determination either)gendercommunication — language preferencesurn:healthclaw:patient/<uuid> identifier is injectedOther resource types are exported as-is — they contain clinical observations and codes, not patient demographics.
For the conservative de-identification preview (birthDate truncated to year), call
POST /r6/fhir/Patient/:id/$deidentifybefore export, or use thephi-redactionskill after import.
Applied automatically (skip with --no-pretag).
Scans the export bundle for known data quality patterns and injects FHIR extensions — without modifying stored resources. The tags exist only in the exported bundle and serve as hints for a subsequent Curatr evaluation.
| Tag code | Trigger | Action recommended |
|---|---|---|
smoking_contradiction | LOINC 72166-2 observations with conflicting SNOMED codes (e.g. "Never smoked" + "Ex-smoker" in same tenant) | Run curatr_apply_fix with patient attestation |
h_flag_titer | Observation with interpretation.code of H/HH/HU, or valueString starting with "H" | Clinical review; consider flagging for provider |
missing_result | Observation with no value[x] element | Verify whether result is pending, cancelled, or truly missing |
Pre-tags are FHIR extensions at:
https://healthclaw.example.org/fhir/StructureDefinition/curatr-pretag
Each extension carries a valueCodeableConcept with the tag code and display text.
# Find all observations with Curatr pre-tags
curl -s "http://localhost:5000/r6/fhir/Observation?_count=200" \
-H "X-Tenant-ID: my-archive-tenant" \
| python3 -c "
import json, sys
b = json.load(sys.stdin)
url = 'https://healthclaw.example.org/fhir/StructureDefinition/curatr-pretag'
for e in b.get('entry', []):
r = e['resource']
tags = [
ext['valueCodeableConcept']['coding'][0]['code']
for ext in r.get('extension', [])
if ext.get('url') == url
]
if tags:
print(r['id'][:40], tags)
"
The complete automated flow replaces the previous manual Claude session pull:
1. Patient data arrives via Fasten Connect webhook → ingested to tenant T
2. export_healthex.py --tenant-id T --import --import-tenant T-archive
├── Fetches all resources via REST API (paginated)
├── Strips EHR identifiers + PII (de-identification)
├── Pre-tags Curatr issue patterns
└── POSTs bundle to /Bundle/$ingest-context for tenant T-archive
3. AI agent (MCP) queries T-archive for Curatr evaluation
4. curatr_apply_fix applied for patient-approved corrections
5. AuditEvent trail shows full chain: ingest → redact → evaluate → fix
| Flag | Default | Description |
|---|---|---|
--tenant-id | desktop-demo | Source tenant to export from |
--base-url | http://localhost:5000/r6/fhir | HealthClaw FHIR base URL |
--types | Full clinical set | Space-separated list of FHIR resource types |
--output | exports/healthex-<date>.json | Output bundle file path |
--import | off | Run import_healthex.py after export |
--import-tenant | same as --tenant-id | Tenant to import the bundle into |
--step-up-secret | $STEP_UP_SECRET env | HMAC secret (required with --import) |
--no-deidentify | off | Skip de-identification |
--no-pretag | off | Skip Curatr pre-tagging |
--dry-run | off | Print counts only, do not write file |
| Script | Purpose |
|---|---|
scripts/import_healthex.py | Import a FHIR bundle into HealthClaw with step-up auth |
scripts/convert_fasten.py | Convert Fasten Health export format to FHIR transaction Bundle |
fhir-r6-guardrails — Stack setup and MCP tool referencecuratr — Evaluate and fix data quality issues in exported recordsphi-redaction — conservative de-identification preview (stricter than patient-controlled)fasten-connect — Patient-authorized EHR ingestion (upstream of this export)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
fhir, health-data-export, de-identification, healthclaw, healthex
npx claudepluginhub aks129/healthclawguardrails --plugin healthclaw-guardrails14 skills in this plugin
/check-sourcesSurvey ALL connected health data sources at once. Use when the patient asks: (1) "what's connected" or "what services are linked", (2) "check all my services / all my data", (3) "do you have my records" or "what records do you have", (4) "did my data come through from <Fasten/MEDENT/HealthEx/Health Bank One/Flexpa/Epic/wearables>". Calls fhir_get_token (for protected tenants) then sources_check, and presents connection status + record counts by type. Connection status and counts only — never clinical values.
/curatrHealthClaw Curatr (healthclaw.io) — patient-facing FHIR data quality evaluation and correction. Use when: (1) Evaluating a patient's health record for coding issues (deprecated code systems, invalid codes, missing required fields), (2) Presenting issues in plain language with clinical impact, (3) Applying patient-approved corrections with full Provenance tracking, (4) Preparing a structured correction request for the patient's healthcare provider. Supports FHIR R4 US Core v9 resources: Condition, AllergyIntolerance, MedicationRequest, Immunization, Procedure, DiagnosticReport — with ICD-10-CM, SNOMED CT, LOINC, CVX, and RxNorm validation via public terminology APIs.
/fasten-connectUse this skill whenever connecting a patient's real health records from EHR systems (Epic, Cerner, Athena) or the TEFCA national network into HealthClaw Guardrails. Covers: Fasten Stitch widget embed, org_connection_id registration, EHI export job tracking, NDJSON ingestion status, TEFCA IAS identity-verified multi-provider retrieval, and post-import Curatr quality scan workflow./fhir-r6-guardrailsHealthClaw Guardrails (healthclaw.io) — FHIR agent guardrails for clinical data access via MCP. Supports FHIR R4 US Core v9 (stable) and FHIR R6 ballot3 (experimental). Use when: (1) Reading patient data through MCP tools with automatic PHI redaction, (2) Writing clinical resources with two-phase propose/commit and step-up authorization, (3) Querying observation statistics or recent lab results, (4) Evaluating R6 Permission resources for access control decisions, (5) Auditing agent access to healthcare data. 14 MCP tools.
/fhir-upstream-proxyConnect to real FHIR servers through the MCP guardrail proxy. Use when: (1) Connecting to HAPI FHIR, SMART Health IT, or Epic sandbox servers, (2) Proxying AI agent requests to production EHR systems with guardrails, (3) Ensuring upstream server URLs never leak to clients, (4) Understanding how redaction, audit, and step-up auth apply to upstream data.
/getting-startedEnd-to-end onboarding for the HealthClaw + OpenClaw personal-health-agent stack. Walks anyone — not just developers — through (1) installing OpenClaw as the local AI gateway, (2) standing up an open-source FHIR server (HAPI or Medplum) on their machine, (3) connecting their EHR records via HealthEx, Josh Mandel's fhir-skills, Flexpa, or any patient-right-of-access / TEFCA IAS service, (4) installing HealthClaw Guardrails with the OpenClaw personas pre-wired, and (5) pulling + reviewing health data end-to-end. Triggers when a user asks "how do I get started", "how do I set this up", "what do I need to use HealthClaw", "first time setup", "install everything", or any first-run question. Use this before any other HealthClaw skill when the user hasn't yet built their stack.
Other plugins' skills for the same job