Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Heroku App #20

Closed
antoinecarme opened this issue Dec 27, 2016 · 10 comments
Closed

Create a Heroku App #20

antoinecarme opened this issue Dec 27, 2016 · 10 comments

Comments

@antoinecarme
Copy link
Owner

antoinecarme commented Dec 27, 2016

Need a RESTful API for PyAF and a Heroku demo.

https://pyaf.herokuapp.com/

antoinecarme added a commit that referenced this issue Dec 27, 2016
antoinecarme added a commit that referenced this issue Dec 27, 2016
Use python-3.6.0 for Heruku
@antoinecarme
Copy link
Owner Author

There is some preliminary working REST API app at https://pyaf.herokuapp.com/

It builds an ozone model by default.
try:
https://pyaf.herokuapp.com/models
and then :
https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/all

@antoinecarme
Copy link
Owner Author

The REST API is implemented here : https://github.com/antoinecarme/pyaf/blob/heroku-tests/WS/WS_REST_Flask.py

@antoinecarme
Copy link
Owner Author

A new model can be added with a json body like this :

      {
        "CSVFile": "https://github.com/antoinecarme/TimeSeriesData/master/ozone-la.csv", 
        "DateFormat": "%Y-%m", 
        "Horizon": 12, 
        "Present": "1968-08", 
        "SignalVar": "Ozone", 
        "TimeVar": "Month"
        "Name": "new_name_for_the_model"

      }

POST at https://pyaf.herokuapp.com/model

@antoinecarme
Copy link
Owner Author

    "TrainOptionsHelp": [
      {
        "CSVFile": "A CSV file (URIs are also welcome!!!) containing a date column (optional, a integer sequence starting at zero is used if not present), and a signal column, for which the future values are to be predicted. ", 
        "DateFormat": "The format of the date column , if it is a physcial date/time/datetime column (iso : yyyy-mm-dd by default), empty otherwise", 
        "Horizon": "number of future time periods to be predicted. The length of a period is inferred from data (most frequent difference between two consecutive dates)", 
        "Name": "Name used to identify the model in the API", 
        "Present": "date/time of the last known signal value. Predictions start after this date/time", 
        "SignalVar": "Name of the signal column to be predicted", 
        "TimeVar": "Name of the date/time column"
      }

@antoinecarme
Copy link
Owner Author

The following plots re available :

        "AR": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/AR", 
        "Cycle": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/Cycle", 
        "Forecast": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/Forecast", 
        "Prediction_Intervals": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/Prediction_Intervals", 
        "Trend": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/Trend", 
        "all": "https://pyaf.herokuapp.com/model/Ozone_Model_12/plot/all"

@antoinecarme
Copy link
Owner Author

The following SQL dialects are available :

        "Default": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/Default", 
        "mssql": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/mssql", 
        "mysql": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/mysql", 
        "oracle": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/oracle", 
        "postgresql": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/postgresql", 
        "sqlite": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/sqlite", 
        "sybase": "https://pyaf.herokuapp.com/model/Ozone_Model_12/SQL/sybase"

@antoinecarme
Copy link
Owner Author

Only the CSVFile is not optional!!!!

Set proper default values for all other settings.

Empty string and None are equivalent.
Default date format is ISO : 2016-12-31
When 'Present' is empty, use the whole dataset.
Default horizon is 1.

@antoinecarme
Copy link
Owner Author

A minimal model can be added with a json body like this :

  {
    "CSVFile": "http://chart.finance.yahoo.com/table.csv?s=GOOG&a=8&b=14&c=2015&d=9&e=14&f=2016&g=d&ignore=.csv"
  }

(Google stock quotes).

@antoinecarme
Copy link
Owner Author

sample usage (see WS/curl_tests.sh):

<script.sh>

PYAF_URL="http://pyaf.herokuapp.com/model"

CONTENT_TYPE="Content-Type: application/json"

DATA3="{"SignalVar":"Close", "Horizon":"21", "Present":"2016-01-01", "CSVFile": "http://chart.finance.yahoo.com/table.csv?s=GOOG&a=8&b=14&c=2015&d=9&e=14&f=2016&g=d&ignore=.csv\"}";

curl --header "$CONTENT_TYPE" -X POST --data "$DATA3" "$PYAF_URL"

</script.sh>

The previous curl command predicts three months (Horizon=21) of GOOG signal (yahoo finance API) starting from 2016-01-01.

antoinecarme added a commit that referenced this issue Jan 9, 2017
Updated the MAkefile with new tests.
antoinecarme added a commit that referenced this issue Jan 9, 2017
Added these referneces.
@antoinecarme
Copy link
Owner Author

The API is working now.

Added a class:API label for future API-related issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant