Agent skill

Exporting Bulk Fhir

by maziyarpanahi in maziyarpanahi/openmed

Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale.

Apache-2.0Auto-check passedResearch & Science

Install Exporting Bulk Fhir

skills CLI
$ npx skills add maziyarpanahi/openmed --skill exporting-bulk-fhir -a claude-code

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

GitHub CLI
$ gh skill install maziyarpanahi/openmed exporting-bulk-fhir --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/exporting-bulk-fhir .claude/skills/exporting-bulk-fhir && 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
exporting-bulk-fhir
GitHub stars
5.5k
Token cost
~1.9k tokens
SKILL.md length
567 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale.

  • Works in 7 steps: Obtain a SMART Backend Services token… → Kickoff $export at the right level with… → Poll Content-Location until 200; read… → …
  • The user needs population-scale note extraction from an EHR
  • SKILL.md covers When to use, Three export levels, Quick start: kickoff → poll →… and Stream NDJSON into OpenMed…, plus 4 more sections
  • Calls curl

What it does

Exporting Bulk Fhir is an agent skill from maziyarpanahi/openmed. Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale. Covers the async kickoff (Prefer respond-async) - poll Content-Location - download NDJSON flow, the Bulk Data Access IG, type/since filters, and feeding DocumentReference/DiagnosticReport notes into openmed.deidentify in batch. Use when the user needs population-scale note extraction from an EHR or data warehouse to feed OpenMed…

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

  • The user needs population-scale note extraction from an EHR
  • Data warehouse to feed OpenMed
  • Mentions bulk export
  • Cohort de-identification

Example prompts

  • “/exporting-bulk-fhir”

Requirements

  • Python 3

