Skip to main content

"Bridgestone World Solar Challenge Influx Tools"

Project description

WSC Influx Tools

This project is in aid of the Bridgestone World Solar Challenge.

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.

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)

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.

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:

,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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wsc_influx_tools-2023.1.0.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

wsc_influx_tools-2023.1.0-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page