sleep_score_fitbit / README.md
wangdx25's picture
Add TsFile (converted from aai530-group6/sleep-score-fitbit)
24b55bb verified
|
Raw
History Blame Contribute Delete
3.81 kB
metadata
license: mit
language:
  - en
task_categories:
  - time-series-forecasting
task_ids:
  - univariate-time-series-forecasting
size_categories:
  - n<1K
tags:
  - tsfile
  - timeseries
  - modality:timeseries
  - format:tsfile
  - health
  - sleep
  - fitbit
modality: timeseries
pretty_name: Fitbit Sleep Score Data (TsFile format)
configs:
  - config_name: default
    data_files:
      - split: train
        path: sleep_score_fitbit.tsfile

Fitbit Sleep Score Data (TsFile format)

The Fitbit Sleep Score dataset contains timestamped sleep metrics collected from one consenting individual's Fitbit Versa 4 device. It is a case study for sleep analysis, health monitoring, and wellness technology rather than a population-level cohort.

Modalities: Time-series

Source and scale

  • Original dataset: aai530-group6/sleep-score-fitbit
  • Kaggle source named by the original card: Fitbit Sleep Score Data
  • Source revision: b99745afef52c32b608edba1acf25f3e0f6089c4
  • One train file with 291 observations, one timestamp per sleep record.
  • Source time range: 2022-12-23T09:20:30Z through 2023-11-18T07:59:00Z.

TsFile schema

Column Role TsFile type Source meaning
Time TIME INT64 (ms) timestamp, parsed as UTC
overall_score FIELD INT64 Aggregate sleep score (up to 100)
revitalization_score FIELD INT64 Rejuvenating quality score
deep_sleep_in_minutes FIELD INT64 Deep sleep duration in minutes
resting_heart_rate FIELD INT64 Average resting heart rate
restlessness FIELD DOUBLE Restlessness measure

There are no device TAG columns because the source contains one individual's single series.

Conversion notes

  • ISO-8601 timestamps are interpreted in UTC and represented losslessly as integer milliseconds in Time; the original timestamp text is not duplicated as a FIELD.
  • All five measurements and all 291 rows are retained and sorted by Time.
  • No demographic or additional subject information is inferred from the source.

Files and usage

  • sleep_score_fitbit.tsfile
from pathlib import Path
from tsfile import TsFileReader

path = Path("sleep_score_fitbit.tsfile")
with TsFileReader(str(path)) as reader:
    table_name = next(iter(reader.get_all_table_schemas()))
    with reader.query_table(table_name, ["overall_score", "restlessness"], batch_size=512) as result:
        batch = result.read_arrow_batch()
        if batch is not None:
            print(batch.to_pandas().head())

License and attribution

The source dataset is released under the MIT license. Please respect the source card's privacy and ethical-use notes for this single-person case study. See the original dataset card.

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("sleep_score_fitbit.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())