Agent skill

Parsing Ccda Documents

by maziyarpanahi in maziyarpanahi/openmed

Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds.

Apache-2.0Auto-check passedResearch & Science

Install Parsing Ccda Documents

skills CLI
$ npx skills add maziyarpanahi/openmed --skill parsing-ccda-documents -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed parsing-ccda-documents --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/parsing-ccda-documents .claude/skills/parsing-ccda-documents && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
parsing-ccda-documents
GitHub stars
5.5k
Token cost
~1.9k tokens
SKILL.md length
606 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds.

  • Works in 5 steps: Confirm it's CDA. is_cda_document(...)… → Read the header for context: patient,… → Walk sections by templateId or section… → …
  • Keywords: C-CDA
  • SKILL.md covers When to use, C-CDA structure in one minute, Quick start and XML-aware whole-document…, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Parsing Ccda Documents is an agent skill from maziyarpanahi/openmed. Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds. Use before OpenMed processing when ingesting C-CDA R2.1 documents (CCD, Discharge Summary, H&P, Consultation Note) exported from an EHR and you need the narrative section text de-identified and analyzed. Hand section narrative to openmed.deidentify and openmed.analyzetext; XML-aware de-identification that preserves CDA markup is available via openmed.interop.cda…

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Research & Science, covering Clinical and healthcare research. The repository describes itself as: 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… The licence is Apache-2.0.

When your agent uses it

  • Keywords: C-CDA
  • Clinical document
  • Narrative block
  • Discharge summary XML

