Blue Water - Data Insights for Water Management       

links

 photo Biplav Srivastava photo

Blue Water - Data Insights for Water Management - Accessing Water Data


Code Sample

See sample code in Java (on GitHub) on how to use the APIs:
https://github.com/sandeep-iitr/BlueWater_REST_API_DEMO

Docs
See slides (35-41) in the "AI for Water" tutorial.

API Methods

  1. Generating the license key to use the API.

Go to the below URL, and fill details to generate license key.
https://bluewater.mybluemix.net/license.jsp

 

  1. General query (gives the metadata)

Purpose

Get the metadata about the data available in the database

URL

https://bluewater.mybluemix.net/query

Sample URL

https://bluewater.mybluemix.net/query

Format

JSON

Required API Keys   

No

 

Sample output

[
{"Total Number of Data Points":147},
{"Sensor Attributes":[{"Time":"hh:mm:ss"},
{"Temperature":"Celcius"},{"pH":"Logarithm"},{"mV":"pH"},{"ORP":"mV"},{"EC":"microSiemens/cm"},{"EC Abs.":"microSiemens/cm"},{"RES":"Ohm-cm"},{"TDS":"ppm"},{"Sal":"psu"},{"Press.":"psi"},{"D.O.":"%"},{"D.O.":"ppm"},{"Latitde":"Degrees"},{"Longitude":"Degrees"},{"Date":"yyyy/mm/dd"},{"Unix Timestamp":"Seconds"}]},{"Lab Attributes":[{"Date":"yyyy/mm/dd"},{"Latitude":"Degrees"},{"Longitude":"Degrees"},{"Temperature":"Celcius"},{"D.O.":"mg/L"},{"pH":"Logarithm"},{"Conductivity":"microSiemens/cm"},{"BOD":"mg/L"},{"Nitrate":"ppm"},{"FC":"Colonies/100ml"},{"TC":"Colonies/100ml"},{"Turbidity":"FNU"},{"Velocity":"m/s"},{"Hardness":"mg/L"},{"Alkalinity":"mg/L"},{"Chloride":"mg/L"},{"Sulphate":"mg/L"},{"Cadmium":"mg/L"},{"Chromium":"mg/L"},{"Nickel":"mg/L"},{"Iron":"mg/L"},{"NA":"mg/L"},{"COD":"mg/L"}]}
]


  1. Get water quality data within the given range (in metres) around the given latitude longitude

Purpose                    

Get water quality data within the given range around the given latitude longitude

URL

https://bluewater.mybluemix.net/query?Latitude=lat&Longitude=lon&Range=range&Lic=key

Sample URL

https://bluewater.mybluemix.net/query?Latitude=29.70&Longitude=77.56&Range=10&Lic=xxx

Format

JSON

Required API Keys

Yes

 

Arguments

Field Name   

Description

Latitude

Latitude near which you need the data

Longitude

Longitude near which you need the data

Range

Distance from the give latitude and longitude for which you want water quality data

Lic

API key (Replace the key with the key provided to you)

 

Sample output

