parsing-hl7v2-messages

parsing-hl7v2-messages is a skill for Claude Code, Codex from maziyarpanahi/openmed. It costs 169 tokens per session (2,112 once invoked), scanned A, original, Apache-2.0.

A decoder for HL7 v2 messages, a hospital data format used to exchange admissions, orders, lab results, and clinical documents. It turns pipe-and-caret encoded messages into structured fields and extracts narrative text from results and notes.

In plain words
What is it for?
Use it when receiving HL7 feeds from hospital interface engines, electronic health records, laboratories, or admission systems. It handles ADT, ORU, MDM, and ORM messages and surfaces text from OBX-5 and NTE-3 fields.
Why use it?
It removes the need to manually split complex message separators and locate the clinical text hidden inside them. This prepares HL7 feeds for OpenMed text processing.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Part of the openmed-skills plugin — 74 skills shipped together

Good fit Use it when receiving HL7 feeds from hospital interface engines, electronic health records, laboratories, or admission systems. It handles ADT, ORU, MDM, and ORM messages and surfaces text from OBX-5 and NTE-3 fields.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/maziyarpanahi/openmed/parsing-hl7v2-messages
About the project

OpenMed is local-first healthcare AI software that extracts clinical information and removes personally identifying details from clinical text on hardware controlled by the user. Healthcare developers use its Python runtime, Apple Silicon and mobile SDKs, and browser support for on-device clinical NER and PII de-identification.

maziyarpanahi/openmed · 5,302 stars · on GitHub · openmed.life

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add maziyarpanahi/openmed --skill parsing-hl7v2-messages
Clone the repo
git clone --depth 1 https://github.com/maziyarpanahi/openmed

Made for: Claude Code, Codex.

Or install openmed-skills, the plugin that ships this one along with the rest of its 74 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for parsing-hl7v2-messages

