====Reading Historical Data==== ARDI uses its own query language named AQL to ask for information. The **GETHISTORY** function in AQL gets the history for one or more points of data. But these individual data points will often have different time-stamps, update rates and be a bit scattered. Trying to figure out exactly what the state of the system was at any given time can be challenging. Using Pandas and the [[AQLQuery_Execute_DF|Execute_DF]] function, Python will process your data to provide it as a single, [[complete dataframe]]. ===Creating a Query=== Once you're connected to the ARDI server, you'll need to create an AQLQuery query = ardi.AQLQuery(server) ===Executing the Query=== You execute the query using the [[AQLQuery_Execute_DF|Execute_DF]] function, passing the actual AQL query you'd like to run. The response comes back as a Pandas dataframe, with each column being named after each asset/property combination found. frame = query.Execute_DF("'Closest Support' PROPERTY ALLPOINTS {\"range\": \"6 hours\"} GETHISTORY") ===Process the Response=== The index of your dataframe is //time//. You'll have one column for each point in the query, each named for the asset and property found. For example an asset called //Main Pump// with a //Temperature// measurement on it would be called "Main Pump.Temperature" in the resulting dataframe. ===Complete Code=== import ardi import sys #Setup ARDI Connection svr = ardi.Server("demo.optrix.com.au","long") #Connect to ARDI Server connected = False try: connected = svr.Connect() except: pass if connected == False: print("Unable to Connect to ARDI Server") sys.exit(-1) query = ardi.AQLQuery(svr) data = query.Execute_DF("'Closest Support' PROPERTY ALLPOINTS {\"range\": \"6 hours\"} GETHISTORY") print(str(data))