You want to populate your Predix Time Series instance with some sample / test data. If you don't already have sample data in a file you may need to generate some random data.
Python can be helpful for this sort of quick and dirty task.
(1) Install the Predix Python SDK
If you don't already have PredixPy, install it with pip
. More instructions can be found from the PredixPy Github Repository.
(2) Create a UAA and Time Series Instance
Perhaps you already have instances, but if not the Predix Python SDK can help create them.
import predix.admin.app
admin = predix.admin.app.Manifest()
admin.create_uaa(uaa_secret)
admin.create_client(client_id, client_secret)
admin.create_timeseries()
(3) Generate a random value
There are many ways to generate a random number in Python and make it fit within the parameters you are looking for. If you'd like to add more examples that are useful I'd like to see them. Once you have your random value, then you can simply send it to Time Series in the way that makes sense for your application testing.
import time
import random
import predix.app
min_voltage = 200
max_voltage = 240
hertz = 1.0/1.0
app = predix.app.Manifest()
ts = app.get_timeseries()
while True:
try:
# Generate a random voltage value simulated from multiple sensors
# and queue them up.
for tag in ['Voltage:Sensor1', 'Voltage:Sensor2', 'Voltage:Sensor3']:
value = random.randint(min_voltage, max_voltage)
ts.queue(tag, value)
print(tag, value)
# Send readings from all 3 sensors to Time Series and then wait to
# take another reading.
ts.send()
time.sleep(hertz)
except KeyboardInterrupt:
# Provide evidence data was being stored before exiting
print(ts.get_tags())
break
To use this you need
Predix Python SDK
Time Series Instance with UAA Client Scopes/Authorities
If you find something to be missing, comment or let me know.
Useful resources
PredixPy Cookbook
Github Repository
How-To: Specify a Python Version for Your App
How-To: Analytics Framework Workflow Automation Using Python --- Single Analytic Management
How-To: Deploy a Python App on Predix in under 10 minutes!
How-To Use Python to Remove or Modify Empty Values in a CSV Dataset
How-to: Deploy a python app on predix consisting of more than one or multiple python (.py) files.
How-To: Specify a Python Buildpack
How-To: Include Your Own Private Python Libraries in Your App
How-To: Use redis-cli, psql and python from gotty in the Predix Cloud