pubmed_case_reports / README.md
awinml's picture
Upload README.md with huggingface_hub
4f89ea3 verified
|
Raw
History Blame Contribute Delete
15.8 kB
---
language:
- en
license: cc-by-4.0
multilinguality: monolingual
size_categories: 10K<n<100K
task_categories:
- text-generation
- question-answering
task_ids:
- language-modeling
- abstractive-qa
pretty_name: PubMed Case Reports
tags:
- medical
- clinical
- pubmed
- pmc
- case-reports
- biomedical
---
# PubMed Case Reports
A collection of **13,989** full-text case reports from the PubMed Central (PMC) Open Access subset, spanning 2005–2025. Each article includes structured metadata, abstract, full body text, and section-level annotations. This dataset is designed for medical NLP, clinical reasoning, and biomedical text mining.
## Dataset Description
### Summary
This dataset comprises case reports published in peer-reviewed medical journals, sourced from the [PMC Open Access Subset](https://www.ncbi.nlm.nih.gov/pmc/tools/openftlist/). Case reports are detailed accounts of individual patient encounters — including presentation, diagnosis, treatment, and outcome — making them a rich resource for clinical reasoning research.
Each row corresponds to one article with:
- Bibliographic metadata (title, journal, publication date, PMCID, license)
- Structured abstract and full body text
- Section-level breakdown of the body text with normalised section types (background, case presentation, investigations, management, outcome, discussion, etc.)
### Supported Tasks
| Task | Description |
|------|-------------|
| **Clinical text generation** | Pre-train or fine-tune language models on medical case report text |
| **Abstractive QA / summarisation** | Generate summaries of clinical encounters from full text |
| **Section classification** | Classify paragraphs by clinical section type |
| **Information extraction** | Extract medical entities, relations, and treatment-outcome pairs |
| **Clinical reasoning evaluation** | Use as a knowledge source for retrieval-augmented generation (RAG) pipelines |
### Languages
All articles are in English.
## Dataset Structure
### Data Fields
| Field | Type | Description |
|-------|------|-------------|
| `pmcid` | `string` | PubMed Central identifier (e.g., `PMC1234567`) |
| `title` | `string` | Article title |
| `journal` | `string` | Journal name |
| `publication_date` | `string` | Publication date in `YYYY-MM-DD` format |
| `article_link` | `string` | URL to the article on PubMed Central |
| `license` | `string` | License text or URL |
| `abstract` | `string` | Article abstract (may be empty for some entries) |
| `body_text` | `string` | Full body text, concatenated from all sections |
| `sections` | `list[dict]` | Section-level breakdown (see below) |
| `background` | `string` | Concatenated text of all `background`‑type sections |
| `case_presentation` | `string` | Concatenated text of all `case_presentation`‑type sections |
| `discussion` | `string` | Concatenated text of all `discussion`‑type sections |
| `conclusion` | `string` | Concatenated text of all `conclusion`‑type sections |
| `investigations` | `string` | Concatenated text of all `investigations`‑type sections |
| `management` | `string` | Concatenated text of all `management`‑type sections |
| `outcome` | `string` | Concatenated text of all `outcome`‑type sections |
| `other` | `string` | Concatenated text of all `other`‑type sections (declarations, ethics, supplementary, etc.) |
| `references` | `string` | Concatenated text of all `references`‑type sections |
Each element in the `sections` list is a dictionary with:
| Sub-field | Type | Description |
|-----------|------|-------------|
| `section_type` | `string` | Normalised section type (one of: `abstract`, `background`, `case_presentation`, `investigations`, `management`, `outcome`, `discussion`, `conclusion`, `references`, `other`) |
| `heading` | `string` | Original section heading (e.g., `"Case Presentation"`, `"Discussion"`) |
| `text` | `string` | Section body text |
In addition to the nested `sections` list, each section type is also available as a top-level string column (e.g. `background`, `case_presentation`, `discussion`) containing the concatenated text of all sections of that type, making it easy to access specific clinical sections without iterating over lists.
### Data Splits
The dataset contains a single split:
| Split | Size |
|-------|------|
| `train` | 13,989 |
### Data Instance Example
```json
{
"pmcid": "PMC10000501",
"title": "Multisystem Inflammatory Syndrome in Adults Associated with Recent Infection with COVID-19",
"journal": "Diagnostics",
"publication_date": "2023-03-04",
"article_link": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10000501/",
"license": "© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license",
"abstract": "Multisystem inflammatory syndrome in adults (MIS-A) is a rare but severe complication of coronavirus disease 2019 (COVID-19)...",
"body_text": "Background\\n\\nMultisystem inflammatory syndrome in adults (MIS-A) is a rare but severe complication...",
"sections": [
{"section_type": "background", "heading": "1. Introduction", "text": "Multisystem inflammatory syndrome in adults (MIS-A) is a rare..."},
{"section_type": "case_presentation", "heading": "2. Case Report", "text": "A 34-year-old male with no significant past medical history..."},
{"section_type": "discussion", "heading": "3. Discussion", "text": "MIS-A is a newly recognized entity that presents with..."},
{"section_type": "conclusion", "heading": "4. Conclusions", "text": "This case highlights the importance of considering MIS-A..."}
],
"background": "Multisystem inflammatory syndrome in adults (MIS-A) is a rare...",
"case_presentation": "A 34-year-old male with no significant past medical history...",
"discussion": "MIS-A is a newly recognized entity that presents with...",
"conclusion": "This case highlights the importance of considering MIS-A...",
"investigations": "",
"management": "",
"outcome": "",
"other": "",
"references": ""
}
```
## Dataset Statistics
### Overview
| Metric | Value |
|--------|-------|
| Total articles | 13,989 |
| Unique PMCIDs | 13,989 |
| Unique journals | 811 |
| Year range | 2005–2025 |
| Total characters (abstract + body) | ~171 M |
| Total words (abstract + body) | ~25 M |
### Per-Column Statistics
| Column | Non-empty | Mean chars | Mean words | Min chars | Max chars |
|--------|-----------|-----------|-----------|-----------|-----------|
| `title` | 13,989 | 92 | 13 | 7 | 305 |
| `abstract` | 13,527 | 1,038 | 148 | 0 | 4,171 |
| `body_text` | 13,988 | 11,174 | 1,635 | 0 | 51,830 |
| `sections` | 13,988 | 6.0 sec/row | — | 0 | 42 |
| `background` | 13,215 (94.5%) | 1,248 | 184 | 0 | 18,594 |
| `case_presentation` | 11,557 (82.6%) | 3,082 | 452 | 0 | 20,614 |
| `discussion` | 12,940 (92.5%) | 4,350 | 637 | 0 | 23,891 |
| `conclusion` | 8,227 (58.8%) | 356 | 52 | 0 | 14,062 |
| `investigations` | 468 (3.3%) | 64 | 9 | 0 | 9,375 |
| `management` | 918 (6.6%) | 75 | 11 | 0 | 8,123 |
| `outcome` | 161 (1.2%) | 7 | 1 | 0 | 5,412 |
| `other` | 9,311 (66.6%) | 1,982 | 289 | 0 | 49,658 |
| `references` | 0 (0.0%) | 0 | 0 | 0 | 0 |
Note: Section-type columns (`background`, `case_presentation`, etc.) contain empty strings when no section of that type is present in an article. The "Non-empty" column shows how many rows have content for each field.
### Publication Years
| Year Range | Articles |
|-----------|----------|
| 2005–2010 | 418 |
| 2011–2015 | 2,498 |
| 2016–2020 | 4,167 |
| 2021–2025 | 7,205 |
The collection skews toward recent publications, with the majority (51%) from 2021–2025.
### Top Journals
| Articles | Journal |
|----------|---------|
| 1,136 | Journal of Medical Case Reports |
| 1,057 | Clinical Case Reports |
| 959 | International Journal of Surgery Case Reports |
| 886 | Radiology Case Reports |
| 403 | Journal of Surgical Case Reports |
| 345 | JAAD Case Reports |
| 299 | SAGE Open Medical Case Reports |
| 294 | Journal of Orthopaedic Case Reports |
| 263 | Case Reports in Medicine |
| 228 | European Heart Journal: Case Reports |
| 204 | American Journal of Ophthalmology Case Reports |
| 190 | Case Reports in Dentistry |
### License Distribution (Top 10)
| Count | License |
|-------|---------|
| 2,412 | CC BY-NC-ND 4.0 |
| 2,227 | Creative Commons Attribution License |
| 1,321 | Terms of CC Attribution license |
| 907 | CC BY 4.0 |
| 774 | CC BY-NC 4.0 |
| 703 | CC BY 3.0 |
| 609 | CC BY-NC-SA 4.0 |
| 567 | CC BY-NC-ND 3.0 |
| 420 | CC BY-SA 4.0 |
| 386 | CC BY 2.0 |
### Section Types
Sections are normalised into the following categories:
| Section Type | Coverage | Description |
|-------------|----------|-------------|
| `background` | 94.5% | Introduction, background |
| `case_presentation` | 82.6% | Case report, clinical history, patient presentation |
| `discussion` | 92.5% | Discussion, differential diagnosis |
| `conclusion` | 58.8% | Conclusion |
| `other` | 66.6% | Declarations, ethics, supplementary, etc. |
| `management` | 6.6% | Treatment, therapeutic intervention |
| `investigations` | 3.3% | Diagnostic workup, lab findings, imaging |
| `outcome` | 1.2% | Follow-up, outcome |
| `references` | <0.1% | References |
| `abstract`¹ | — | Article abstract (stored as top-level `abstract` column) |
¹ `abstract` section types from the body are not duplicated as a separate column since the article's structured abstract is already available as the top-level `abstract` field.
## Dataset Creation
### Source Data
The raw XML files were downloaded from the [PMC Open Access Subset](https://www.ncbi.nlm.nih.gov/pmc/tools/openftlist/) via the PMC Cloud Service S3 bucket (`pmc-oa-opendata`).
### Curation Process
1. **Discovery**: Case report PMCIDs were discovered by querying PubMed with the `Case Reports[pt]` filter, segmented by year to stay within the 10K-result cap.
2. **Download**: Full-text XML was downloaded in parallel using async HTTP (aiohttp) from the PMC Cloud Service S3 bucket.
3. **Parsing**: Each XML file was parsed to extract:
- Article metadata (title, journal, publication date, license, abstract)
- Section-aware body text with normalised section type labels
- Text cleaning (citation markers, figure references, whitespace normalisation)
4. **Format**: The parsed data was saved as a Parquet file.
### Curation Rationale
Clinical case reports are a uniquely valuable genre of medical literature. Unlike randomised trials or systematic reviews, case reports provide fine-grained, narrative descriptions of individual patient journeys — from initial presentation through diagnosis, treatment, and follow-up. This makes them especially suited for:
- Evaluating clinical reasoning capabilities of language models
- Building retrieval-augmented generation systems for rare conditions
- Training models to understand the structure of clinical narratives
## Usage
### Loading the Dataset
```python
from datasets import load_dataset
# Load the full dataset
ds = load_dataset("awinml/pubmed_case_reports", split="train")
# Access a single example
example = ds[0]
print(example["title"])
print(example["abstract"])
# Iterate in streaming mode (low memory)
ds_stream = load_dataset("awinml/pubmed_case_reports", split="train", streaming=True)
for i, row in enumerate(ds_stream):
if i >= 10:
break
print(row["pmcid"], row["title"][:80])
```
### Working with Sections
The dataset provides two ways to access section text:
**1. Via the `sections` list** (full detail with original headings):
```python
from datasets import load_dataset
ds = load_dataset("awinml/pubmed_case_reports", split="train")
for row in ds:
sections = row["sections"]
presentation = [s for s in sections if s["section_type"] == "case_presentation"]
if presentation:
print(f"PMCID: {row['pmcid']}")
print(f"Heading: {presentation[0]['heading']}")
print(f"Text: {presentation[0]['text'][:200]}...")
break
```
**2. Via direct section columns** (simpler, concatenated across all sections of that type):
```python
from datasets import load_dataset
ds = load_dataset("awinml/pubmed_case_reports", split="train")
for row in ds:
if row["case_presentation"]:
print(f"PMCID: {row['pmcid']}")
print(f"Case presentation: {row['case_presentation'][:200]}...")
break
```
**3. Section length analysis with pandas:**
```python
from datasets import load_dataset
import pandas as pd
ds = load_dataset("awinml/pubmed_case_reports", split="train")
df = ds.to_pandas()
# Which sections are most common?
for col in ["background", "case_presentation", "discussion", "conclusion"]:
pct = (df[col].str.len() > 0).mean() * 100
print(f"{col}: {pct:.1f}% of articles have this section")
# Average discussion length
df[df["discussion"] != ""]["discussion"].str.len().describe()
```
### Converting to Pandas
```python
import pandas as pd
from datasets import load_dataset
ds = load_dataset("awinml/pubmed_case_reports", split="train")
df = ds.to_pandas()
# Journal distribution
print(df["journal"].value_counts().head(10))
# Average body text length by year
df["year"] = pd.to_datetime(df["publication_date"]).dt.year
print(df.groupby("year")["body_text"].apply(lambda x: x.str.len().mean()))
```
### Retrieval-Augmented Generation
```python
from datasets import load_dataset
from sentence_transformers import SentenceTransformer
# Load and chunk for RAG
ds = load_dataset("awinml/pubmed_case_reports", split="train", streaming=True)
# Build a simple in-memory index from body texts
corpus = []
pmcids = []
for i, row in enumerate(ds):
if i >= 1000:
break
corpus.append(row["body_text"][:2000]) # first 2000 chars
pmcids.append(row["pmcid"])
model = SentenceTransformer("all-MiniLM-L6-v2")
embeddings = model.encode(corpus, show_progress_bar=True)
```
## Limitations & Considerations
- **Case reports are inherently anecdotal**: They describe individual patient experiences and should not be treated as population-level evidence.
- **Publication bias**: Journals are more likely to publish rare or novel cases, so the dataset may overrepresent unusual presentations.
- **Temporal skew**: The collection is weighted toward recent publications (51% from 2021–2025).
- **No structured outcome labels**: The dataset does not include standardised diagnostic or treatment outcome labels — this is a raw text corpus.
- **License variability**: Articles carry different Creative Commons licenses. Users should verify license compatibility for their specific use case (see the `license` field per row).
- **No PHI redaction guarantee**: While the source articles are published in open-access journals, individual case reports may contain identifiable patient information. Users should exercise appropriate caution.
## Citation
If you use this dataset, please cite it as:
```bibtex
@misc{awinml_pubmed_case_reports_2025,
author = {Ashwin Mathur},
title = {PubMed Case Reports: A Dataset of Full-Text Clinical Case Reports from PMC},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face Datasets},
howpublished = {\\url{https://huggingface.co/datasets/awinml/pubmed_case_reports}}
}
```
## License
The dataset itself is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Individual articles carry their own licenses as specified in the `license` field and may have additional restrictions.
## Contact
For questions or feedback, open an issue on the [dataset repository](https://huggingface.co/datasets/awinml/pubmed_case_reports).