Agent skill

Extracting Lab Tables

by maziyarpanahi in maziyarpanahi/openmed

Detects and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for OpenMed and FHIR.

Apache-2.0Auto-check passedDocuments & Office

Install Extracting Lab Tables

skills CLI
$ npx skills add maziyarpanahi/openmed --skill extracting-lab-tables -a claude-code

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

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

At a glance

Detects and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for OpenMed and FHIR.

  • Works in 6 steps: Detect the source type. CSV/TSV →… → OCR with positions. ocr() returns… → Reconstruct the grid. Cluster words by… → …
  • The user has a CBC
  • SKILL.md covers When to use, What OpenMed gives you here, Quick start and Workflow, plus 3 more sections
  • Calls pip

What it does

Extracting Lab Tables is an agent skill from maziyarpanahi/openmed. 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…

Its SKILL.md is about 2.1k 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 Documents & Office, covering CSV and tabular files, Clinical and healthcare research and Document parsing. It works with Microsoft Word. 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 has a CBC
  • Other lab report as a scanned image / PDF / spreadsheet and needs the test name
  • Reference range
  • Abnormal flag as clean rows

Example prompts

  • “Use the extracting-lab-tables skill to detect and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for…”
  • “/extracting-lab-tables”

Requirements

  • Python 3

Workflow steps

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

  1. Detect the source type. CSV/TSV → read_table. Image/scan → ocr().
  2. OCR with positions. ocr() returns OcrWords carrying bbox and page.
  3. Reconstruct the grid. Cluster words by their bbox y into rows, by x
  4. Identify the lab columns. Map headers to roles: test name, value,
  5. De-identify embedded PHI. Patient name/MRN often sit in the table header or
  6. Emit structured rows {test, value, unit, ref_range, flag} per result and

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:

    • pip

    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
    • loinc.org
    • ucum.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

Extracting Lab Tables loads about 2.1k tokens when it runs. Until then it costs about 220 tokens; SKILL.md has 803 words of instructions outside code blocks.

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

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). 803 words, ~2,099 tokens.

Download SKILL.mdSave it as .claude/skills/extracting-lab-tables/SKILL.md (or your agent's skills folder).
name
extracting-lab-tables
description
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.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
imaging-ocr
metadata.pairs
before
metadata.version
1.0

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=...) → an OcrResult whose .words are OcrWord(text, bbox, confidence, page) and .text is the joined string. OcrResult.to_document() bridges each word (with its pixel bbox) into an ExtractedDocument so detected PHI can project back to the source location.
  • read_table(...) → a TableView (headers, rows, delimiter, has_header, columns) for delimited text; classify_columns(...) labels each column; redact_table(...) → a RedactedTable with a PHI-safe manifest.

Engines: Tesseract (pip install "openmed[multimodal]" + the system binary) or PaddleOCR (pip install "openmed[ocr-paddle]"). ocr() auto-selects the first installed backend.

Quick start

python
from openmed.multimodal.ocr import ocr
from openmed.multimodal import read_table, classify_columns, redact_table

# A) Scanned / image lab report -> words with pixel boxes.
result = ocr("cbc_report.png")               # OcrResult
for w in result.words[:5]:
    print(repr(w.text), w.bbox, round(w.confidence, 2), "p", w.page)

doc = result.to_document()                   # ExtractedDocument; bbox preserved

# B) Delimited lab export (CSV/TSV) -> classified, PHI-redacted rows.
csv_text = (
    "PatientName,Test,Value,Unit,RefRange,Flag\n"
    "Jane Roe,Hemoglobin,9.1,g/dL,12.0-15.5,L\n"
    "Jane Roe,Glucose,148,mg/dL,70-99,H\n"
)
view = read_table(csv_text)                  # TableView
view = classify_columns(view)                # tag PHI vs data columns
redacted = redact_table(view)                # RedactedTable: PatientName redacted

for row in redacted.rows:
    print(row)                               # name column masked; lab data intact
for col in redacted.manifest:                # PHI-safe per-column audit manifest
    print(col["column_name"], col["assigned_class"], col["action"])

For an OCR'd (image) table, you reconstruct the grid yourself from word boxes (next section) — OCR yields positioned words, not a delimited table.

Workflow

  1. Detect the source type. CSV/TSV → read_table. Image/scan → ocr(). PDF/DOCX are not directly parseable (they raise UnsupportedDocumentError); render PDF pages to images first, or extract their text layer, then OCR.
  2. OCR with positions. ocr() returns OcrWords carrying bbox and page. Keep the boxes — they let you cluster words into rows/columns and project PHI redaction back to pixels.
  3. Reconstruct the grid. Cluster words by their bbox y into rows, by x into columns. The header row names the columns; align body cells to those x bands. Confidence (OcrWord.confidence) flags shaky cells for review.
  4. Identify the lab columns. Map headers to roles: test name, value, unit, reference range, flag. For delimited input, classify_columns tags PHI columns (name/MRN/DOB) so redact_table masks them.
  5. De-identify embedded PHI. Patient name/MRN often sit in the table header or a leading column. Redact those columns (redact_table) and run free-text cells through openmed.deidentify before the rows leave the device.
  6. Emit structured rows {test, value, unit, ref_range, flag} per result and hand off to LOINC/UCUM coding and parsing-lab-values.
Show full SKILL.md (347 more words)Show less

