exporting-bulk-fhir
O que ela faz
Esta skill executa uma exportação em massa FHIR, que reúne registros de um grupo de pacientes de um EHR em arquivos de dados. É para equipes que precisam de notas clínicas em escala populacional para processamento em lote.
Quando usar
- ✓Quando você precisa de notas clínicas de milhares de pacientes de um EHR, e não de um único prontuário.
- ✓Quando um job em lote sem interface precisa exportar um grupo definido de pacientes pelo FHIR.
- ✓Quando as notas exportadas devem seguir para um pipeline de desidentificação e extração em lote.
Link da skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/exporting-bulk-fhir/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Exporte as notas clínicas do grupo de pacientes cohort-42 do nosso servidor FHIR e depois desidentifique-as em lote.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente inicia uma requisição de exportação assíncrona, aguarda o servidor concluir, baixa os arquivos de dados resultantes e envia as notas para o pipeline em lote.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
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
# 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:
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
- Obtain a SMART Backend Services token (
system/DocumentReference.read, etc.). - Kickoff
$exportat the right level with_type(and_sincefor incrementals) +Prefer: respond-async. - Poll
Content-Locationuntil200; read the manif
Perguntas frequentes
Funciona para um único paciente?
Não nesta skill. Para um paciente em uma interface de usuário, uma skill de SMART on FHIR é a opção mais adequada.
Como ela se autentica?
Usa SMART Backend Services com um token assinado, e não um login interativo.
Quais tipos de recurso ela solicita?
Solicita tipos que contêm notas, como DocumentReference e DiagnosticReport.
Detalhes
Descrição original do autor
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.
repo: maziyarpanahi/openmed
Popularidade
- Estrelas no GitHub
- 5,8 mil
- Posição no ranking
- #14696
- Licença
- Apache-2.0
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
annotating-variants
5,8 milAjuda seu agente a prever o efeito de variantes genéticas, converter nomes HGVS em posições do genoma e incluir frequências populacionais, com anotadores gratuitos.
ask-openmed
5,8 milAjuda seu agente a escolher o fluxo de trabalho certo do OpenMed para um pedido de texto clínico, começando por uma verificação de privacidade sempre que houver dados de pacientes.
assembling-fhir-bundles
5,8 milAgrupa vários registros de saúde FHIR em um único Bundle de transação pronto para ser enviado a um prontuário eletrônico, com as referências internas ligadas corretamente.
auditing-deid-leakage
5,8 milProcura em textos clínicos desidentificados identificadores que sobraram, como SSN, números de cartão, e-mails e datas, e bloqueia a liberação se restar algum.
Skills parecidas
discrawl
394 milPermite que seu agente pesquise e resuma um arquivo local salvo de mensagens do Discord, verifique quão atualizado ele está e leia mensagens diretas.
clickhouse-io
280 milAjuda seu agente a otimizar consultas e esquemas no ClickHouse com boas práticas de alta performance. Use quando consultas analíticas forem lentas.
scientific-db-pubmed-database
280 milAjuda seu agente a buscar artigos científicos na área biomédica. É útil para pesquisas que precisam de informações médicas específicas.