Example prompts

  • “Use the parsing-ccda-documents skill to parse C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries…”
  • “/parsing-ccda-documents”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Confirm it's CDA. is_cda_document(...) checks for a ClinicalDocument
  2. Read the header for context: patient, author, effectiveTime,
  3. Walk sections by templateId or section code (LOINC). Map to your
  4. Flatten narrative with itertext()`; preserve the section→text
  5. De-identify → analyze each narrative with OpenMed. Prefer coded

What it can do on your machine

Read from SKILL.md and the folder at commit 34d7b8c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and xml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • hl7.org
    • loinc.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Parsing Ccda Documents loads about 1.9k tokens when it runs. Until then it costs about 170 tokens; SKILL.md has 606 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~170
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 34d7b8c, republished under its Apache-2.0 licence (© maziyarpanahi). 606 words, ~1,947 tokens.

Download SKILL.mdSave it as .claude/skills/parsing-ccda-documents/SKILL.md (or your agent's skills folder).
name
parsing-ccda-documents
description
Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds. Use before OpenMed processing when ingesting C-CDA R2.1 documents (CCD, Discharge Summary, H&P, Consultation Note) exported from an EHR and you need the narrative section text de-identified and analyzed. Hand section narrative to openmed.deidentify and openmed.analyze_text; XML-aware de-identification that preserves CDA markup is available via openmed.interop.cda. Trigger keywords: C-CDA, CCD, CDA, clinical document, templateId, LOINC section, narrative block, discharge summary XML, ClinicalDocument.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
data-ingestion
metadata.pairs
before
metadata.version
1.0

Parsing C-CDA / CCD Documents for OpenMed

C-CDA (Consolidated Clinical Document Architecture) is the XML document standard behind Meaningful Use / ONC certification — the CCD, Discharge Summary, History & Physical, and Consultation Note you get when an EHR "exports a chart". Each document is a ClinicalDocument with a header (patient, authors, encounter) and a structuredBody of sections. Every section has two representations: a human-readable narrative <text> block and machine-readable coded entries. The narrative is what you feed to clinical NLP. This skill extracts it and hands it to OpenMed.

When to use

  • You receive C-CDA R2.1 / CCD documents (Direct messaging, patient portal export, HIE) and want the free-text section narrative for de-id and NER.
  • You need to pair narrative spans with the section they came from (problems, meds, allergies, results, plan, H&P narrative).
  • You want XML-safe de-identification that keeps the document parseable.

C-CDA structure in one minute

xml
<ClinicalDocument xmlns="urn:hl7-org:v3">
  <recordTarget><patientRole>
    <id extension="12345" root="..."/>
    <patient><name><given>Jane</given><family>Doe</family></name>
      <birthTime value="19700115"/></patient>
  </patientRole></recordTarget>
  <component><structuredBody>
    <component><section>
      <templateId root="2.16.840.1.113883.10.20.22.2.5.1"/>   <!-- Problems -->
      <code code="11450-4" codeSystem="2.16.840.1.113883.6.1"/> <!-- LOINC -->
      <title>Problems</title>
      <text>Active problems: Type 2 diabetes, hypertension.</text>  <!-- narrative -->
      <entry>...coded SNOMED/ICD entries...</entry>
    </section></component>
  </structuredBody></component>
</ClinicalDocument>

Sections are identified by templateId/@root and by section code (LOINC). The CDA namespace is urn:hl7-org:v3.

Quick start

Extract section narrative by LOINC code, then hand off to OpenMed:

python
import openmed
from xml.etree import ElementTree as ET

NS = {"hl7": "urn:hl7-org:v3"}
SECTION_LOINC = {
    "11450-4": "problems", "10160-0": "medications", "48765-2": "allergies",
    "30954-2": "results",  "18776-5": "plan",        "10164-2": "hpi",
    "8648-8": "hospital_course", "11488-4": "consult_note",
}

root = ET.parse("ccd.xml").getroot()
for section in root.findall(".//hl7:section", NS):
    code_el = section.find("hl7:code", NS)
    loinc = code_el.get("code") if code_el is not None else None
    text_el = section.find("hl7:text", NS)
    if text_el is None:
        continue
    narrative = "".join(text_el.itertext()).strip()       # flatten narrative block
    if not narrative:
        continue

    deid = openmed.deidentify(narrative, method="replace", policy="hipaa_safe_harbor")
    result = openmed.analyze_text(deid.text, output_format="dict")
    section_name = SECTION_LOINC.get(loinc, loinc)
    # attach (section_name, result) for downstream consumers

"".join(text_el.itertext()) flattens the narrative block (which may contain <paragraph>, <list>, <table>, <content> markup) into plain text.

XML-aware whole-document de-identification

When you need to redact PHI from the document (header ids, names, addresses, dates) while keeping the CDA XML valid and parseable, use the bundled adapter rather than regexing the raw XML:

python
from openmed.interop.cda import redact_cda, is_cda_document

if is_cda_document("ccd.xml"):
    safe_xml = redact_cda("ccd.xml")     # returns redacted XML string

redact_cda applies DEFAULT_PHI_ELEMENT_MAP (patient id hashed, name/address/ telecom null-flavored, birthTime and effectiveTime date-shifted) to header elements and sweeps section narrative text — operating on text nodes only so surrounding markup stays intact. Pass text_redactor= to plug an extra free-text callback (e.g. an openmed.deidentify wrapper), date_shift_days= for a fixed shift, and keep_year=True to preserve years.

Workflow

  1. Confirm it's CDA. is_cda_document(...) checks for a ClinicalDocument root. Reject XML with DOCTYPE/ENTITY declarations (XXE risk) — the adapter does this for you.
  2. Read the header for context: patient, author, effectiveTime, documentType (ClinicalDocument/code LOINC). Treat all header values as PHI.
  3. Walk sections by templateId or section code (LOINC). Map to your section vocabulary.
  4. Flatten narrative <text> with itertext(); preserve the section→text association for span attribution.
  5. De-identify → analyze each narrative with OpenMed. Prefer coded <entry> data when it already exists; use NLP to recover what is only in narrative.
Show full SKILL.md (237 more words)Show less

Hand-off to / from OpenMed

  • To OpenMed: flattened section narrative → openmed.deidentify → openmed.analyze_text. Keep (section LOINC, narrative) so entities trace back to their section.
  • Adapter: openmed.interop.cda provides redact_cda, is_cda_document, PhiElementRule, and DEFAULT_PHI_ELEMENT_MAP for namespace-aware, markup-preserving de-identification. It also registers an .xml document handler with OpenMed's multimodal intake, so .xml files are auto-detected as CDA and redacted on ingest.
  • Onward: re-emit findings via openmed.clinical.exporters.fhir or align narrative-derived problems to the section's coded entries.

Edge cases & gotchas

  • Narrative vs entries can disagree. The human-readable <text> is authoritative for display, coded <entry> for machines — they sometimes drift. Reconcile, and prefer narrative for what NLP must recover.
  • <content ID=...>/<reference> linkage. Narrative <content> elements carry IDs referenced by entries (<reference value="#problem1"/>); use them to link a coded entry to its exact narrative phrase.
  • Tables and lists. Section narrative often uses <table>/<list>; itertext() flattens these — re-impose structure if column meaning matters.
  • Namespaces & prefixes. Always bind the urn:hl7-org:v3 namespace; some documents add sdtc: extensions and xsi: typing.
  • XXE / unsafe XML. Never parse untrusted CDA with entity expansion enabled; the adapter rejects DOCTYPE/ENTITY outright — do the same in custom parsers.
  • Restricted terminology. Coded entries reference SNOMED CT, RxNorm, LOINC; OpenMed does not bundle SNOMED/CPT — resolve codes against the user's own licensed terminology out-of-process.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/parsing-ccda-documents of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Parsing Ccda Documents next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Parsing Ccda Documents compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Parsing Ccda Documents this skillmaziyarpanahi/openmed5.5k—~1.9kAutomated safety check: PassApache-2.0
Clinical Trials Databasegoogle-deepmind/science-skills3.2k2 repos~3.2kAutomated safety check: PassApache-2.0
CHARLS Paper Reproduction Guidexjtulyc/MedgeClaw6171 repos~1.8kAutomated safety check: PassNone
Biomedical Analysis Dispatchxjtulyc/MedgeClaw6171 repos~2kAutomated safety check: PassNone
Research Paperluwill/research-skills862—~1.9kAutomated safety check: PassNone
Research Proposalluwill/research-skills862—~4.5kAutomated safety check: NotesNone

Similar skills

  • Clinical Trials Database

    google-deepmind/science-skills

    Query ClinicalTrials.gov via APIv2. An agent skill from google-deepmind/science-skills.

    3.2k GitHub starsUsed in 2 repos~3.2k tokens
    Research & ScienceAuto-check passed
  • Guides an agent through reproducing papers built on the CHARLS health and retirement survey, from variable mapping to cognition, depression and isolation scores.

    617 GitHub starsUsed in 1 repo~1.8k tokens
    Research & ScienceAuto-check passed
  • Routes bioinformatics, drug discovery, clinical and multi-omics tasks from a chat interface to Claude Code sessions running K-Dense scientific skills, with a live dashboard per task.

    617 GitHub starsUsed in 1 repo~2k tokens
    Research & ScienceAuto-check passed
  • Research Paper

    luwill/research-skills

    A skill your agent uses when the user asks to write or draft an ORIGINAL RESEARCH ARTICLE — IMRaD paper, conference paper, short/workshop paper, 研究论文/期刊论文/会议论文 — reporting their own completed…

    862 GitHub stars~1.9k tokensUpdated today
    Research & ScienceAuto-check passed
  • Research Proposal

    luwill/research-skills

    A skill your agent uses when the user asks to write or draft a PhD / doctoral research proposal, research plan, 研究计划书, or 开题报告 — a forward-looking plan of background, gap, research questions…

    862 GitHub stars~4.5k tokensUpdated today
    Research & ScienceAuto-check: notes
  • Medical Imaging Review

    LeonChaoX/qinyan-academic-skills

    Write comprehensive literature reviews for medical imaging AI research.

    944 GitHub starsUsed in 3 repos~1.1k tokens
    Research & ScienceAuto-check: notes

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Parsing Ccda Documents

What does Parsing Ccda Documents do?

Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds. Parsing Ccda Documents is an agent skill from maziyarpanahi/openmed. Parses C-CDA / CCD XML clinical documents to extract human-readable section narrative plus coded entries, keyed by section LOINC codes and templateIds.

When should I use Parsing Ccda Documents?

Parsing Ccda Documents fits situations like: keywords: C-CDA; clinical document; narrative block; discharge summary XML.

How do I install Parsing Ccda Documents in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill parsing-ccda-documents -a claude-code`. Or copy the skill folder (skills/parsing-ccda-documents in maziyarpanahi/openmed) into .claude/skills/parsing-ccda-documents in your project. Claude Code loads it when a task matches its description.