[
{"Lab":[{"Temperature":10.9,"Latitude":29.709368,"Iron":0.76,"FS":230,"Air Temperature":11.1,"Sulphate":88.1,"Chloride":177,"Unix Timestamp":1262284200,"BOD":62.7,"Turbidity":51.7,"pH":7.76,"COD":136,"Cadmium":0.015,"Conductivity":1407,"Hardness":382,"Longitude":77.565482,"Velocity":0.4,"Date":"2010/1/1","TC":2.4E8,"Nitrate":0,"NA":93.6,"D.O.":0.58,"Chromium":0,"Nickel":-1,"Alkalinity":323,"FC":2.4E8},{"Temperature":17.8,"Latitude":29.709368,"Iron":1.95,"FS":9300,"Air Temperature":19.3,"Sulphate":62,"Chloride":123,"Unix Timestamp":1264962600,"BOD":63,"Turbidity":81.5,"pH":7.73,"COD":234,"Cadmium":0.016,"Conductivity":1148,"Hardness":385,"Longitude":77.565482,"Velocity":0.33,"Date":"2010/2/1","TC":2300000,"Nitrate":0,"NA":72,"D.O.":0.31,"Chromium":0.037,"Nickel":0.006,"Alkalinity":367,"FC":2300000},
...
]


Possible Errors
  • Code 1- Wrong values for parameters.
  • Code 2- Inadequate number of parameters.
  • Code 3- License key not valid.

 

      4. Get water quality data between a period of time (Input as unix timestamps)

Purpose

Get water quality data between the period of time specified by unix timestamp

URL

https://bluewater.mybluemix.net/query Time_1=time&Time_2=time&Lic=xxx

Sample URL

https://bluewater.mybluemix.net/query?Time_1=1456566092&Time_2=1457689451&Lic=xxx

Format                      

JSON

Required API Keys

Yes

 

Arguments

Field Name     

Description

Time_1

Starting time from which you want data

Time_2

Ending time till which you want data (both in Unix timestamp format)

Lic

API key (Replace the key with the key provided to you)

 

Possible Errors
  • Code 1- Wrong values for parameters.
  • Code 2- Inadequate number of parameters.
  • Code 3- License key not valid.

 

      5. Get water quality data between a period of time (Input as date (date format- yyyy-mm-dd))

Purpose

Get water quality data between the period of time specified by two dates

URL

https://bluewater.mybluemix.net/query Date_1=date&Date_2=date&Lic=xxx

Sample URL

https://bluewater.mybluemix.net/query Date_1=2016-02-27&Date_2=2016-02-30&Lic=xxx

Format

JSON

Required API Keys

Yes

 

Arguments

Date_1    

Starting date from which you want data

Date_2

Ending date till which you want data

Lic

API key (Replace the key with the key provided to you)

 
Possible Errors
  • Code 1- Wrong values for parameters
  • Code 2- Inadequate number of parameters
  • Code 3- License key not valid

 

      6. Get water quality data between a period of time and within the given range around the given latitude longitude

Purpose                      

Get water quality data between the period of time specified by Unix timestamp and within the given range around the given latitude longitude

URL

https://bluewater.mybluemix.net/query?Latitude=lat&Longitude=lon&Range=ran&Time_1=time&Time_2=time&Lic=xxx

Sample URL

https://bluewater.mybluemix.net/query?Latitude=29.70&Longitude=77.56&Range=10&Time_1=1456566092&Time_2=1457689451&Lic=xxx

Format

JSON

Required API Keys

Yes

 

Arguments

Field Name     

Description

Latitude

Latitude near which you need the data

Longitude

Longitude near which you need the data

Range

Distance from the give latitude and longitude for which you want water quality data

Time_1

Starting time from which you want data

Time_2

Ending time till which you want data

Lic

API key (Replace the key with the key provided to you)

 

Possible Errors
  • Code 1- Wrong values for parameters
  • Code 2- Inadequate number of parameters
  • Code 3- License key not valid

 

      7.  Get water quality data between a the dates and within the given range around the given latitude longitude

 

Purpose                    

Get water quality data between the period of time specified by date (date format- yyyy-mm-dd) and within the given range around the given latitude longitude

URL

https://bluewater.mybluemix.net/query?Latitude=lat&Longitude=lon&Range=range&Date_1=date&Date_2=date&Lic=xxx

Sample URL

https://bluewater.mybluemix.net/query?Latitude=29.70&Longitude=77.56&Range=10&Date_1=2016-02-27&Date_2=2016-02-30&Lic=xxx

Format

JSON

Required API Keys

Yes

 

Arguments

Field Name       

Description

Latitude

Latitude near which you need the data

Longitude

Longitude near which you need the data

Range

Distance from the give latitude and longitude for which you want water quality data

Date_1

Starting date from which you want data

Date_2

Ending date till which you want data

Lic

API key (Replace the key with the key provided to you)

 

Possible Errors
  • Code 1- Wrong values for parameters
  • Code 2- Inadequate number of parameters
  • Code 3- License key not valid

 

 

 




Tutorial: AI for Data-Driven Decisions in Water Management

We will be giving a tutorial, titled AI for Data-Driven Decisions in Water Management, at the premier AAAI conference in Feb 2017 at San Francisco, CA, USA. Details: see site.