# WSC Influx Tools
This project is in aid of the [Bridgestone World Solar Challenge](https://www.worldsolarchallenge.org/).
This is a python module which provides several CLI tools for interacting with the event's influx database.
## Installing wsc-influx-tools
wsc-influx-tools is a python package. THis has been tested on Linux and Mac (using Python 3.11).
Let us know if there are any issues. It can be installed using `pip`.
```bash
pip install wsc-influx-tools
```
The commands have useful help
```
$ wsc-influx-send-data --help
usage: wsc-influx-send-data [-h] [--config CONFIG] [--url URL] [--bucket BUCKET] [--org ORG]
[--token TOKEN] [--debug] [--quiet] [--dryrun] [--input INPUT]
```
## Writing data to influx
wsc-influx-tools provides a tool to send line format to an Influx V2 database from the CLI,
given a URL and a token.
Note that many of hte fields included below are overwritten (e.g. car name, team number, etc.)
Note that the precision used for the timestamp at the end of the line is nanoseconds (i.e. seconds * 1000000000)
```bash
wsc-influx-send-data --url https://telemetry.worldsolarchallenge.org/test/ingest/michigan --token TOKEN_GOES_HERE << EOF
telemetry,event=BWSC2023,class=Cruiser,team=World\ Solar\ Challenge\ Faculty,car=Solar\ Wombat\ 3,shortname=WSC\ Faculty longitude=135.26007,latitude=-30.24246,altitude=187.3,distance=432162,solarEnergy=20914846,batteryEnergy=52278368 1697461695000000000
EOF
```
## Reading data from Influx
For testing purposes, teams are provided with access to the InfluxDB V3 bucket to which their
data is written. The line format, written above, can be downloaded as CSV using the below command:
By default the wsc-influx-get-data command will query the last day's data from the given
measurement in the given bucket.
```bash
wsc-influx-get-data \
--bucket test-teamdata \
--measurement teamdata \
--format=csv \
--token TOKEN_GOES_HERE
```
The above results in a CSV output on the command line:
```bash
,iox::measurement,time,altitude,batteryEnergy,car,class,distance,escapedname,event,host,latitude,longitude,shortname,solarEnergy,team,teamnum
0,teamdata,2023-10-16 13:08:15,187.3,52278368.0,Astrum,Challenger,432162.0,michigan,BWSC2023,telegraf-deployment-michigan-6c497bc786-f4xdg,-30.24246,135.26007,Michigan,20914846.0,University of Michigan Solar Car Team,2
```
Copyright 2021-2023 David Snowdon
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Raw data
{
"_id": null,
"home_page": "https://github.com/worldsolarchallenge/wsc-influx-tools",
"name": "wsc-influx-tools",
"maintainer": "\"David Snowdon\"",
"docs_url": null,
"requires_python": "",
"maintainer_email": "\"pypi@snowdon.id.au\"",
"keywords": "pytest,eos",
"author": "\"David Snowdon\"",
"author_email": "\"pypi@snowdon.id.au\"",
"download_url": "https://files.pythonhosted.org/packages/3b/63/3e5d8d9bda867768678c4dc2e4ffffaa7a9f90987844de3a20dcd6d72d0b/wsc_influx_tools-2023.1.0.tar.gz",
"platform": null,
"description": "# WSC Influx Tools\n\nThis project is in aid of the [Bridgestone World Solar Challenge](https://www.worldsolarchallenge.org/).\n\nThis is a python module which provides several CLI tools for interacting with the event's influx database.\n\n## Installing wsc-influx-tools\n\nwsc-influx-tools is a python package. THis has been tested on Linux and Mac (using Python 3.11).\nLet us know if there are any issues. It can be installed using `pip`.\n```bash\npip install wsc-influx-tools\n```\n\nThe commands have useful help\n```\n$ wsc-influx-send-data --help\nusage: wsc-influx-send-data [-h] [--config CONFIG] [--url URL] [--bucket BUCKET] [--org ORG]\n [--token TOKEN] [--debug] [--quiet] [--dryrun] [--input INPUT]\n```\n\n## Writing data to influx\n\nwsc-influx-tools provides a tool to send line format to an Influx V2 database from the CLI,\ngiven a URL and a token.\n\nNote that many of hte fields included below are overwritten (e.g. car name, team number, etc.)\n\nNote that the precision used for the timestamp at the end of the line is nanoseconds (i.e. seconds * 1000000000)\n\n```bash\nwsc-influx-send-data --url https://telemetry.worldsolarchallenge.org/test/ingest/michigan --token TOKEN_GOES_HERE << EOF\ntelemetry,event=BWSC2023,class=Cruiser,team=World\\ Solar\\ Challenge\\ Faculty,car=Solar\\ Wombat\\ 3,shortname=WSC\\ Faculty longitude=135.26007,latitude=-30.24246,altitude=187.3,distance=432162,solarEnergy=20914846,batteryEnergy=52278368 1697461695000000000\nEOF\n```\n\n## Reading data from Influx\n\nFor testing purposes, teams are provided with access to the InfluxDB V3 bucket to which their\ndata is written. The line format, written above, can be downloaded as CSV using the below command:\n\nBy default the wsc-influx-get-data command will query the last day's data from the given\nmeasurement in the given bucket.\n\n```bash\nwsc-influx-get-data \\\n --bucket test-teamdata \\\n --measurement teamdata \\\n --format=csv \\\n --token TOKEN_GOES_HERE\n```\n\nThe above results in a CSV output on the command line:\n```bash\n,iox::measurement,time,altitude,batteryEnergy,car,class,distance,escapedname,event,host,latitude,longitude,shortname,solarEnergy,team,teamnum\n0,teamdata,2023-10-16 13:08:15,187.3,52278368.0,Astrum,Challenger,432162.0,michigan,BWSC2023,telegraf-deployment-michigan-6c497bc786-f4xdg,-30.24246,135.26007,Michigan,20914846.0,University of Michigan Solar Car Team,2\n```\n\nCopyright 2021-2023 David Snowdon\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
"bugtrack_url": null,
"license": "\"BSD 3-Clause License\"",
"summary": "\"Bridgestone World Solar Challenge Influx Tools\"",
"version": "2023.1.0",
"project_urls": {
"Documentation": "https://github.com/worldsolarchallenge/wsc-influx-tools",
"Homepage": "https://github.com/worldsolarchallenge/wsc-influx-tools",
"Source": "https://github.com/worldsolarchallenge/wsc-influx-tools",
"Tracker": "https://github.com/worldsolarchallenge/wsc-influx-tools/issues"
},
"split_keywords": [
"pytest",
"eos"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f817999fbce61ce733db09c363de74a86a0d37471ff33520c0e4ad4b4636d1f9",
"md5": "300631b6c9ff0d97cafe8a5ee5d833f8",
"sha256": "20dfa991b6cb7ae0c2fb4f6bba86a94895ffd80b5ddcc97a16ee1ce1f13a328d"
},
"downloads": -1,
"filename": "wsc_influx_tools-2023.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "300631b6c9ff0d97cafe8a5ee5d833f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6854,
"upload_time": "2023-10-18T13:59:38",
"upload_time_iso_8601": "2023-10-18T13:59:38.723767Z",
"url": "https://files.pythonhosted.org/packages/f8/17/999fbce61ce733db09c363de74a86a0d37471ff33520c0e4ad4b4636d1f9/wsc_influx_tools-2023.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b633e5d8d9bda867768678c4dc2e4ffffaa7a9f90987844de3a20dcd6d72d0b",
"md5": "65a22bd71cb22e9ebc1a5ca8c6b3ae22",
"sha256": "cf7938d7cccaa03fd8e83a47bcf3a1c9f8db4378962d416360a2b88891ca3bb6"
},
"downloads": -1,
"filename": "wsc_influx_tools-2023.1.0.tar.gz",
"has_sig": false,
"md5_digest": "65a22bd71cb22e9ebc1a5ca8c6b3ae22",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10788,
"upload_time": "2023-10-18T13:59:40",
"upload_time_iso_8601": "2023-10-18T13:59:40.289019Z",
"url": "https://files.pythonhosted.org/packages/3b/63/3e5d8d9bda867768678c4dc2e4ffffaa7a9f90987844de3a20dcd6d72d0b/wsc_influx_tools-2023.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-18 13:59:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "worldsolarchallenge",
"github_project": "wsc-influx-tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "wsc-influx-tools"
}