How do I install Parsing Ccda Documents in Codex?

Run `npx skills add maziyarpanahi/openmed --skill parsing-ccda-documents -a codex`. Or copy the skill folder (skills/parsing-ccda-documents in maziyarpanahi/openmed) into .agents/skills/parsing-ccda-documents in your project. Codex loads it when a task matches its description.

Can I use Parsing Ccda Documents in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill parsing-ccda-documents -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/parsing-ccda-documents, .gemini/skills/parsing-ccda-documents, .github/skills/parsing-ccda-documents and .opencode/skills/parsing-ccda-documents in your project.

What does Parsing Ccda Documents need to run?

SKILL.md names no scripts, command-line tools or credentials: Parsing Ccda Documents is instructions for the agent only. Our summary lists: Python 3.

Does Parsing Ccda Documents access the network?

SKILL.md names 2 domains. As links in the text: hl7.org and loinc.org. This is read from the text; nothing was executed.

Is Parsing Ccda Documents safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Parsing Ccda Documents use?

Parsing Ccda Documents is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Parsing Ccda Documents use?

About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Parsing Ccda Documents?

Skills that share tags, products or a category with Parsing Ccda Documents: Clinical Trials Database (google-deepmind/science-skills, 3.2k stars), CHARLS Paper Reproduction Guide (xjtulyc/MedgeClaw, 617 stars), Biomedical Analysis Dispatch (xjtulyc/MedgeClaw, 617 stars) and Research Paper (luwill/research-skills, 862 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Parsing Ccda Documents?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,506 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.