Data model¶
Storage¶
- File:
rainlog.sqlite(constantDEFAULT_DB_FILE_NAMEinrainlog) - Default location:
~/.local/share/rainlog/rainlog.sqlite(constantDEFAULT_DB_DIR) - Override:
rainlog --db-dir <path>puts the file in the given directory. - Engine: SQLite3, table created automatically:
datecolumn: 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).raincolumn: Millimetres (mm).
Semantics¶
- One row per logical day (unique
datebucket). get_rainaggregates raw rows byGraphGrouping(daily,weekly,monthly,yearly,annually) for the TUI chart.get_moisture_indexcomputes an exponentially decaying moving sum used in soil-moisture chart mode.
Coverage convention¶
rainlog assumes every calendar day has an explicit record. A day with no rain is
stored as 0.0, not as a missing row. This complete-coverage invariant is what makes
streak detection, averages, and percentile comparisons meaningful.
The Back-fill zeros toggle in the Add Rain modal (on by default) enforces this: when
you log a reading after a gap, it automatically inserts 0.0 rows for every day between
the previous record and the new one. As long as you use backfill consistently, the
database stays complete.
Time zone¶
Bucket boundaries use the host's local time zone at runtime (LOCAL_TZ in rainlog).