Open danhan opened 11 years ago
1 RESTAPI for statistics Summary POST : http://localhost:9999/analytics/statistics/sum JSONobject: { "object":"appointment", "status":"unfinished", / finished/ "" "start-time":"2012-01-01 01:00:00", "end-time":"2013-01-01 01:00:00", "unit":"m", "cities":"bc,ab" }
Response: [{"values":[12,0,0,0,2], "city': "bc"}, {"values":[1,2,1,2,2], "city":"ab"}]]
Query1 : Appointment Get total number of appointment with a status, in regions, by month, during a given time. http://localhost:9999/analytics/statistics/sum { "object":"appointment", "condition":"unfinished", "start-time":"2012-01-01 01:00:00", "end-time":"2012-12-12 01:00:00", "unit":"m", "regions":"bc,ab" } Response: [ {"region": "localhost", "values":[{"201201":0},{"201202":0},{"201203":0},{"201204":0},{"201205":0},{"201206":0},{"201207":0},{"201208":0},{"201209":0},{"201210":0},{"201211":0},{"201212":0},{"201301":0},{"201302":4},{"201303":5}], "request_stat":{"exe_time":20,"cell_size":174,"num_of_rows":5,"num_of_cells":9}}]
Query2: Range query in Geospatial query Get N patients, who are in distance of M miles from my location? http://localhost:9999/analytics/spatial/range { "start-time":"2012-01-01 01:00:00", "regions":"localhost", "end-time":"2013-01-01 01:00:00", "location":"40,40", "distance":1000 }
Response [{ "region": "localhost", "values": [ { "023955-Peter-Patient-1": 200.2228115603714}], "request_stat": { "exe_time": 7, "cell_size": 726, "num_of_rows": 1, "num_of_cells": 1 } } ]
Query3: Timeseries query Get the total number of services, with all status(incomplete, complete, refused, prevented), in regions, by month, during a period of time http://localhost:9999/analytics/statistics/pct { "numerator": "service", "object": "record", "condition":"", "start-time":"2013-01-01 01:00:00", "end-time":"2014-01-01 01:00:00", "unit":"m", "regions":"localhost" }
Response: [{ "total":2, "region":"localhost", "values":[{"201309":{}},{"201312":{}},{"201308":{}},{"201311":{}},{"201307":{}},{"201310":{}},{"201306":{}},{"201305":{}},{"201304":{}},{"201303":{"s1":[1,0,0,0]}},{"201302":{"s1":[0,1,0,0]}},{"201301":{}}], "request_stat":{"exe_time":8,"cell_size":70,"num_of_rows":2,"num_of_cells":2} }]
Query4: Timeseries query Get the total number of media messages, with all types(Video, Audio, Picture, Text), in regions, by month, during a period of time http://localhost:9999/analytics/statistics/pct
{ "start-time":"2013-01-01 01:00:00", "regions":"localhost", "end-time":"2013-12-12 01:00:00", "object":"record", "numerator":"media", "condition":"", "unit":"m" } Response: [{ "total":3, "region":"localhost", "values":[{"201309":{}},{"201312":{}},{"201308":{}},{"201311":{}},{"201307":{}},{"201310":{}},{"201306":{}},{"201305":{}},{"201304":{}},{"201303":{"m2":[2],"m3":[1],"m0":[1]}},{"201302":{"m2":[2],"m0":[1]}},{"201301":{}}], "request_stat":{"exe_time":6,"cell_size":174,"num_of_rows":3,"num_of_cells":7} }]
Query5 : windows Query Which area (East/West/North/South) has the most/least patients? http://localhost:9999/analytics/spatial/window { "start-time":"2012-01-01 01:00:00", "end-time":"2013-01-01 01:00:00", "regions":"localhost", "areas":["NW","NE","SW","SE"] }
Response [ { "region": "localhost", "values": [ {"NW":1}, {"NE":3},{"SW": 5},{"SE",7} ] } ]
ISSUES: #12
Request statistics should be double check ISSUE #13
The final REST APi interface will be documented here https://docs.google.com/a/ualberta.ca/document/d/1NLkfai0Gikx-_9i1KGKgjz5mcr1e17byWuEc7WBIJSM/edit#heading=h.ecqgexn4h251
To accept the analytics request from the Analytics Console, and send the request to HBase server