agentsclimarketplace

Clinical text summarization

Skill rbr7/MedClawMini/skills/clinical-text-summarization

A focused, production-minded library of 197 clinical-AI and healthcare data-science skills for the OpenClaw agent platform featuring data quality, clinical NLP, big-data ML, explainable AI, drug safety, and regulatory.

Install
npx -y skills add rbr7/MedClawMini --skill clinical-text-summarization

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Summarize long clinical and biomedical text discharge summaries, progress-note bundles, radiology/pathology reports, and literature using extractive and abstractive methods. Covers transformer summarizers (BART/PEGASUS/T5, clinical/long-document variants), chunking for long inputs, and faithfulness/hallucination checking against the source. Use to produce a concise problem-oriented summary, a "one-liner" hospital course, or a literature digest while guarding against fabricated facts.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.1 KB, as published. Nobody here has run it

Clinical Text Summarization

Overview

Clinicians and analysts drown in text. This skill condenses long clinical documents into faithful, structured summaries. Because hallucination is unacceptable in healthcare, the skill pairs generation with an explicit faithfulness check that verifies summary claims against the source.

When to Use This Skill

  • Turning a multi-day note bundle into a problem-oriented hospital course one-liner.
  • Summarizing radiology/pathology reports into impressions.
  • Producing a literature digest from many abstracts (pairs with pubmed-search).
  • Compressing context before downstream extraction or QA.

Methods

  1. Extractive (safe default) rank and select source sentences (TextRank, or embedding-centroid selection). Zero hallucination risk because every sentence is verbatim; best when faithfulness dominates.
  2. Abstractive generate new phrasing with a transformer (BART/PEGASUS/T5; long-input variants like Longformer-Encoder-Decoder for >1k tokens; clinical-tuned models where licensing allows).
  3. Hybrid extract salient sentences, then abstractively smooth them (extractive grounding reduces hallucination).
  4. Long documents chunk → summarize chunks → summarize the summaries (map-reduce / refine), preserving section structure.

Example

from transformers import pipeline
summ = pipeline("summarization", model="facebook/bart-large-cnn")

def summarize_long(text, chunk=900):
    words = text.split()
    parts = [" ".join(words[i:i+chunk]) for i in range(0, len(words), chunk)]
    partials = [summ(p, max_length=130, min_length=30)[0]["summary_text"] for p in parts]
    return summ(" ".join(partials), max_length=160, min_length=40)[0]["summary_text"]
# Faithfulness guard: every summary entity must appear in the source
import medspacy
nlp = medspacy.load()
def unsupported_entities(summary, source):
    src = {e.text.lower() for e in nlp(source).ents}
    return [e.text for e in nlp(summary).ents if e.text.lower() not in src]
# non-empty list => possible hallucination => fall back to extractive

Evaluation

Report ROUGE and BERTScore for overlap with reference summaries, but treat them as necessary-not-sufficient they do not detect hallucination. Add a faithfulness/factual- consistency metric (entity-overlap above, or an NLI/QA-based check) and a clinician spot- review for high-stakes use. Prefer the extractive path whenever a hallucinated fact would be dangerous.

Outputs

  • summaries.parquet doc_id, summary, method, ROUGE/BERTScore, faithfulness flag.
  • flagged_summaries.csv summaries with unsupported claims for review.
  • summary_report.md method comparison and quality metrics.

Healthcare Context

Designed for the long, repetitive, template-heavy nature of clinical notes. De-identify PHI first. The faithfulness guard reflects the clinical-safety bar: a fluent-but-wrong summary is worse than a plain extractive one. Complements clinical-nlp-entity-extraction and clinical-text-search-elk.

References

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.