run.py
def Retrieve_per_day():
    """
    Post call to retrieve data for a day for a device per user input
    """
    #retrieve the json from the ajax call
    jsonFile = ''
    if request.method == 'POST':
        jsonFile = request.json
        print ("post request", file=sys.stderr)

    #if jsonFile successfully posted..
    if jsonFile != '':
        # check all required arguments are present:
        if not all(arg in jsonFile for arg in ["deviceId","date"]):
            print("Missing arguments in post request", file=sys.stderr)
            return json.dumps({"status":"Error", "messages":"Missing arguments"}), 422
        inputDeviceId = jsonFile["deviceId"]
        inputDate = jsonFile["date"]
        print("retreived data: " + str(inputDeviceId) + " | " + str(inputDate), file=sys.stderr)

    #get data for device fields per day
    dataArray = plotdata.Device_data_per_day(inputDeviceId, inputDate)
    print("after func call", file=sys.stderr)
    #create and return the output json
    output = {"dataArray": dataArray, "deviceId": inputDeviceId, "date" : inputDate}
    return json.dumps(output)

    Post call to retrieve data for a day for a device per user input
    
Post call to retrieve data for a day for a device per user input
Post call to retrieve data for a day for a device per user input
def Retrieve_per_day():
    jsonFile = ''
    if request.method == 'POST':
        jsonFile = request.json
        print ("post request", file=sys.stderr)
    if jsonFile != '':
        if not all(arg in jsonFile for arg in ["deviceId","date"]):
            print("Missing arguments in post request", file=sys.stderr)
            return json.dumps({"status":"Error", "messages":"Missing arguments"}), 422
        inputDeviceId = jsonFile["deviceId"]
        inputDate = jsonFile["date"]
        print("retreived data: " + str(inputDeviceId) + " | " + str(inputDate), file=sys.stderr)
    dataArray = plotdata.Device_data_per_day(inputDeviceId, inputDate)
    print("after func call", file=sys.stderr)
    output = {"dataArray": dataArray, "deviceId": inputDeviceId, "date" : inputDate}
    return json.dumps(output)
def Retrieve_per_day ( ) : jsonFile = '' if request . method == 'POST' : jsonFile = request . json print ( "post request" , file = sys . stderr ) if jsonFile != '' : if not all ( arg in jsonFile for arg in [ "deviceId" , "date" ] ) : print ( "Missing arguments in post request" , file = sys . stderr ) return json . dumps ( { "status" : "Error" , "messages" : "Missing arguments" } ) , 422 inputDeviceId = jsonFile [ "deviceId" ] inputDate = jsonFile [ "date" ] print ( "retreived data: " + str ( inputDeviceId ) + " | " + str ( inputDate ) , file = sys . stderr ) dataArray = plotdata . Device_data_per_day ( inputDeviceId , inputDate ) print ( "after func call" , file = sys . stderr ) output = { "dataArray" : dataArray , "deviceId" : inputDeviceId , "date" : inputDate } return json . dumps ( output )
Post call to retrieve data for a day for a device per user input
Post call to retrieve data for a day for a device per user input
"""
    Post call to retrieve data for a day for a device per user input
    """ #retrieve the json from the ajax call #if jsonFile successfully posted.. # check all required arguments are present: #get data for device fields per day #create and return the output json