Skip to content

load_data_timeline_prior_meds

Load and return the MSK-IMPACT prior medications timeline dataset (deidentified).

Returns:

Name Type Description
data Bunch

Dictionary-like object, with the following attributes.

  • data : pandas DataFrame The data matrix.
  • description_columns : list The names of the dataset columns. (Future release)
  • description_dataset : str The full description of the dataset. (Future release)
  • filename : str The path to the location of the data. (Future release)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from msk_cdm.datasets import connect_to_db
from msk_cdm.datasets.impact import load_data_timeline_prior_meds

# Connect to the database
auth_file = 'path/to/config.txt'
connect_to_db(auth_file=auth_file)

# Load the dataset
df_timeline_prior_meds = load_data_timeline_prior_meds()

# Access the data
df_prior_meds = df_timeline_prior_meds['data']

# Display the first few rows of the data
print(df_prior_meds.head())
Source code in msk_cdm/datasets/impact/datasets_impact.py
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
def load_data_timeline_prior_meds() -> Bunch:
    """Load and return the MSK-IMPACT prior medications timeline dataset (deidentified).

    Returns:
        data: Dictionary-like object, with the following attributes.

            - **data** : pandas DataFrame
                The data matrix.
            - **description_columns** : list
                The names of the dataset columns. (Future release)
            - **description_dataset** : str
                The full description of the dataset. (Future release)
            - **filename** : str
                The path to the location of the data. (Future release)

    Examples
    --------
    ```python
    from msk_cdm.datasets import connect_to_db
    from msk_cdm.datasets.impact import load_data_timeline_prior_meds

    # Connect to the database
    auth_file = 'path/to/config.txt'
    connect_to_db(auth_file=auth_file)

    # Load the dataset
    df_timeline_prior_meds = load_data_timeline_prior_meds()

    # Access the data
    df_prior_meds = df_timeline_prior_meds['data']

    # Display the first few rows of the data
    print(df_prior_meds.head())
    ```
    """
    df = _loader._load_impact_data_timeline_prior_meds()
    output = Bunch(data=df)
    return output