OpenMTC/apps/csvInjector
aor-fokus 7c35afbb0c
Test debian stretch+python3 (#18)
* changes starting with python3 explicit

* removes python modules which are not available for python3

* exchanges fyzz query parsing with rdflib functionality

* fixes interop tests

* replaces reduce with for loop in nodb driver

* simple python2 -> python3 conversions

* adds changes for handling different string handling in python3

* test stretch building with travis

* installing python-setuptools in docker

* installing python-setuptools in docker

* changing python2 to python3 in docker makefiles

* changing python2 to python3 and some other test changes

* push docker only in master branche

* running version of openmtc

* fix some port problems

* porting path library completly now

* restoring travis.yml

* testing new travis.yml

* add sudo

* updating travis OS from trusty to xenial

* upgrade pip before

* show running docker logs

* show more logs

* for debugging

* showlogs of docker after failure

* testing new travis.yml

* finish travis.yml
2019-01-18 14:13:03 +01:00
..
bin Test debian stretch+python3 (#18) 2019-01-18 14:13:03 +01:00
docker Test debian stretch+python3 (#18) 2019-01-18 14:13:03 +01:00
etc add csv injector app 2018-04-05 14:08:27 +02:00
src/csvinjector Test debian stretch+python3 (#18) 2019-01-18 14:13:03 +01:00
config.json add csv injector app 2018-04-05 14:08:27 +02:00
MANIFEST.in add csv injector app 2018-04-05 14:08:27 +02:00
README.md add doc for csvInjector 2018-04-05 15:08:27 +02:00
setup-csvinjector.py Test debian stretch+python3 (#18) 2019-01-18 14:13:03 +01:00
utils.py Test debian stretch+python3 (#18) 2019-01-18 14:13:03 +01:00

Introduction

With this app you are able to integrate data of a csv file into OpenMTC. The csv file must have a column with a timestamp and one column with some kind of device id. You are able to configure the duration of the data injection. The timing of your csv will be scaled to that duration.

Getting started

To get an overview of the available parameters, just execute:

./apps/csv-injector --help

Configuration

The most important paramters are:

  • csv-path: Path to your csv file
  • device-classifier: The id of the column with the device ids
  • date-classifier: The id of the column with the timestamp
  • time-format: Format of your timestamp (example: %d/%m/%Y-%H:%M)
  • duration: time to inject the data (seconds)
  • repeat: repeat after full csv is injected (bool)

Example

If you have a csv like this at "~/test.csv":

Date,ID,Temp,Hum,Battery
23/01/2018-00:50,environment_1,13.3,41,100
18/02/2018-14:01,environment_2,20.4,46,0,99
02/03/2018-23:11,environment_1,19.1,14,100
03/03/2018-00:01,environment_2,19,13,100
08/03/2018-03:01,environment_1,19.5,26,0,99
08/03/2018-10:11,environment_2,21.9,29,0,100
09/03/2018-16:21,environment_1,21.4,27,0,99
09/03/2018-16:51,environment_1,21.3,27,0,100
16/03/2018-06:36,environment_2,15.1,36,0,100
20/03/2018-09:27,environment_1,18.9,19,0,100
20/03/2018-10:27,environment_1,20.3,20,0,99

The app could be started like this:

./apps/csv-injector \
    --csv-path "~/test.csv" \
    --device-classifier "ID" \
    --date-classifier "Date" \
    --time-format "%d/%m/%Y-%H:%M" \
    --duration 300
    --repeat 0