FluMapModel/api_service
Clinton Collins 4a56af48e5 Fix swagger for query model 2019-07-18 09:46:59 -07:00
..
.idea/runConfigurations Share run configurations 2019-07-14 22:54:14 -07:00
docker_scripts Fixed secuirty issues 2019-06-05 14:41:16 -07:00
docs Integrate master 2019-07-16 17:39:09 -07:00
docs_src Updated design 2019-07-14 22:49:16 -07:00
migrations Integrate master 2019-07-16 17:39:09 -07:00
scripts Add option for workers and for repeat test to better perform as performance test as well as general model test 2019-05-16 15:31:55 -07:00
seattle_flu_incidence_mapper Fix swagger for query model 2019-07-18 09:46:59 -07:00
tests Fixed secuirty issues 2019-06-05 14:41:16 -07:00
.dockerignore Don't add the local modelsdb to the container 2019-05-15 14:35:25 -07:00
AUTHORS.rst Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
CONTRIBUTING.rst Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
DEVELOPMENT_TIPS.rst Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
Dockerfile * Add CORS support 2019-07-14 21:42:43 -07:00
Dockerfile.builder Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
HISTORY.rst Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
Makefile Updated build scripts 2019-05-03 13:59:45 -07:00
README.rst Integrate master 2019-07-16 17:39:09 -07:00
dev_run.sh Integrate master 2019-07-16 17:39:09 -07:00
docker-compose.yml Fix port on prod compose 2019-05-09 13:49:14 -07:00
requirements_dev.txt Initial public commit moved from private repo 2019-03-18 13:43:29 -07:00
setup.py * Add CORS support 2019-07-14 21:42:43 -07:00
windows_env.ps1 Update windows builder environment script to allow building of docker images as well 2019-07-14 22:51:43 -07:00

README.rst

Seattle Flu Incidence Mapper API
================================

Seattle Flu Incidence Mapper API service hosts and API that can be used to host models generated using the incidence_mapper
R packages. These packages must best uploaded to the API server using the upload_models.py script


Architecture
------------

The API service is structured as 2 sets of docker images. The main image is the sflu-api which runs the API and
orchestrates the worker packages. The worker container use the sfim-worker image. The sflu-api is used to create the
service container.

The API service store model meta-information using a Postgres Database.

When a request is made to the /query API, the corresponding model is found in the database. If found, the service
container will then check is a copy of the selected model is already loaded into a running container. If not, service
container will create a new worker container using the sflu-worker image and then pass the request on to the model.


Development
===========

You will first need to build the docker image. To do this, ensure docker is installed. Then run the following commands
```
docker-compose build
```

You can now run the server using
```
docker-compose up
```

You should should always stop the containers completely and remove for proper development environment behaviour using
```
docker-compose down
```


Known Issues
------------
The container currently will create some root folders in development mode. This will be resolved in the next release

Performing Migrations
---------------------

docker-compose run service flask migrate

SQLALCHEMY_DATABASE_URI=postgres+psycopg2://seattle_flu:seattle_flu@db MODEL_STORE=/home/clinton/development/work/incidence-mapper/api_service/dbconversion/model_store FLASK_APP=seattle_flu_incidence_mapper.app:app flask db --help