//
// lifelog - A simple Life-logging tool
//
// 13 Jan, 2019 by FUJIWARA Teruyoshi <tf@dsl.gr.jp>
//
// This simple Node.js app logs a daily figure for something via web interface.

//
// 1. Caution
//
This tool has no authentication functionality. Please use it only internally in your private network.

//
// 2. Requirement
//
Node.js and npm

//
// 3. Installation & Run
//

1. Run the following command.

> npm install express ejs sqlite3 date-utils body-parser csv --save

2. Initialize a database

> node db_init.js

3. Set e-mail address for report

Edit mail_send.sh and set up your e-mail address in the script.

4. Add a crontab entry
You might need to change the path depending on your installation.

15 2 * * 0 /home/pi/work/lifelog/update_dl.sh > /dev/null 2>&1

5. Run the server

> npm start

6. Access the server

Access http://localhost:8000 with your web browser.

7. Log your life and enjoy!

//
// 4. Supporting tools
//

// db_dump.js

> node db_dump.js > backup.csv

// db_import.js

> node db_import.js input.csv

//
// Visualization using Gnuplot
//
> update_dl.sh

This script makes a PNG image of the time-series data (and a database dump).
