THUgewu commited on
Commit
59575d1
·
verified ·
1 Parent(s): 632f0e5

Copy from wangdx25/random_iot_sensor_readings

Browse files
Files changed (2) hide show
  1. README.md +90 -0
  2. random_iot_sensor_readings.tsfile +0 -0
README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - time-series-forecasting
5
+ tags:
6
+ - tsfile
7
+ - timeseries
8
+ - time-series
9
+ - synthetic
10
+ - random
11
+ - test-data
12
+ - format:tsfile
13
+ pretty_name: Random IoT Sensor Readings (TsFile)
14
+ configs:
15
+ - config_name: default
16
+ data_files:
17
+ - split: train
18
+ path: random_iot_sensor_readings.tsfile
19
+ ---
20
+
21
+ # Random IoT Sensor Readings (TsFile)
22
+
23
+ Apache TsFile version of [`anis-mselmi/random-iot-sensor-readings`](https://huggingface.co/datasets/anis-mselmi/random-iot-sensor-readings).
24
+
25
+ ## Overview
26
+
27
+ 8,000 synthetic minute-level IoT sensor readings (temperature, humidity, pressure, status). Purely random, for testing.
28
+
29
+ - **Tables:** 1 TsFile table(s), 8,000 rows in total.
30
+ - `random_iot_sensor_readings`: 8,000 rows, 2025-01-01 00:00:00 鈫?2025-01-06 13:19:00 (UTC)
31
+
32
+ ## Schema (TsFile structure)
33
+
34
+ ### `random_iot_sensor_readings.tsfile`
35
+
36
+ - **Time** (INT64, milliseconds) 鈥?the source `timestamp` column.
37
+ - **TAG**: none 鈥?the table is stored as a single device.
38
+ - **FIELD** (5): `sensor_id` (string), `temperature_c` (double), `humidity_pct` (double), `pressure_hpa` (double), `status` (string)
39
+
40
+ ## Conversion notes
41
+
42
+ - One TsFile per source table (1 tables). Tables whose source carries several entities per file are stored as one device per entity.
43
+ - Time = the table's own clock column as INT64 milliseconds. The clock columns used here are `timestamp`.
44
+ - No column is dropped. Rows that share a timestamp inside one device are ordered by a 1 ms step in stable source order, so calendar columns keep their exact day.
45
+
46
+ ## Usage
47
+
48
+ > **Read this dataset with the Java SDK.** It is written with the `zstd` compressor. The Apache TsFile Java SDK reads every compressor, but the Python SDK (`pip install tsfile`) implements only `UNCOMPRESSED`, `SNAPPY`, `GZIP` and `LZ4`; opening this file with it yields no rows.
49
+
50
+ Read a converted file with the Apache TsFile Java SDK (`org.apache.tsfile:tsfile`):
51
+
52
+ ```java
53
+ import org.apache.tsfile.file.metadata.IDeviceID;
54
+ import org.apache.tsfile.read.TsFileReader;
55
+ import org.apache.tsfile.read.TsFileSequenceReader;
56
+ import org.apache.tsfile.read.common.Path;
57
+ import org.apache.tsfile.read.expression.QueryExpression;
58
+ import org.apache.tsfile.read.query.dataset.QueryDataSet;
59
+ import org.apache.tsfile.write.schema.MeasurementSchema;
60
+
61
+ import java.util.ArrayList;
62
+ import java.util.List;
63
+
64
+ String path = "random_iot_sensor_readings.tsfile";
65
+ try (TsFileSequenceReader sequenceReader = new TsFileSequenceReader(path);
66
+ TsFileReader reader = new TsFileReader(sequenceReader)) {
67
+ // Devices are enumerated as IDeviceID objects. Tables with TAG columns
68
+ // have multi-segment device ids that cannot be rebuilt from their string
69
+ // form, so always use getAllDevices() rather than getAllDeviceIds().
70
+ for (IDeviceID device : sequenceReader.getAllDevices()) {
71
+ List<Path> paths = new ArrayList<>();
72
+ for (MeasurementSchema schema : reader.getMeasurement(device)) {
73
+ String name = schema.getMeasurementName();
74
+ if (name != null && !name.isEmpty() && !name.equalsIgnoreCase("Time")) {
75
+ paths.add(new Path(device, name, true));
76
+ }
77
+ }
78
+ QueryDataSet dataSet = reader.query(QueryExpression.create(paths, null));
79
+ while (dataSet.hasNext()) {
80
+ System.out.println(dataSet.next());
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## Source & license
87
+
88
+ - Original dataset: [`anis-mselmi/random-iot-sensor-readings`](https://huggingface.co/datasets/anis-mselmi/random-iot-sensor-readings)
89
+ - Source card title: Random IoT Sensor Readings
90
+ - License: mit (as declared by the original dataset).
random_iot_sensor_readings.tsfile ADDED
Binary file (80.6 kB). View file