Hand-off to / from OpenMed

  • To parsing-lab-values (openmed.clinical.parse_reference_range, derive_abnormal_flag): pass the parsed value + ref_range (+ any explicit lab flag) to get a structured low/normal/high/critical signal.
  • To mapping-loinc: code each test name to a LOINC code; normalize the unit with UCUM. OpenMed emits the row; the terminology binding is out-of-process.
  • To FHIR (exporting-to-fhir): each row becomes an Observation (code=LOINC, valueQuantity with UCUM unit, referenceRange, interpretation) grouped under a DiagnosticReport.
  • De-identify with deidentifying-clinical-text (openmed.deidentify) before export. OCR words carry pixel boxes so redaction maps back to the image.
  • Everything here runs on-device; no scan or row leaves the process un-de-identified.

Edge cases & gotchas

  • PDF/DOCX raise UnsupportedDocumentError. The multimodal dispatcher has no PDF/DOCX handler — rasterize PDF pages to PNG (or pull the text layer) before calling ocr(). Image formats (PNG/JPG/TIFF/…) and CSV/TSV are handled.
  • OCR returns words, not a table. You must reconstruct rows/columns from bbox geometry. Multi-line cells, wrapped test names, and merged header cells break naive x/y bucketing — tune the clustering tolerance per template.
  • Reference ranges are easy to mis-split. "12.0-15.5", "<5", "70 - 99", and en/em dashes must survive OCR and tokenization as one cell. Don't let a space or a misread dash fracture the range — parse_reference_range downstream expects it whole.
  • Units belong to the value, not the range. Keep "9.1 g/dL" and the range "12.0-15.5" in separate fields; the value's unit must match the range's unit or the abnormal flag will be wrong (the flag helper is unit-agnostic).
  • Low-confidence cells. Gate on OcrWord.confidence; a 0.4-confidence value in a lab table is a patient-safety risk — route it to human review, don't silently accept it.
  • PHI hides in tables. Patient name, MRN, DOB, and accession numbers commonly occupy the header or first column. Classify and redact them; never log the raw table.
  • Engine availability. ocr() raises a clear MissingDependencyError if no backend is installed — install Tesseract or PaddleOCR per the extras.

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/extracting-lab-tables of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Extracting Lab Tables 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.

Extracting Lab Tables compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Extracting Lab Tables this skillmaziyarpanahi/openmed5.5k—~2.1kAutomated safety check: PassApache-2.0
Document Converterwentorai/Research-Claw858—~1.3kAutomated safety check: PassCustom licence
To MarkdownMathews-Tom/armory329—~2kAutomated safety check: PassMIT
MinerU Document Readeropendatalab/MinerU81k—~9.4kAutomated safety check: WarnCustom licence
MarkitdownImCa0/just-laws78114 repos~3.2kAutomated safety check: NotesMIT
Markitdownjimmc414/Kosmos5952 repos~1.7kAutomated safety check: PassNone

Similar skills

  • Document Converter

    wentorai/Research-Claw

    Convert Office documents (PPTX, DOCX, XLSX, PDF, HTML, CSV, JSON, XML, images) to Markdown using Microsoft MarkItDown.

    858 GitHub stars~1.3k tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • To Markdown

    Mathews-Tom/armory

    Convert any file or URL to clean Markdown: PDF, DOCX, XLSX, PPTX, HTML, images (OCR), audio, CSV, YouTube.

    329 GitHub stars~2k tokensUpdated 5 days ago
    Documents & OfficeAuto-check passed
  • MinerU Document Reader

    opendatalab/MinerU

    Reads, OCRs, searches and cites local documents through the mineru CLI, covering PDF, images, Office files, EPUB, HTML and CSV.

    81k GitHub stars~9.4k tokensUpdated today
    Documents & OfficeAuto-check: warnings
  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    781 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes
  • Markitdown

    jimmc414/Kosmos

    Convert various file formats (PDF, Office documents, images, audio, web content, structured data) to Markdown optimized for LLM processing.

    595 GitHub starsUsed in 2 repos~1.7k tokens
    Documents & OfficeAuto-check passed
  • Mineru

    Nebutra/MinerU-Skill

    An AI-Native skill for parsing PDF / Office / image files into Markdown with MinerU — a fast, zero-config document parser for AI agents.

    123 GitHub stars~504 tokensUpdated 17 days ago
    Documents & OfficeAuto-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

Works with

Questions about Extracting Lab Tables

What does Extracting Lab Tables do?

Detects and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for OpenMed and FHIR. Extracting Lab Tables is an agent skill from maziyarpanahi/openmed. Detects and extracts tabular laboratory panels from PDFs, scans, and images into structured rows ready for OpenMed and FHIR.

When should I use Extracting Lab Tables?

Extracting Lab Tables fits situations like: the user has a CBC; other lab report as a scanned image / PDF / spreadsheet and needs the test name; reference range; abnormal flag as clean rows.

How do I install Extracting Lab Tables in Claude Code?

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

How do I install Extracting Lab Tables in Codex?

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

Can I use Extracting Lab Tables 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 extracting-lab-tables -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/extracting-lab-tables, .gemini/skills/extracting-lab-tables, .github/skills/extracting-lab-tables and .opencode/skills/extracting-lab-tables in your project.

What does Extracting Lab Tables need to run?

Going by SKILL.md and its folder, Extracting Lab Tables needs the command-line tools its instructions call (pip). Our summary lists: Python 3.

Does Extracting Lab Tables access the network?

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

Is Extracting Lab Tables 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 Extracting Lab Tables use?

Extracting Lab Tables 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 Extracting Lab Tables use?

About 2.1k tokens (SKILL.md is roughly 8.4k 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 Extracting Lab Tables?

Skills that share tags, products or a category with Extracting Lab Tables: Document Converter (wentorai/Research-Claw, 858 stars), To Markdown (Mathews-Tom/armory, 329 stars), MinerU Document Reader (opendatalab/MinerU, 81k stars) and Markitdown (ImCa0/just-laws, 781 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Extracting Lab Tables?

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.