aindapy 0.0.14

Creator: codyrutscher

Last updated:

0 purchases

aindapy 0.0.14 Image
aindapy 0.0.14 Images

Languages

Categories

Add to Cart

Description:

aindapy 0.0.14

import aindapy
import random
import time
import json
import datetime
from numpy.core.numeric import _correlate_dispatcher
import logging
import http.client as http_client
http_client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
aindapy.config(logLevel=1)
auth = aindapy.Auth(
apiUrl='https://aindaanalytics.com/ainda/api/',
userName='asdfasdfasdfsdfsdf',
passWord='asdfasdfsdf'
)
The datasource now accepts only the ids, so pls check what is the correct id for it.
Demo WareHouse dataWareHouseId=7, dataSourceId=20
Ainda Packaging Line WareHouse dataWareHouseId=8, dataSourceId=22
dataSource = aindapy.DataSource(
auth=auth,
dataWareHouseId=7,
dataSourceId=20
)
Generate Data for graphics that are not timeseries
data = aindapy.Data(auth=auth, dataSource=dataSource, bufferSize=1000)
Generate Data Sample for pie
data.deleteDataKeys([
'basicdemo/pie1',
'basicdemo/pie2',
'basicdemo/bar1',
'basicdemo/bar2',
'basicdemo/bar10Columns',
'basicdemo/bar50Columns',
'basicdemo/scaleline250points',
'basicdemo/scaleline500points'
])
data.addToBuffer('basicdemo/pie1', random.randint(50, 150), 'Ilha 1')
data.addToBuffer('basicdemo/pie1', random.randint(70, 180), 'Ilha 2')
data.addToBuffer('basicdemo/pie1', random.randint(10, 75), 'Ilha 3')
data.addToBuffer('basicdemo/pie1', random.randint(25, 45), 'Ilha 4')
data.addToBuffer('basicdemo/pie2', random.randint(50, 150), 'Ilha 1')
data.addToBuffer('basicdemo/pie2', random.randint(70, 180), 'Ilha 2')
data.addToBuffer('basicdemo/pie2', random.randint(10, 75), 'Ilha 3')
data.addToBuffer('basicdemo/pie2', random.randint(25, 45), 'Ilha 4')
data.addToBuffer('basicdemo/pie2', random.randint(25, 45), 'Ilha 4')
data.addToBuffer('basicdemo/pie2', random.randint(25, 45), 'Ilha 4')
data.addToBuffer('basicdemo/pie2', random.randint(25, 45), 'Ilha 4')
Generate Data Sample for one bar graphic with 10 columns
for step in range(10):
data.addToBuffer('basicdemo/bar10Columns', random.randint(50, 150), step)
Generate Data Sample for one bar graphic with 50 columns
for step in range(50):
data.addToBuffer('basicdemo/bar50Columns', random.randint(50, 150), step)
Generate Data Sample for line
for step in range(250):
data.addToBuffer('basicdemo/scaleline250points',
random.randint(50, 150), step)
for step in range(500):
data.addToBuffer('basicdemo/scaleline500points',
random.randint(50, 150), step)
data.commit()
Generate data for one timeseries datatag. This data we can not deleted what was added before
If the tag do not exist, the code create this tag inside our system.
stag1 = aindapy.SensorTag(auth=auth, dataSource=dataSource, channel='1', datatag='XRND1', tag='Random Value 1', tag_unit='KG', tag_updaterate=1000)
stag2 = aindapy.SensorTag(auth=auth, dataSource=dataSource, channel='1', datatag='XRND2', tag='Random Value 2', tag_unit='KG', tag_updaterate=1000)
tdata = aindapy.DataTimeSeries(auth=auth, dataSource=dataSource, bufferSize=1000)
for step in range(10000):
tdata.addToBuffer(sensorTag=stag1, timeStamp=datetime.datetime.now(), value=random.randint(45,90))
# if you do not pass timestamp, we will generate internaly
tdata.addToBuffer(sensorTag=stag2, value=random.randint(45,90))

tdata.commit()

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.