marti1125 / folksonomy_api

A light REST API designed for Open Food Facts folksonomy engine

Home Page:https://wiki.openfoodfacts.org/Folksonomy_Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Folksonomy API

A light REST API designed for the Open Food Facts Folksonomy Engine.

Dependencies

The code is written in Python 3.x and uses FastAPI framework.

PostgreSQL is used as the backend database.

Dev

You should create unit tests for each new feature or API change (see test_main.py). To run tests just launch:

PYTHONASYNCIODEBUG=1  pytest tests/ folksonomy/

The PYTHONASYNCIODEBUG is important to check we have no pending asyncio tasks that are not executed (sign of a potential problem).

Generating an OpenAPI document

FastAPI is based on OpenAPI (previously known as Swagger) and JSON Schema. FastAPI allows to generate an OpenAPI document (JSON) that you can reuse in various services (to automatically generate client libraries for example). To generate an OpenAPI document you can either:

./generate_openapi_json.py

How to install Folksonomy Engine on your local machine

  1. Install Python 3.8+
  2. Install pip
  3. Install PostgreSQL 13+
  4. Follow the steps in INSTALL.md to install requirements and for creating a db user
  5. Make a copy of local_settings_example.py and rename it to local_settings.py
  6. Change parameters accordingly in local_settings.py
  7. That's all!

Deployment

Deployment at Open Food Facts - Folksonomy Section

About

A light REST API designed for Open Food Facts folksonomy engine

https://wiki.openfoodfacts.org/Folksonomy_Engine

License:GNU Affero General Public License v3.0


Languages

Language:Python 94.0%Language:PLpgSQL 5.0%Language:Shell 1.0%