ingesting-clinical-documents
하는 일
이 스킬은 스캔된 팩스, 노트 사진, 스프레드시트 내보내기, C-CDA 파일을 사용자의 컴퓨터에서 깔끔한 텍스트로 바꿉니다. 임상 기록이 일반 텍스트가 아니라 이미지나 내보낸 파일로 도착하는 팀을 위한 스킬입니다.
사용하는 경우
- ✓임상 노트가 스캔된 팩스나 촬영된 페이지로 와서 텍스트 인식이 필요할 때.
- ✓환자 내보내기가 열 단위 처리가 필요한 CSV나 TSV 파일일 때.
- ✓C-CDA XML 문서를 분석 전에 텍스트로 펼쳐야 할 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/ingesting-clinical-documents/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“퇴원 노트의 스캔된 팩스와 환자 방문의 CSV 내보내기가 있습니다. 둘 다 제가 비식별화할 수 있는 깔끔한 텍스트로 바꿔 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 이미지에 기기 내 텍스트 인식을 실행하고, 표는 열 단위로 처리하며, C-CDA XML을 펼친 뒤, 출처 위치와 함께 깔끔한 텍스트를 돌려줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Ingesting Clinical Documents
Clinical text often arrives as scanned faxes, photographed notes, CSV exports, or
C-CDA XML — not plain text. openmed.multimodal converts these into a normalized
ExtractedDocument (clean text + character-offset → source-location spans) so you
can run de-identification and NER. It runs on-device: OCR backends are local,
no document leaves the machine.
When to use
- You have images / scanned faxes of clinical notes and need text out (OCR).
- You have CSV/TSV patient exports that need column-aware handling.
- You have C-CDA XML to flatten into text.
- You are building the intake stage that feeds
openmed.deidentifyandopenmed.analyze_text.
This is the first stage. After intake, hand off to
deidentifying-clinical-text then extracting-clinical-entities.
What is supported today
redact_document dispatches by file extension. Live handlers:
| Input | Extensions | Path |
|---|---|---|
| Images / scans | .png .jpg .jpeg .tif .tiff .bmp .gif .webp |
OCR (ocr() / image handler) |
| Tables | .csv .tsv |
column-aware tabular redaction |
| C-CDA | .xml (detected as CDA) |
stdlib CDA adapter |
PDF and DOCX have no live handler yet — redact_document("x.pdf") raises
UnsupportedDocumentError. Convert PDFs to page images first (or to text with your
own tool) and feed the images through OCR. See
references/multimodal-ingest.md for the full
contract, engines, and the tabular pipeline.
Install
pip install "openmed[multimodal]" # document intake contract + image deps
pip install "openmed[ocr-paddle]" # add the PaddleOCR engine
# Tesseract engine also needs the system binary, e.g.: brew install tesseract
Quick start: OCR an image, then de-identify
The clean two-step intake path. ocr() lives in the submodule (it is intentionally
not re-exported from openmed.multimodal):
from openmed.multimodal.ocr import ocr
import openmed
# 1) OCR a scanned/faxed note -> OcrResult -> ExtractedDocument -> plain text
result = ocr("fax_page.png", engine=None) # None = auto-select an installed engine
doc = result.to_document() # ExtractedDocument
text = doc.text # clean text for downstream OpenMed
# 2) De-identify, then run NER (privacy-first order)
deid = openmed.deidentify(text, method="mask", policy="hipaa_safe_harbor")
ner = openmed.analyze_text(deid.deidentified_text, output_format="dict")
for ent in ner.entities:
print(ent.label, ent.text, ent.confidence)
engine may be None (auto-select), "tesseract", "paddleocr", or an
OcrEngine instance. OcrResult exposes .text and per-word boxes via .words
(each OcrWord has text, bbox, confidence, page).
One-step intake + redaction with redact_document
For images, CSV/TSV, and CDA, redact_document performs intake and
de-identification in a single, format-aware call, returning an already-redacted
ExtractedDocument:
from openmed.multimodal import redact_document
# Image scan: OCR + redact in one call
doc = redact_document("fax_page.png")
print(doc.text) # redacted text
print(doc.spans[:3]) # SourceSpan offsets -> page / bbox in the original scan
# CSV export: per-column classification (direct id / quasi-id / safe) + redaction
table_doc = redact_document("patients.csv")
print(table_doc.text)
Use redact_document when you want OpenMed to own intake and redaction
(especially for tables, where redaction is column-scoped, not free-text NER). Use
the ocr() → to_document() → deidentify path when you want to control the
de-identification method, policy, or mapping yourself.
Tabular CSV/TSV redaction
CSV columns get classified before any cell is touched, so a free-text NER pass is not run blindly over structured data:
from openmed.multimodal import read_table, redact_table
view = read_table("patients.csv") # TableView with column decisions
for col in view.columns:
print(col.name, "->", col.assigned_class, col.action, col.canonical_label)
redacted = redact_table("patients.csv", keep_year=True)
print(redacted.text) # redacted CSV
for entry in redacted.manifest: # PHI-SAFE audit: counts/actions per column, no raw values
print(entry)
redact_table(...) returns a RedactedTable with .text, .headers, .rows,
.columns, and a PHI-safe .manifest (no raw
자주 묻는 질문
PDF를 지원하나요?
직접은 아직 아닙니다. PDF와 DOCX 파일에는 직접 처리기가 없으므로, 먼저 페이지를 이미지로 바꿔야 합니다.
문서가 제 컴퓨터 밖으로 나가나요?
아니요. 텍스트 인식은 기기에서 실행됩니다.
다음 단계는 무엇인가요?
깔끔한 텍스트는 비식별화로, 그다음 개체 추출로 넘어갑니다.
상세 정보
작성자의 원본 설명
Turn scanned faxes, images, and CSV/CDA exports into clean text ready for OpenMed de-identification and NER, fully on-device. Use when the user has clinical documents (image scans, photographed/faxed notes, tabular CSV/TSV exports, C-CDA XML) and needs OCR or structured intake before openmed.deidentify and openmed.analyze_text, asks about openmed.multimodal, OCR engines (Tesseract / PaddleOCR), tabular redaction, or layout and reading order. Covers the verified ocr() and redact_document() entry points and the ExtractedDocument contract. Pairs before deidentifying-clinical-text and extracting-c
repo: maziyarpanahi/openmed
인기도
- GitHub 스타
- 5.8k
- 순위
- #14708
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
annotating-variants
5.8k에이전트가 유전 변이의 효과를 예측하고, HGVS 이름을 게놈 위치로 바꾸고, 무료 공개 주석 도구를 사용해 인구 빈도를 붙이도록 돕습니다.
ask-openmed
5.8k에이전트가 임상 텍스트 요청에 맞는 OpenMed 워크플로를 고르도록 돕되, 환자 데이터가 있을 수 있으면 먼저 개인 정보 확인을 거치게 합니다.
assembling-fhir-bundles
5.8k여러 FHIR 건강 기록을 EHR로 보낼 수 있도록 하나의 트랜잭션 Bundle로 묶고, 내부 참조를 올바르게 연결하도록 에이전트를 돕습니다.
auditing-deid-leakage
5.8k비식별화된 임상 텍스트에 남은 SSN, 카드 번호, 이메일, 날짜 같은 식별자를 검사하고, 남은 것이 있으면 공개를 막도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.