Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Available Datasets
datasets/pyhealth.datasets.SHHSDataset
datasets/pyhealth.datasets.SleepEDFDataset
datasets/pyhealth.datasets.EHRShotDataset
datasets/pyhealth.datasets.Support2Dataset
datasets/pyhealth.datasets.COVID19CXRDataset
datasets/pyhealth.datasets.TUABDataset
datasets/pyhealth.datasets.TUEVDataset
Expand Down
15 changes: 15 additions & 0 deletions docs/api/datasets/pyhealth.datasets.Support2Dataset.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pyhealth.datasets.Support2Dataset
==================================

Overview
--------

The SUPPORT2 (Study to Understand Prognoses and Preferences for Outcomes and Risks of Treatments) dataset contains data on seriously ill hospitalized adults. It includes patient demographics, diagnoses, clinical measurements, and outcomes such as survival and hospital mortality.

The dataset is commonly used for mortality prediction, length of stay prediction, and other clinical outcome prediction tasks.

.. autoclass:: pyhealth.datasets.Support2Dataset
:members:
:undoc-members:
:show-inheritance:

1 change: 1 addition & 0 deletions pyhealth/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, *args, **kwargs):
from .shhs import SHHSDataset
from .sleepedf import SleepEDFDataset
from .bmd_hs import BMDHSDataset
from .support2 import Support2Dataset
from .splitter import (
split_by_patient,
split_by_patient_conformal,
Expand Down
55 changes: 55 additions & 0 deletions pyhealth/datasets/configs/support2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "1.0"
tables:
support2:
file_path: "support2.csv"
patient_id: "sno"
timestamp: null
attributes:
- "d.time"
- "age"
- "death"
- "sex"
- "hospdead"
- "slos"
- "dzgroup"
- "dzclass"
- "num.co"
- "edu"
- "income"
- "scoma"
- "charges"
- "totcst"
- "totmcst"
- "avtisst"
- "race"
- "sps"
- "aps"
- "surv2m"
- "surv6m"
- "hday"
- "diabetes"
- "dementia"
- "ca"
- "prg2m"
- "prg6m"
- "dnr"
- "dnrday"
- "meanbp"
- "wblc"
- "hrt"
- "resp"
- "temp"
- "pafi"
- "alb"
- "bili"
- "crea"
- "sod"
- "ph"
- "glucose"
- "bun"
- "urine"
- "adlp"
- "adls"
- "sfdm2"
- "adlsc"

49 changes: 49 additions & 0 deletions pyhealth/datasets/support2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import logging
from pathlib import Path
from typing import List, Optional

from .base_dataset import BaseDataset

logger = logging.getLogger(__name__)


class Support2Dataset(BaseDataset):
"""
A dataset class for handling SUPPORT2 (Study to Understand Prognoses and Preferences
for Outcomes and Risks of Treatments) data.

The SUPPORT2 dataset contains data on seriously ill hospitalized adults, including
patient demographics, diagnoses, clinical measurements, and outcomes.

The dataset is available in R packages such as "rms" and "Hmisc".
For more information, see: Knaus WA, Harrell FE, Lynn J, et al. The SUPPORT
prognostic model: Objective estimates of survival for seriously ill hospitalized
adults. Ann Intern Med. 1995;122(3):191-203.

Attributes:
root (str): The root directory where the dataset is stored.
tables (List[str]): A list of tables to be included in the dataset.
dataset_name (Optional[str]): The name of the dataset.
config_path (Optional[str]): The path to the configuration file.
"""

def __init__(
self,
root: str,
tables: List[str],
dataset_name: Optional[str] = None,
config_path: Optional[str] = None,
**kwargs
) -> None:
if config_path is None:
logger.info("No config path provided, using default config")
config_path = Path(__file__).parent / "configs" / "support2.yaml"
super().__init__(
root=root,
tables=tables,
dataset_name=dataset_name or "support2",
config_path=config_path,
**kwargs
)
return

Loading