diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2019-11-21 20:14:15 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2019-11-21 20:14:15 +0200 |
| commit | 18c52de216229ece8433a979abfcc28c9480a895 (patch) | |
| tree | afb12fafdd668aaa671a7c828361771eda1a2c91 | |
| parent | 716ded259615b5517bbed2a8c69b5879dbab4fee (diff) | |
| download | weather-18c52de216229ece8433a979abfcc28c9480a895.tar.gz weather-18c52de216229ece8433a979abfcc28c9480a895.zip | |
Documentation
| -rw-r--r-- | src/create_database.nim | 22 | ||||
| -rw-r--r-- | src/update_database.nim | 10 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/create_database.nim b/src/create_database.nim index f210c6f..82f473c 100644 --- a/src/create_database.nim +++ b/src/create_database.nim @@ -1,14 +1,24 @@ +## RRD database creation tool. +## +## The database will store the following data: +## +## - 1 year worth of samples each 15 minutes +## - average of each day for 10 years +## - min of each day for 10 years +## - max of each day for 10 years +## +## The data contained in the database is +## +## - temperature +## - relative humidity +## - pressure +## - battery voltage + import os import osproc import strformat import strutils -# This database will store the following data -# - 1 year worth of samples each 15 minutes -# - average of each day for 10 years -# - min of each day for 10 years -# - max of each day for 10 years - let database = getAppDir().parentDir() / "database" / paramStr(1) & ".rrd" step = 15 * 60 diff --git a/src/update_database.nim b/src/update_database.nim index a5e5078..2c2c7e3 100644 --- a/src/update_database.nim +++ b/src/update_database.nim @@ -19,15 +19,13 @@ ## The program should be run with an accompanying CGI script as the main driver. The web server will ## execute the script which looks like this: ## -## #!/path/to/update_database -## databaseDir = /path/to/where/databases/are -## -## This will execute update_database with one argument: the path to this script file. -## update_database will read this script and parse it as a configuration file. The databaseDir -## option should point to where the .rrd databases are stored. +## #!/bin/sh +## /path/to/update_database ## ## The update_database program will use the ``alias`` from measurements as the database name (with ## ``.rrd`` extension). +## +## Databases are found relative to this executable, from ``../database``. import json import os |
