annotating-variants
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators (Ensembl VEP REST,…
Extract clinical entities from synthetic or already de-identified text with OpenMed and map them into deterministic FHIR R4 resources and a Bundle. Use when an agent must turn local clinical NER output into Conditions, MedicationStatements, Observations, or other FHIR resources
Claude Code
$ npx -y skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir --agent claude-code
Codex
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a codex -y
Cursor
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a cursor -y
Gemini CLI
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a gemini-cli -y
GitHub Copilot
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a github-copilot -y
OpenCode
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a opencode -y
Windsurf
$ npx skills add maziyarpanahi/openmed --skill extract-clinical-entities-to-fhir -a windsurf -y
name: extract-clinical-entities-to-fhir description: "Extract clinical entities from synthetic or already de-identified text with OpenMed and map them into deterministic FHIR R4 resources and a Bundle. Use when an agent must turn local clinical NER output into Conditions, MedicationStatements, Observations, or other FHIR resources without inventing terminology codes."
Separate extraction from clinical coding. OpenMed finds spans and supplies the mechanical FHIR builders; the application decides which resource type and status are clinically appropriate.
1. Keep the source synthetic, or de-identify it inside the trusted boundary before extraction. 2. Run `openmed.analyze_text` with the task-appropriate clinical model. 3. Filter predictions by label and confidence; preserve offsets in a PHI-safe audit record. 4. Map each accepted span to the correct FHIR resource type. 5. Add terminology codes only from a user-approved mapping or terminology service. Never invent a code. 6. Assemble resources with `to_bundle` and validate against the target profile.
Install the model runtime first with `python -m pip install "openmed[hf]"`.
import json
from openmed import analyze_text
from openmed.clinical.exporters.fhir import to_bundle
note = "Assessment: type 2 diabetes mellitus is stable on metformin."
result = analyze_text(
note,
model_name="disease_detection_superclinical",
confidence_threshold=0.5,
)
resources = [{"resourceType": "Patient", "id": "synthetic-patient"}]
for index, entity in enumerate(result.entities, start=1):
if entity.label.upper() not in {"CONDITION", "DIAGNOSIS", "DISEASE"}:
continue
resources.append(
{
"resourceType": "Condition",
"id": f"condition-{index}",
"clinicalStatus": {
"coding": [
{
"system": (
"http://terminology.hl7.org/CodeSystem/"
"condition-clinical"
),
"code": "active",
}
]
},
"verificationStatus": {
"coding": [
{
"system": (
"http://terminology.hl7.org/CodeSystem/"
"condition-ver-status"
),
"code": "confirmed",
}
]
},
# A text-only CodeableConcept is preferable to an invented code.
"code": {"text": entity.text},
"subject": {"reference": "Patient/synthetic-patient"},
}
)
if len(resources) == 1:
raise RuntimeError("No condition spans met the label and confidence rules")
bundle = to_bundle(resources, doc_id="synthetic-note-001")
print(json.dumps(bundle, indent=2))`OperationOutcome.diagnostics`, or trace metadata.
resource as active or confirmed.
Read and run [the redaction-to-FHIR walkthrough](../../examples/first_five_minutes_redact_extract_fhir.py) for an offline-friendly pipeline with deterministic extraction.
Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android and browser runtimes. Apache-2.0 SDK.
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators (Ensembl VEP REST,…
Choose the first OpenMed workflow skill for an intake, privacy, extraction, exchange, or verification request using deterministic…
Package multiple FHIR R4 resources produced from OpenMed output into a single valid transaction Bundle ready to POST to an EHR,…
Adversarially scan already-de-identified clinical text for residual identifiers and emit a leakage report that blocks release on…
Produce a signed, reproducible, no-PHI audit trail for an OpenMed de-identification run via deidentify(audit=True). Use when the…
Generates and verifies 21 CFR Part 11-style audit trails — who/what/when, electronic signatures, and tamper-evidence — for…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…