wangdx25 commited on
Commit
24b55bb
·
verified ·
1 Parent(s): 972a8f8

Add TsFile (converted from aai530-group6/sleep-score-fitbit)

Browse files
Files changed (2) hide show
  1. README.md +116 -0
  2. sleep_score_fitbit.tsfile +0 -0
README.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - time-series-forecasting
7
+ task_ids:
8
+ - univariate-time-series-forecasting
9
+ size_categories:
10
+ - n<1K
11
+ tags:
12
+ - tsfile
13
+ - timeseries
14
+ - modality:timeseries
15
+ - format:tsfile
16
+ - health
17
+ - sleep
18
+ - fitbit
19
+ modality: timeseries
20
+ pretty_name: Fitbit Sleep Score Data (TsFile format)
21
+ configs:
22
+ - config_name: default
23
+ data_files:
24
+ - split: train
25
+ path: "sleep_score_fitbit.tsfile"
26
+ ---
27
+
28
+ # Fitbit Sleep Score Data (TsFile format)
29
+
30
+ The Fitbit Sleep Score dataset contains timestamped sleep metrics collected
31
+ from one consenting individual's Fitbit Versa 4 device. It is a case study for
32
+ sleep analysis, health monitoring, and wellness technology rather than a
33
+ population-level cohort.
34
+
35
+ Modalities: Time-series
36
+
37
+ ## Source and scale
38
+
39
+ - Original dataset: [aai530-group6/sleep-score-fitbit](https://huggingface.co/datasets/aai530-group6/sleep-score-fitbit)
40
+ - Kaggle source named by the original card: [Fitbit Sleep Score Data](https://www.kaggle.com/datasets/mbalos/fitbit-sleep-score-data/data)
41
+ - Source revision: b99745afef52c32b608edba1acf25f3e0f6089c4
42
+ - One train file with 291 observations, one timestamp per sleep record.
43
+ - Source time range: 2022-12-23T09:20:30Z through 2023-11-18T07:59:00Z.
44
+
45
+ ## TsFile schema
46
+
47
+ | Column | Role | TsFile type | Source meaning |
48
+ |---|---|---|---|
49
+ | Time | TIME | INT64 (ms) | timestamp, parsed as UTC |
50
+ | overall_score | FIELD | INT64 | Aggregate sleep score (up to 100) |
51
+ | revitalization_score | FIELD | INT64 | Rejuvenating quality score |
52
+ | deep_sleep_in_minutes | FIELD | INT64 | Deep sleep duration in minutes |
53
+ | resting_heart_rate | FIELD | INT64 | Average resting heart rate |
54
+ | restlessness | FIELD | DOUBLE | Restlessness measure |
55
+
56
+ There are no device TAG columns because the source contains one individual's
57
+ single series.
58
+
59
+ ## Conversion notes
60
+
61
+ - ISO-8601 timestamps are interpreted in UTC and represented losslessly as
62
+ integer milliseconds in Time; the original timestamp text is not duplicated
63
+ as a FIELD.
64
+ - All five measurements and all 291 rows are retained and sorted by Time.
65
+ - No demographic or additional subject information is inferred from the source.
66
+
67
+ ## Files and usage
68
+
69
+ - sleep_score_fitbit.tsfile
70
+
71
+ ~~~python
72
+ from pathlib import Path
73
+ from tsfile import TsFileReader
74
+
75
+ path = Path("sleep_score_fitbit.tsfile")
76
+ with TsFileReader(str(path)) as reader:
77
+ table_name = next(iter(reader.get_all_table_schemas()))
78
+ with reader.query_table(table_name, ["overall_score", "restlessness"], batch_size=512) as result:
79
+ batch = result.read_arrow_batch()
80
+ if batch is not None:
81
+ print(batch.to_pandas().head())
82
+ ~~~
83
+
84
+ ## License and attribution
85
+
86
+ The source dataset is released under the MIT license. Please respect the
87
+ source card's privacy and ethical-use notes for this single-person case study.
88
+ See the [original dataset card](https://huggingface.co/datasets/aai530-group6/sleep-score-fitbit).
89
+
90
+ ## Usage
91
+
92
+ Install the Apache TsFile Python SDK (`pip install tsfile`) and read a converted file:
93
+
94
+ ```python
95
+ from pathlib import Path
96
+ from tsfile import TsFileReader
97
+
98
+ path = Path("sleep_score_fitbit.tsfile")
99
+ with TsFileReader(str(path)) as reader:
100
+ schemas = reader.get_all_table_schemas()
101
+ print("tables:", list(schemas))
102
+ table_name = next(iter(schemas))
103
+ table = schemas[table_name]
104
+ columns = [column.get_column_name() for column in table.get_columns()]
105
+ print("columns:", columns)
106
+ field_names = [
107
+ column.get_column_name()
108
+ for column in table.get_columns()
109
+ if column.get_column_name() not in {"Time", "time"}
110
+ ]
111
+ if field_names:
112
+ with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
113
+ batch = result.read_arrow_batch()
114
+ if batch is not None:
115
+ print(batch.to_pandas().head())
116
+ ```
sleep_score_fitbit.tsfile ADDED
Binary file (5.3 kB). View file