Skip to content

KnowWhereGraph/kwg-api

Repository files navigation

KWG API

API service for KnowWhereGraph

Running

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.

  1. local: Uses a local GraphDB deployment
  2. stage: Uses the staging GraphDB deployment
  3. prod: Uses the production GraphDB deployment

Outside of the Stack

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

Features

  • Node de-referencing
  • Common vocabulary retrieval

Developing

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 .

Testing

The unit tests can be run through pytest with

poetry run pytest

Building Docs

The API uses the sphinx documentation formation. To build the documentation, first install sphinx.

Then,

cd docs
make build

Running

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,

For local Development

Non-Docker

poetry install
poetry run uvicorn kwg_api.main:app --reload --port 80

With Docker

The API can also be run using the docker-compose.dev.yaml file with

docker-compose -f docker-compose.dev.yaml up

About

API powering KnowWhereGraph services

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published