slac207 / cs207project

MIT License
0 stars 4 forks source link

P10 REST API #78

Closed jsm09 closed 7 years ago

jsm09 commented 7 years ago

(4) support an additional query supported by your custom database server which returns a time-series for an id. Expose this to your command line program: you will need to support an additional operation in your protocol. You should use your custom storage-manager that you wrote in part 8 of the project to fetch time series for this purpose from disk. At this stage make sure that when you store time series into the database, you use the storage manager interface as well. (upto now there has been no notion of storing the time series in the "database", you have probably just come up with your own scheme to store them on disk in some folder).

Now we will write a REST API that queries this relational database, the custom similarity database that you wrote, and the Storage Manager.

Endpoints you must support:

/timeseries GET should send back a json with metadata from all the time series /timeseries POST adds a new timeseries into the database given a json which has a key for an id and a key for the timeseries, and returns the timeseries /timeseries/id should send back metadata and the timeseries itself in a JSON payload /timeseries?mean_in=1.5-1.53 type queries should now be supported and send back only metadata. For continuous variables you only need to support range queries with string mean_in=1.5-1.53 whereas for discrete variables(level here) you need to support equals and in level_in=A,B,C or level=A. For simpilicity we wont support equals or less-than/greater-than type queries on continuous variables. Finally we'll support only one query at a time (so no combined SELECTs on the database). This will enable you to develop either in DBAPI2 or SQLAlchemy (your choice, although I think that using Flask-SQLAlchemy is a bit easier). /simquery GET should take a id=the_id querystring and use that as an id into the database to find the timeseries that are similar, sending back the ids of (say) the top 5. /simquery POST should take a timeseries as an input in a JSON, carry out the query, and return the appropriate ids as well. This is an unusual use of POST.