The dataset is currently empty. Upload or create new data files. Then, you will be able to explore them in the Dataset Viewer.
Flock Demo Glucose Time-Series — TsFile 格式
本仓库是 HuggingFace 数据集
random-sequence/flock-demo-time-series-prediction-sections
转换为 TsFile 格式的版本。
⚠️ 这是一个演示(demo)数据集:模拟的患者血糖 / 胰岛素 / 碳水 / 活动监测时序, 并非真实临床数据。
- 原始数据集:random-sequence/flock-demo-time-series-prediction-sections
- 许可证:原数据集未声明 license(本转换版本沿用,未额外声明)。
- 原始 README:仅含字段定义(YAML frontmatter),无正文描述。下文的数据语义说明 来自对实际数据的检视。
数据内容
模拟 10 位患者的连续监测记录,5 分钟一个采样点。原数据集按时间切成 8 个 section
(section_01 … section_08,各是 HuggingFace 的一个 config),8 段在时间上首尾相接、连续无重叠:
| section | 行数 | 患者数 | 时间范围 |
|---|---|---|---|
| section_01 | 250 | 10 | 2024-01-01 00:00 → 2024-01-01 20:45 |
| section_02 | 250 | 10 | 2024-01-01 20:50 → 2024-01-02 17:35 |
| section_03 | 250 | 10 | 2024-01-02 17:40 → 2024-01-03 14:25 |
| section_04 | 250 | 10 | 2024-01-03 14:30 → 2024-01-04 11:15 |
| section_05 | 250 | 10 | 2024-01-04 11:20 → 2024-01-05 08:05 |
| section_06 | 250 | 10 | 2024-01-05 08:10 → 2024-01-06 04:55 |
| section_07 | 250 | 10 | 2024-01-06 05:00 → 2024-01-07 01:45 |
| section_08 | 250 | 10 | 2024-01-07 01:50 → 2024-01-07 22:35 |
每个 section 内:全局 timestamp 唯一且单调递增,10 位患者交错出现;按患者看, 每位患者自己的记录在时间上也是单调递增、无重复。
文件(一个 section 对应一个 TsFile)
section_01.tsfile … section_08.tsfile,与原数据集的 8 个 config 一一对应,不合并。
TsFile 结构
- **TAG(device 维度)=
patient_id**:以患者为设备。每位患者内 timestamp 单调、无重复。 - Time:由原始
timestamp(2024-01-01 00:00:00文本,5 分钟间隔)解析为 INT64 毫秒。 - FIELD:
glucose_mg_dl(DOUBLE,血糖 mg/dL)insulin_units(DOUBLE,胰岛素单位)carbs_grams(DOUBLE,碳水克数)activity_level(STRING,活动等级:rest / light / moderate / intense)
相比原数据集做了哪些改变
| 项 | 原数据集 | 本 TsFile 版本 | 说明 |
|---|---|---|---|
| 格式 | Parquet(8 个 config) | TsFile(8 个 .tsfile) | 一个 section 对一个 TsFile,保持原切分结构 |
timestamp 列 |
string(2024-01-01 00:00:00) |
解析为 Time(INT64 毫秒)后丢弃原文本列 |
时间信息完整保留,仅格式由字符串变毫秒整数 |
patient_id |
int64 普通字段 | 声明为 TAG(device),TsFile 中以 STRING 存储 | TsFile 表模型中 TAG 列统一为 STRING;整数值原样保留(1 → "1") |
| 其余列 | — | 原样保留 | glucose_mg_dl / insulin_units / carbs_grams → DOUBLE,activity_level → STRING |
| 行内顺序 | 按全局时间 | 按 (patient_id, Time) 排序 | 保证每个 device 内时间单调,满足 TsFile 写入要求 |
唯一被丢弃的列:原始 timestamp 文本列(信息已并入 Time)。除此之外不丢弃任何列、不改任何数值。
读取示例
from tsfile import TsFileReader
reader = TsFileReader("section_01.tsfile")
for name, schema in reader.get_all_table_schemas().items():
print(name, [c.get_column_name() for c in schema.get_columns()])
- Downloads last month
- 47