Datasets:

hc01_t2d_sample / README.md
THUgewu's picture
Add TsFile (converted from xpertsystems/hc01-t2d-sample)
979888c verified
|
Raw History Blame Contribute Delete
1.82 kB
metadata
license: cc-by-nc-4.0
task_categories:
  - time-series-forecasting
tags:
  - tsfile
  - timeseries
  - time-series
  - format:tsfile
pretty_name: hc01_t2d_sample
configs:
  - config_name: default
    data_files:
      - split: train
        path: complications.tsfile
      - split: train
        path: encounters.tsfile
      - split: train
        path: labs.tsfile
      - split: train
        path: medications.tsfile
      - split: train
        path: patient_master.tsfile
      - split: train
        path: population_summary.tsfile

hc01_t2d_sample (TsFile)

Apache TsFile version of xpertsystems/hc01-t2d-sample.

  • Data files: ['complications.tsfile', 'encounters.tsfile', 'labs.tsfile', 'medications.tsfile', 'patient_master.tsfile', 'population_summary.tsfile']

Usage

Install the Apache TsFile Python SDK (pip install tsfile) and read a converted file:

from pathlib import Path
from tsfile import TsFileReader

path = Path("complications.tsfile")
with TsFileReader(str(path)) as reader:
    schemas = reader.get_all_table_schemas()
    print("tables:", list(schemas))
    table_name = next(iter(schemas))
    table = schemas[table_name]
    columns = [column.get_column_name() for column in table.get_columns()]
    print("columns:", columns)
    field_names = [
        column.get_column_name()
        for column in table.get_columns()
        if column.get_column_name() not in {"Time", "time"}
    ]
    if field_names:
        with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
            batch = result.read_arrow_batch()
            if batch is not None:
                print(batch.to_pandas().head())

Source & license