Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

LEGACY - No maintenance intended

License

Notifications You must be signed in to change notification settings

OpenTermsArchive/api-legacy

Repository files navigation

Open Terms Archive - API

No Maintenance Intended

This project has been initially done to provide a backend infrastructure for Scripta Manent

We will leave this project as it is for now an focus on having a more global approach to serve the data from each instance.

Get Started

Endpoints

All API endpoints are automatically documented in /docs

Running with Docker

The easiest option if you have Docker installed as it will automatically download the latest data available for you.

docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) --tag ota-legacy-api:latest .
docker run -d --name myapi -p 80:80 ota-legacy-api:latest

The API is served at localhost.

Custom command for M1

docker run --platform ota-legacy-api --platform linux/amd64  -d --name myapi -p 80:80 ota-legacy-api:latest

Running with python (for development)

This API was built using python3.8. We suggest you use a virtual environment.

virtualenv venv
source venv/bin/activate

You will also need a local copy of the dataset. By default, it is assumed to be in ./dataset but you can always change this by editing ./app/config.py.

To download the dataset, run : ./download_dataset.sh

Install requirements

python -m pip install -r requirements.txt

And run the app :

export PYTHONPATH=".":"./app/"
uvicorn main:app --reload

Develop

The required setup in order to contribute to the repo:

  • pip install -r requirements-dev.txt
  • python -m python_githooks

Update Dataset

The API has a /check_for_dataset route that automatically finds out if a newer version of the dataset has been released here and update the API to use it.

You can check which dataset release is being used by calling the /version endpoint.


License

The code in this repository is distributed under the European Union Public Licence (EUPL) v1.2.