Workflow steps

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

  1. Obtain a SMART Backend Services token (system/DocumentReference.read, etc.).
  2. Kickoff $export at the right level with _type (and _since for
  3. Poll Content-Location until 200; read the manifest output[].
  4. Download each NDJSON file (send the token if requiresAccessToken).
  5. Stream each line → extract note text → openmed.deidentify →
  6. Export findings to FHIR if needed (exporting-to-fhir,
  7. DELETE the bulk job to free server storage.

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

    Shell commands in SKILL.md call:

    • curl

    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
    • github.com

    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

Exporting Bulk Fhir loads about 1.9k tokens when it runs. Until then it costs about 166 tokens; SKILL.md has 567 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~166
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). 567 words, ~1,895 tokens.

Download SKILL.mdSave it as .claude/skills/exporting-bulk-fhir/SKILL.md (or your agent's skills folder).
name
exporting-bulk-fhir
description
Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale. Covers the async kickoff (Prefer respond-async) -> poll Content-Location -> download NDJSON flow, the Bulk Data Access IG, _type/_since filters, and feeding DocumentReference/DiagnosticReport notes into openmed.deidentify in batch. Use when the user needs population-scale note extraction from an EHR or data warehouse to feed OpenMed, mentions bulk export, $export, NDJSON, Flat FHIR, or cohort de-identification. Pairs before the OpenMed de-id/NER pipeline.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
fhir-interop
metadata.pairs
before
metadata.version
1.0

Exporting Bulk FHIR

When you need cohort-scale clinical text — not one patient in a UI — you use the FHIR Bulk Data Access ($export) operation: an async job that emits NDJSON files of resources you then stream into OpenMed for batch de-identification and NER. This skill sits before the OpenMed pipeline: it is how the notes arrive.

When to use

Reach for it when the source is an EHR or FHIR data warehouse and the volume is a population/group (thousands of patients), the workload is headless (no clinician UI), and the goal is to batch-feed openmed.deidentify / openmed.analyze_text. Triggers: "bulk export", "$export", "NDJSON", "Flat FHIR", "cohort de-identification", "export all notes". For a single in-chart patient with a UI, use scaffolding-smart-on-fhir instead.

Three export levels

  • System — GET [base]/$export — everything the client is authorized for.
  • Group — GET [base]/Group/[id]/$export — a defined cohort (most common).
  • Patient — GET [base]/Patient/$export — all patients in scope.

Bulk export uses SMART Backend Services auth (a system/*.read-scoped client-credentials token via a signed JWT assertion), not an interactive launch.

Quick start: kickoff → poll → download

bash
# 1) Kickoff (async). Ask for clinical-note-bearing resource types.
curl -s -X GET \
  'https://ehr.example/fhir/Group/cohort-42/$export?_type=DocumentReference,DiagnosticReport&_since=2024-01-01T00:00:00Z' \
  -H 'Authorization: Bearer <backend-services-token>' \
  -H 'Accept: application/fhir+json' \
  -H 'Prefer: respond-async' -D -
# -> 202 Accepted
#    Content-Location: https://ehr.example/fhir/bulkstatus/JOB123

# 2) Poll the status URL until complete
curl -s 'https://ehr.example/fhir/bulkstatus/JOB123' \
  -H 'Authorization: Bearer <token>'
# 202 + X-Progress while running; 200 + a manifest JSON when done:
# { "transactionTime": "...", "request": "...", "requiresAccessToken": true,
#   "output": [
#     { "type": "DocumentReference",
#       "url": "https://ehr.example/fhir/bulkfiles/dr-1.ndjson" },
#     { "type": "DiagnosticReport",
#       "url": "https://ehr.example/fhir/bulkfiles/dx-1.ndjson" } ] }

# 3) Download each NDJSON file (one FHIR resource per line)
curl -s 'https://ehr.example/fhir/bulkfiles/dr-1.ndjson' \
  -H 'Authorization: Bearer <token>' -o dr-1.ndjson

Key headers/params: Prefer: respond-async (required to start the job), Content-Location (the status/polling URL), _type (limit resource types), _since (incremental export), _typeFilter (server-side resource filtering). Delete the job when done: DELETE <status-url>.

Stream NDJSON into OpenMed (batch)

NDJSON is one resource per line — stream it; do not load the whole file. Pull the note text out of each DocumentReference/DiagnosticReport and run OpenMed on-device, in batch:

python
import base64, json, openmed

def note_text(resource: dict) -> str | None:
    # DocumentReference.content[].attachment.data (base64) or .url -> Binary
    for content in resource.get("content", []):
        att = content.get("attachment", {})
        if att.get("data"):
            return base64.b64decode(att["data"]).decode("utf-8", "replace")
    # DiagnosticReport.presentedForm[].data
    for form in resource.get("presentedForm", []):
        if form.get("data"):
            return base64.b64decode(form["data"]).decode("utf-8", "replace")
    return None

with open("dr-1.ndjson", "r", encoding="utf-8") as fh:
    for line in fh:                              # streaming, line by line
        resource = json.loads(line)
        text = note_text(resource)
        if not text:
            continue
        # De-identify every note before anything downstream sees it
        deid = openmed.deidentify(text, method="replace", policy="hipaa_safe_harbor")
        # Then NER on the de-identified text
        entities = openmed.analyze_text(
            deid.text, model_name="disease_detection_superclinical")
        # ... persist de-identified text + spans; never persist raw PHI

For large cohorts, parallelise across files (each NDJSON file is independent) and reuse a single OpenMed model loader across notes to avoid reloading weights.

Workflow

  1. Obtain a SMART Backend Services token (system/DocumentReference.read, etc.).
  2. Kickoff $export at the right level with _type (and _since for incrementals) + Prefer: respond-async.
  3. Poll Content-Location until 200; read the manifest output[].
  4. Download each NDJSON file (send the token if requiresAccessToken).
  5. Stream each line → extract note text → openmed.deidentify → openmed.analyze_text.
  6. Export findings to FHIR if needed (exporting-to-fhir, assembling-fhir-bundles).
  7. DELETE the bulk job to free server storage.
Show full SKILL.md (237 more words)Show less

Hand-off to / from OpenMed

  • Into OpenMed (the point of this skill): NDJSON note text → batch openmed.deidentify is the primary hand-off. De-identify first; treat every exported note as PHI until it has been through the de-id pass.
  • Back to FHIR: the spans from analyze_text → exporting-to-fhir → to_bundle; write back only if your governance allows.
  • Local-first at scale: OpenMed runs on-device, so the cohort never leaves your infrastructure for NLP. Only the export traffic touches the EHR.

Edge cases & gotchas

  • It's async — never block on the kickoff. A 202 + Content-Location is success; poll with backoff and honour Retry-After/X-Progress.
  • Files can be huge. Stream NDJSON line-by-line; do not json.load a whole file. Parallelise per file, not per line.
  • requiresAccessToken. If the manifest says so, send the bearer token when downloading the NDJSON files too.
  • De-identify before persistence. Raw exported notes are PHI; the first durable artifact must be de-identified. Verify de-id with openmed.eval leakage gates (evaluating-with-leakage-gates), not F1 alone.
  • Note formats vary. Text may be inline base64, an external Binary reference, or RTF/HTML in presentedForm. Normalise to plain text before OpenMed; for scanned PDFs use OpenMed's document/OCR intake.
  • Clean up the job. Servers may cap concurrent/stored exports; DELETE the status URL when finished.
  • Scope minimally. Request only the resource types you will process; honour the cohort's consent/governance.

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/exporting-bulk-fhir of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Exporting Bulk Fhir 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.

Exporting Bulk Fhir compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Exporting Bulk Fhir this skillmaziyarpanahi/openmed5.5k—~1.9kAutomated safety check: PassApache-2.0
SQL On Fhiraehrc/pathling137—~2.3kAutomated safety check: PassApache-2.0
Pathling Pythonaehrc/pathling137—~4kAutomated safety check: PassApache-2.0
Medical Vector Searchaipoch/medical-research-skills1.9k—~2kAutomated safety check: PassMIT
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

Similar skills

  • SQL On Fhir

    aehrc/pathling

    Expert guidance for implementing SQL on FHIR v2 ViewDefinitions and operations to create portable, tabular projections of FHIR data.

    137 GitHub stars~2.3k tokensUpdated 3 days ago
    Research & ScienceAuto-check passed
  • Pathling Python

    aehrc/pathling

    Comprehensive cheat sheet for using the Pathling Python API.

    137 GitHub stars~4k tokensUpdated 3 days ago
    Research & ScienceAuto-check passed
  • Medical Vector Search

    aipoch/medical-research-skills

    Vector database retrieval and evidence-based answering for medical research topics.

    1.9k GitHub stars~2k tokensUpdated 24 days ago
    Research & ScienceAuto-check passed
  • 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

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 Exporting Bulk Fhir

What does Exporting Bulk Fhir do?

Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale. Exporting Bulk Fhir is an agent skill from maziyarpanahi/openmed. Kick off and harvest a FHIR Bulk Data $export (system-, group-, or patient-level) and stream the resulting NDJSON into a batch OpenMed de-identification + NER pipeline at cohort scale.

When should I use Exporting Bulk Fhir?

Exporting Bulk Fhir fits situations like: the user needs population-scale note extraction from an EHR; data warehouse to feed OpenMed; mentions bulk export; cohort de-identification.

How do I install Exporting Bulk Fhir in Claude Code?

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

How do I install Exporting Bulk Fhir in Codex?

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

Can I use Exporting Bulk Fhir 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 exporting-bulk-fhir -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/exporting-bulk-fhir, .gemini/skills/exporting-bulk-fhir, .github/skills/exporting-bulk-fhir and .opencode/skills/exporting-bulk-fhir in your project.

What does Exporting Bulk Fhir need to run?

Going by SKILL.md and its folder, Exporting Bulk Fhir needs the command-line tools its instructions call (curl). Our summary lists: Python 3.

Does Exporting Bulk Fhir access the network?

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

Is Exporting Bulk Fhir 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 Exporting Bulk Fhir use?

Exporting Bulk Fhir 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 Exporting Bulk Fhir use?

About 1.9k tokens (SKILL.md is roughly 7.6k 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 Exporting Bulk Fhir?

Skills that share tags, products or a category with Exporting Bulk Fhir: SQL On Fhir (aehrc/pathling, 137 stars), Pathling Python (aehrc/pathling, 137 stars), Medical Vector Search (aipoch/medical-research-skills, 1.9k stars) and Clinical Trials Database (google-deepmind/science-skills, 3.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Exporting Bulk Fhir?

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.