Ainda Package made for python lovers. This is inteded to be used on ainda private cloud
Project description
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file aindapy-0.0.14-py3-none-any.whl
.
File metadata
- Download URL: aindapy-0.0.14-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b502296942f86ac8915130c0d04409fd4dd00e6b3cd76e33df52c753fa4c528a |
|
MD5 | 1b0a84527a12a166e3c028a61ca11f20 |
|
BLAKE2b-256 | 3e9fb2c9820f0e28a20b955476d3ab3686bad3220fd14698b3502cf1f2c8c478 |