A web service designed to provide a robust and scalable interface for managing and analyzing biological data. This API leverages Flask, a lightweight WSGI web application framework in Python, to deliver high-performance endpoints for data retrieval, processing, and visualization.
Create a development environment with the requirements.txt file
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtSet the FLASK_APP environment variable to the cherita directory
export FLASK_APP=cheritaRun the API
python -m flask runYou can enable debugging mode with
python -m flask run --debugYou can set a specific port for the API with the -p flag
python -m flask run -p 8001The API is setup to use Redis for caching (supported by Flask-Caching).
The app will attempt to connect to a Redis instance if the environment variable REDIS_HOST is set to the instance's IP address. REDIS_PORT and CACHE_KEY_PREFIX can also be set.
If REDIS_HOST is set and the app cannot connect to the Redis instance it will throw an "Redis connection error" on each attempt to access the cache.
When updating the API's responses you will have to flush the cache to avoid getting outdated data. You need to connect to the redis instance, we recommend using redis-cli. You can install it with
sudo apt-get install redis-toolsYou can send the FLUSHALL command directly like
redis-cli -h instance-ip-address -p port FLUSHALLAlternatively, you can connect to the instance and then execute the command
redis-cli -h instance-ip-address -p port
FLUSHALLNote that when using a Memorystore Redis instance you will need to connect from a VM that is within the instance's authorized network. Refer to the official documentation for more information.
Install dev packages and run pytest
python -m pip install -r requirements-dev.txt
python -m pytest tests/