API service for KnowWhereGraph
The API service is meant to be run under full stack operating conditions. There are several flavors of the API, which correspond to different docker-compose files.
- local: Uses a local GraphDB deployment
- stage: Uses the staging GraphDB deployment
- prod: Uses the production GraphDB deployment
To run the API in a production setting, outside the full stack, deploy with docker using
docker-compose -f docker-compose.dev.yaml up
This avoids the inclusion of the service in the kwg_netowrk
, which is used when doing a full stack deployment.
Visit the redoc page at http://localhost/redoc
Visit the swagger page at http://localhost/docs
Test the redirection with http://localhost/lod/resource/hazard.1183609.5434007
- Node de-referencing
- Common vocabulary retrieval
Changes should be submitted as a pull request to the development
branch.
A number of tools should be run before submitting the pull request.
poetry run mypy .
poetry run black .
poetry run isort .
The unit tests can be run through pytest with
poetry run pytest
The API uses the sphinx documentation formation. To build the documentation, first install sphinx.
Then,
cd docs
make build
When the API is running, the following pages can be used to play with the endpoint
Visit the redoc page at http://127.0.0.1:8080/redoc
Visit the swagger page at http://127.0.0.1:8080/docs
The API can be run locally when developing. To run,
poetry install
poetry run uvicorn kwg_api.main:app --reload --port 80
The API can also be run using the docker-compose.dev.yaml
file with
docker-compose -f docker-compose.dev.yaml up