Web service api for serving weather data built using flask and flask_restful.
This repository contains code to implement a RESTful service to serve weather data of Cincinnati of past five years. The RESTful service is implemented using FLASK, FLASK_RESTFUL frameworks.
This is a markdown specification about the REST API developed to serve weather data of Cincinnati for past five years.
- Schemes
- HTTP
- Endpoints
-
/historical
-
GET
-
POST
-
-
/historical/'date'
-
GET
-
DELETE
-
- HTTP
This endpoint has information about the historical weather data of Cincinnati.
/historical
Description: List of all dates for which weather information is available.
Parameters: None. There are no parameters for this, we just need to use the endpoint('/historical').
Response:
Code | Description |
---|---|
200 | JSON array of dates in 'YYYYMMDD' format. |
/historical/'date YYYYMMDD'
Description: This returns the weather information for the passed parameter date. If no information is available error is returned.
Parameter: The parameter value is a string of date in 'YYYYMMDD' format.
Datatype: String
Response:
Code | Description |
---|---|
200 | JSON array of weather information containing data for DATE, TMAX, TMIN. |
404 | Error message in JSON format. |
/historical
Description: Adds weather information for a particular date. The date is taken from the Request object body.
Parameters: None. There are no explicit parameters, the date is extracted from the request object body.
Response:
Code | Description |
---|---|
201 | Successfully added the weather information in the request object's body to the data, and returns the date that is added. The date is returned in JSON format. |
/historical/'date YYYYMMDD'
Description: Deletes the weather information for the date passed as parameter.
Parameter: The parameter value is a string of date in 'YYYYMMDD' format.
Datatype: String.
Response:
Code | Description |
---|---|
204 | Sucessfully deleted the weather information for specified date in the parameter. |
I am working on a model, to forecast the weather information for future dates accounting to the observed trends and seasonality of the data.
I came across this interesting tool developed by Facebook research team. I wrote a few pages about it. Head over to wiki of this repository to view those pages. The notebook 'forecasting model' is my first attempt to use this tool. I will soon use this tool to forecast and integrate it to the API.
I have pushed a PDF version of my notebook with an example of using Prophet. This goes with the wiki page 'More about Prophet'.
Although the wiki pages tab is available right on repository page, I want to provide the list of links to the pages in an order that would make sense while going through. This is added only to emphasize on the order of pages. Here are the list of links of the wiki pages I wrote:
This endpoint has forecasting feature for the next seven days.
/forecast/'date YYYYMMDD'
Description: Forecasts the weather information for the next seven days starting with the date passed as parameter. The forecast is done using fbprophet.
Parameter: The parameter value is a string of date in 'YYYYMMDD' format.
Datatype: String.
Response:
Code | Description |
---|---|
200 | *Returns a JSON array containing weather information for the next seven days starting with the date passed as parameter. |
I used Angular JS to bind the data from the API onto the View page. I have used Google Charts to plot the forecast for next seven days.