Home

Awesome

ER board

Aggregate ER state liveboard

CC0 1.0 Universal

To the extent possible under law, Chia-liang Kao has waived all copyright and related or neighboring rights to hackfoldr.

This work is published from Taiwan.
http://creativecommons.org/publicdomain/zero/1.0

Overview

this project contains three parts:

Install influxdb

  1. we suggest to use v0.8.3(git:fbf9a47) influxdb (this repo built on it, if you use newest version, please check the update information.)
  2. Continuous Query: write a Query select * from ER into ER.[hospital_sn] after your database created.

Install crawlers

dependencies

submodules

Running

Please make sure you already installed influxdb and crawlers.

  1. Create a backup directory to save backup.
  2. Choice a Task runner to grab data from submodule:
# For nodejs runner
$ node twer.js twer.csv --influxHost [yourHost] --influxDb [yourdatabase] --influxUser [youraccount] --influxPass [yourpass] > temp && ./backup.sh

# For python3 runner
$ python3 runner.py twer.csv -host [yourHost] -db [yourdatabase] -user [youraccount] -pass [yourpassword] > temp && ./backup.sh

Notice:

grafana frontend website

Other usages

Purify backup files.

python3 clerify.py [--dir <dir path>] [--output <output filename>]

The default dir is backup, and output name is dataset.json. it be fixed to dump a json file, so you don't need add .json.

Dataset scheme

for the raw backup file, will be named as "yyyy-mm-dd_HH-MM", for the <date> below, means yyyy-mm-dd, and <timestamp> means file name to be parse to timestamp.

[{
  "<date>": {
    "<timestamp>": {"<each hospital data as a pydict>"},
  }
}]

Add/update parser

  1. write down new parser in gist.
  2. insert new row into twer.csv
  3. execute runner command:
# update one 
$ node twer.js twer.csv --update --only <hospital_sn>
$ python3 runner.py twer.csv --update --only <hospital_sn>
# or update all
$ node twer.js twer.csv --update
$ python3 runner.py twer.csv --update

influx-db docker images wtih usages

  1. docker pull t0mst0ne/influx-er
  2. sudo docker run --restart=always -d -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 -v /somewhere/data:/data t0mst0ne/influx-er
  3. edit crontab with the following lines , assume the repo er.mohw was at /somewhere/
  4. */20 * * * * cd /somewhere/er.mohw && /usr/bin/node /somewhere/er.mohw/twer.js /somewhere/er.mohw/twer.csv --influxHost x.x.x.x (ip address) --influxDb twer --influxUser guest --influxPass guest > temp && ./backup.sh