Skip to content

IoT sensor readings

Sensor readings with coordinates, numeric ranges and a timestamp.

simple volume small IoTEvents
Languages
eng
Formats
csv

Recipe

recipe.gbddl
gbddl 1
language eng

table iot_readings rows 30 (
  id          int64 autoincrement primarykey
  sensor_id   uuid unique uuid()
  latitude    float64 latitude()
  longitude   float64 longitude()
  temperature decimal(6, 2) decimal(min: -30, max: 50)
  humidity    decimal(5, 2) decimal(min: 0, max: 100)
  pressure    float64 decimal(min: 900, max: 1100, precision: 2)
  battery     int64 integer(min: 0, max: 100)
  read_at     timestamp datetime(min: "2024-01-01 00:00:00", max: "2024-06-30 23:59:59")
)

output csv

This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.

About this recipe

IoT readings

A single-table recipe that generates sensor readings: a unique sensor id, coordinates, numeric ranges and a timestamp.

What it demonstrates

  • Identity — sensor_id is a uuid written to a uuid column, unique per row.
  • Location — latitude and longitude give the reading's coordinates.
  • Measurements — temperature, humidity and pressure are decimal ranges, and battery an integer range.
  • Timestamp — read_at is a bounded timestamp.

Run it

Submit the recipe body to POST /api/v1/jobs?input_format=gbddl, or paste it into Chef, to generate the data. The repository's local runner (run by task test) also generates it and verifies its output.

The recipe outputs one CSV table file, iot_readings.csv, holding thirty rows.

Adapt it

  • Raise rows for a longer stream of readings.
  • Narrow the decimal ranges to a specific sensor class.

Guarantees

Every row has a unique id and sensor_id; numeric values stay inside the declared ranges. Readings are synthetic.

Tested features

Smart types, physical types, rules and formats this recipe exercises and verifies.

uuidlatitudelongitudedecimalintegerdatetimeuniqueautoincrementprimary-key