
Extracting Lab Tables
Detects and extracts tabular laboratory panels from PDFs, scans, and images into...
Install
npx skills add maziyarpanahi/openmed --skill extracting-lab-tables -g -a claude-code -y- Repository
- maziyarpanahi/openmed5.8k
- Category
- Documents
- Updated
- 4d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 1,844 tokens
- Runs scripts
- No, instructions only
What it does
Detects and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for OpenMed and FHIR. Use when the user has a CBC, CMP, lipid panel, or other lab report as a scanned image / PDF / spreadsheet and needs the test name, value, unit, reference range, and abnormal flag as clean rows. Trigger keywords: lab table extraction, lab panel, OCR labs, table detection, layout analysis, header detection, reference range column, abnormal flag column, LOINC, UCUM, CBC, CMP, structured labs. Pairs before OpenMed: OCR/parse the table on-device (openmed.multimodal.ocr.ocr, read_table), de-identify embedded PHI with openmed.deidentify, then hand structured rows to LOINC/UCUM mapping and openmed.clinical lab flagging. Image/CSV/TSV intake is supported; PDF/DOCX raise UnsupportedDocumentError, render those to images or text first.
Extracting lab tables from documents and scans
Lab results arrive as tables: a column of test names, a value column, units, a reference range, and an abnormal flag (H/L/Crit). To use them downstream you must recover that grid from a PDF, scan, or spreadsheet into clean rows, then code each test to LOINC, normalize units with UCUM, and flag abnormals.
This skill is the intake step: it OCRs/parses the table on-device with
openmed.multimodal, de-identifies any embedded PHI, and emits structured rows.
It pairs before OpenMed's clinical helpers, the LOINC/UCUM coding and the
high/low/critical flag are downstream (see parsing-lab-values).
When to use
- You have a lab report as a scanned image / photo / PDF page and need the panel as rows, not pixels.
- The source is a CSV/TSV export and you need columns classified (which is the value, the unit, the range, the flag) and PHI columns redacted.
- You need machine-readable rows to feed LOINC mapping and a FHIR
Observation/DiagnosticReport.
What OpenMed gives you here
openmed.multimodal ships the intake primitives (no heavy deps at import; the
OCR backend loads lazily):
openmed.multimodal.ocr.ocr(image, engine=...)→ anOcrResultwhose.wordsareOcrWord(text, bbox, confidence, page)and.textis the joined string.OcrResult.to_document()bridges each word (with its pixel bbox) into anExtractedDocumentso detected PHI can project back to the source location.read_table(...)→ aTableView(headers,rows,delimiter,has_header,columns) for delimited text;classify_columns(...)labels each column;redact_table(...)→ aRedactedTablewith a PHI-safemanifest.
Engines: Tesseract (pip install "openmed[multimodal]" + the system binary) or
PaddleOCR (pip install "openmed[ocr-paddle]"). ocr() auto-selects the first
installed backend.


