Skip to content

Data model

Storage

  • File: rainlog.sqlite (constant DEFAULT_DB_FILE_NAME in rainlog)
  • Default location: ~/.local/share/rainlog/rainlog.sqlite (constant DEFAULT_DB_DIR)
  • Override: rainlog --db-dir <path> puts the file in the given directory.
  • Engine: SQLite3, table created automatically:
CREATE TABLE IF NOT EXISTS rain_daily (
  date INT NOT NULL UNIQUE PRIMARY KEY,
  rain REAL
)
  • date column: Unix timestamp (seconds) for the end of the 24-hour period, normalised to 09:00:00 local time (i.e. the reading covers the 24 h ending at 09:00 on the stored calendar day).
  • rain column: Millimetres (mm).

Semantics

  • One row per logical day (unique date bucket).
  • get_rain aggregates raw rows by GraphGrouping (daily, weekly, monthly, yearly, annually) for the TUI chart.
  • get_moisture_index computes an exponentially decaying moving sum used in soil-moisture chart mode.

Time zone

Bucket boundaries use the host's local time zone at runtime (LOCAL_TZ in rainlog).

See also