This repository is a proof of concept of a simple API for Robyn.
This respository is a proof of concept of a relatively simple API for Robyn set up using Plumber. The api is intended to run within a docker container. The intention is to enable exchange of data more easily with other languages and improve workflows while working with Robyn. Enabling and running the API via docker allows the user to call certain Robyn functions using urls that are setup in the api without installing R or Robyn itself in the host system.
To run the docker container locally use:
docker run -p 8000:8000 --name robyn-api arowley/robyn-api
To run the example script in Python use:
pip install -r requirements.txt
and
python python-minimal.py
If you are running the docker container remotely, you may need to update the base url for the api, amend:
apiBaseUrl = "http://localhost:8000/{}"
As this is is a proof of concept, only the following endpoints are enabled.
Endpoint | Purpose | Arguments |
---|---|---|
/robynrun | Collects a robyn input from json, and executes robyn run. Optionally returns one pagers. | modelData - Serialized dataframe, serialize this in a manner similar to the python example (dataframe -> featherfile -> hexstring) |
jsonInput - Additional parameters for robyninputs in json format | ||
jsonRunArgs - Additional parameters for robynrun in json format | ||
onePagers - Boolean - Whether to build the one pager files for models | ||
/dt_prophet_holiday | Returns Robyn prophet holidays dataset | None |
/dt_simulted_weekly | Returns Robyn simulated demand dataset | None |
The docker container hosting the api is available on dockerhub.
docker pull arowley/robyn-api:latest
It can also be built from within the docker folder.