README.md
[![agentmods](https://agentmods.dev/badge/skills/maziyarpanahi/openmed/parsing-hl7v2-messages/github.svg)](https://agentmods.dev/skills/maziyarpanahi/openmed/parsing-hl7v2-messages)
Your own site
<a href="https://agentmods.dev/skills/maziyarpanahi/openmed/parsing-hl7v2-messages"><img src="https://agentmods.dev/badge/skills/maziyarpanahi/openmed/parsing-hl7v2-messages/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for parsing-hl7v2-messages

Your own site · 80×15
<a href="https://agentmods.dev/skills/maziyarpanahi/openmed/parsing-hl7v2-messages"><img src="https://agentmods.dev/badge/skills/maziyarpanahi/openmed/parsing-hl7v2-messages.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 169 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,112 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00169 $0.02112
Opus 5 $0.00084 $0.01056
Sonnet 5 $0.00034 $0.00422
Haiku 4.5 $0.00017 $0.00211

Measured 12d ago against content hash 334df5b04b51, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

parsing-hl7v2-messages scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/parsing-hl7v2-messages/SKILL.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Parsing HL7 v2 Messages for OpenMed

HL7 v2.x is the workhorse of hospital interfacing — ADT (admit/discharge/ transfer), ORU (observation results), MDM (document management), and ORM (orders) messages flow continuously between EHR, lab, radiology, and ancillary systems. The clinical narrative you want for NLP is buried in OBX-5 (observation value) and NTE-3 (notes/comments) fields, wrapped in a pipe-and-caret encoding. This skill decodes that envelope and hands the free text to OpenMed.

When to use

  • You receive HL7 v2 messages from an interface engine (Mirth/NextGen Connect, Rhapsody, Cloverleaf) and want to mine embedded note/result text.
  • A lab feed (ORU^R01) carries impression/comment narrative in OBX/NTE.
  • An MDM^T02 transcription message carries a full report in OBX-5.
  • You need a de-identified, structured feed into openmed.analyze_text.

HL7 v2 structure in one minute

A message is segments separated by \r (carriage return). Each segment is 3-letter-named, then fields split by |, components by ^, repetitions by ~, sub-components by &, with \ as escape. The encoding characters are declared in MSH-1 (the field separator) and MSH-2 (^~\&). Field positions are one-based, and MSH is special: MSH-1 is the separator, so MSH-2 is the first real field.

MSH|^~\&|LAB|HOSP|EHR|HOSP|20240302101500||ORU^R01|MSG0001|P|2.5
PID|1||MRN12345^^^HOSP^MR||DOE^JANE^Q||19700115|F|||1 FAKE ST^^SPRINGFIELD^IL^62704
OBR|1||ORD9|CBC^Complete Blood Count
OBX|1|TX|IMPRESSION||Mild leukocytosis; clinically correlate.||||||F
NTE|1||Patient reports fatigue x1 week. Dr. Smith notified.

Quick start

Parse the envelope and pull narrative from OBX-5 / NTE-3, then hand off:

import openmed
from openmed.interop.hl7v2 import parse_hl7v2

raw = open("results.hl7", encoding="utf-8").read()
msg = parse_hl7v2(raw)               # -> HL7Message (segments preserved)

narrative_chunks = []
for seg in msg.segments:
    if seg.name == "OBX":
        # OBX-2 is the value type; OBX-5 is the observation value.
        value_type = seg.get_field(2)
        if value_type in {"TX", "FT", "CE", "ST"}:
            narrative_chunks.append(seg.get_field(5) or "")
    elif seg.name == "NTE":
        narrative_chunks.append(seg.get_field(3) or "")

# Decode component delimiters into plain text before NLP.
flat = "\n".join(c.replace("^", " ").replace("&", " ") for c in narrative_chunks if c)

# Hand the narrative to OpenMed.
deid = openmed.deidentify(flat, method="replace", policy="hipaa_safe_harbor")
result = openmed.analyze_text(deid.text, output_format="dict")

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 146 lines · 169 tokens per session scan A 334df5b04b51

Subscribe to this mod's changes

parsing-hl7v2-messages is a skill published in the GitHub repository maziyarpanahi/openmed (5,302 stars, last pushed today), licensed Apache-2.0. It adds 169 tokens to every session and 2,112 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

server-inference

Use this skill when the user wants to run or debug MLX-VLM server inference, including uv run mlxvlm.server, /v1/models, /v1/chat/completions, /v1/responses, streaming, OpenAI-compatible clients, health checks, metrics, model unload/reload, adapters, trust-remote-code, and server request/response failures.

Blaizzy/mlx-vlm · 80 tokens

healthchain

Use when building, debugging, or deploying a Python service that touches FHIR resources, EHR APIs, CDS Hooks, clinical documents, or patient data — including writing model or agent output back into a patient record, connecting to Epic/Cerner/Medplum, or serving FHIR tools to an agent over MCP or LangChain.

healthchainai/HealthChain · 71 tokens

api-context

Canonical reference for the unified Context object passed to every tool and resource handler in @cyanheads/mcp-ts-core. Covers the full interface, its RequestContext base, all sub-APIs (ctx.log, ctx.state, ctx.requestInput, ctx.inputs, ctx.enrich, ctx.content), and when to use each.

cyanheads/medical-codes-mcp-server · 79 tokens

add-service

Scaffold a new service integration. Use when the user asks to add a service, integrate an external API, or create a reusable domain module with its own initialization and state.

cyanheads/medical-codes-mcp-server · 38 tokens

api-workers

Cloudflare Workers deployment using createWorkerHandler from @cyanheads/mcp-ts-core/worker. Covers the full handler signature, binding types, CloudflareBindings extensibility, runtime compatibility guards, and wrangler.toml requirements.

cyanheads/medical-codes-mcp-server · 51 tokens

api-auth

Authentication, authorization, and multi-tenancy patterns for @cyanheads/mcp-ts-core. Use when implementing auth scopes on tools/resources, configuring auth modes (none/jwt/oauth), working with JWT/OAuth env vars, or understanding how tenantId flows through ctx.state.

cyanheads/medical-codes-mcp-server · 58 tokens