Logo van Extracting Lab Tables

Extracting Lab Tables

CommunityPopulair
maziyarpanahi
extracting-lab-tables

Detecteert en extraheert tabellarische laboratoriumuitslagen uit pdf's, scans en afbeeldingen naar gestructureerde rijen die klaar zijn voor OpenMed en FHIR. Gebruik dit wanneer de gebruiker een CBC, CMP, lipidenpanel of ander laboratoriumrapport als gescande afbeelding, pdf of spreadsheet heeft en de testnaam, waarde, eenheid, referentiewaarde en afwijkingsindicator als nette rijen nodig heeft. Zoektermen: 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. Geschikt voor gebruik vóór OpenMed: herken en parse de tabel lokaal op het apparaat (openmed.multimodal.ocr.ocr, read_table), de-identificeer ingebedde PHI met openmed.deidentify en geef de gestructureerde rijen vervolgens door voor LOINC/UCUM-mapping en markering van laboratoriumafwijkingen met openmed.clinical. Invoer van afbeeldingen/CSV/TSV wordt ondersteund; PDF/DOCX veroorzaken UnsupportedDocumentError — zet deze eerst om naar afbeeldingen of tekst.

Overzicht

Uitgevermaziyarpanahi
Repositoryopenmed
Skillnaamextracting-lab-tables
Sterren
5.3K
Forks
677
Meegeleverde bestanden
Alleen instructies
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door maziyarpanahi op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Extracting Lab Tables in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/maziyarpanahi/openmed/tree/master/skills/extracting-lab-tables
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/extracting-lab-tables .claude/skills/extracting-lab-tables
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Extracting Lab Tables in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Extracting Lab Tables automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Extracting Lab Tables niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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.

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

Veelgestelde vragen

Wat doet de AI-skill Extracting Lab Tables?

Detecteert en extraheert tabellarische laboratoriumuitslagen uit pdf's, scans en afbeeldingen naar gestructureerde rijen die klaar zijn voor OpenMed en FHIR. Gebruik dit wanneer de gebruiker een CBC, CMP, lipidenpanel of ander laboratoriumrapport als gescande afbeelding, pdf of spreadsheet heeft en de testnaam, waarde, eenheid, referentiewaarde en afwijkingsindicator als nette rijen nodig heeft. Zoektermen: 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. Gesch...

Waarom Extracting Lab Tables gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Extracting Lab Tables bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Extracting Lab Tables in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/maziyarpanahi/openmed/tree/master/skills/extracting-lab-tables. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Extracting Lab Tables gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Extracting Lab Tables gebruiken?

Zoveel als je wilt. Je kunt Extracting Lab Tables gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Extracting Lab Tables gratis?

Ja. Deze skill is door maziyarpanahi op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