Extracting Data from the Database Data is stored in tables in a MySQL database. We provide a function that will allow you to extract data from these tables. To do this, use the get_db_data.php page. The URL to access this data will be of the form http://chuck-wright.com/wcsd/get_db_data.php?<parms> where parms are
- pwd=(password) - is the password for data access to this table. (not implemented yet)
- deviceid=(deviceid) - is the unique ID of the device whose data is being sought.
- interval[]=(interval) - gives the starting and ending times of the time interval being plotted (Unix time). The first insertion is the starting time and the second is the ending time. If not present, and month/day/year are not present, then a default interval of the last 24 hours is used.
- month=(month) - month of the starting time - 1-12
- day=(day) - day of the starting time - 1-31
- year=(year) - year of the starting time - 4 digits
- duration=(duration) - duration of the interval, in days - If month/day/year are used, then interval will be ignored.
- timespec=(timespec) - used in place of interval or m/d/y, one of the following:
- today
- yesterday
- lasthour
- lastNhours - where N is a single digit
- lastday
- lastNdays - where N is a single digit
- lastNmonths
- lastNyears
- mtd or MTD
- ytd or YTD
- prevmonth - the previous month
- lastmonth - the last 31 days
- nocal=true - Ordinarily, raw data will be calibrated according to the scale and offset values stored in the database. If this parm is included, raw data only will be sent.
- (more as it evolves)
Examples: Get data for a device for the last 24 hours.
http://chuck-wright.com/wcsd/get_db_data.php?deviceid=390000000519611D_0×pec=lastday The first line contains a single string indicating the type of data. Data is returned in text format, with each line containing a time followed by a value. The time is in "Unix" time, that is, the number of seconds since midnight on 1/1/70.
The result in its raw form can be viewed using a browser to access the
data, and then using "view source". From here it can be "cut and
pasted".
More commonly, a script of some sort will be written to automatically
access the data and process it. To request other formats, please contact WCS. |