Skip to content

Daminoup88/Memora-backend

Repository files navigation

Memora backend

Running Tests Last Commit Contributors

API of the Memora project using FastAPI. The frontend app can be found here: Memora frontend.

ESIEE Paris - 2024 - 4th year project

What is Memora?

Memora is a memory training mobile app designed for Alzheimer’s patients. It uses Spaced Retrieval Training (SRT, based on the Leitner system) to help exercise the brain with memories uploaded by relatives.

Getting Started

Prerequisites

Docker: Using Docker (recommended)

OR

Installation with Docker

See Installation without Docker below.

  1. Make sure you have a docker engine such as Docker Desktop installed and running.

  2. Clone the repository

git clone https://github.com/Daminoup88/Memora-backend.git
  1. Navigate to the project directory
cd Memora-backend
  1. Create a .env file from the example one:

On Linux/Mac:

cp .env.example .env

On Windows:

copy .env.example .env
  1. IMPORTANT: Edit the .env file and set strong secrets (especially POSTGRES_PASSWORD and TOKEN_SECRET_KEY). You can generate a secure secret key using Python:
python -c "import secrets; print(secrets.token_hex(32))"
  1. You can add the LLM features by setting LLM_ENABLED to True.

  2. Build and start:

  • In PRODUCTION:
docker compose up -d --build

or, with the legacy docker-compose executable:

docker-compose -f compose.yaml up -d --build
  • For DEVELOPMENT:
docker compose -f compose-dev.yaml up -d --build

or, with the legacy docker-compose executable:

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

Installation without Docker (tested on Windows)

  1. Clone the repository
git clone https://github.com/Daminoup88/Memora-backend.git
  1. Navigate to the project directory
cd Memora-backend
  1. Setup a virtual environment
python -m venv .venv
  1. Activate the virtual environment
.venv\Scripts\activate
  1. Install the dependencies
pip install -r requirements.txt
  1. Create a .env file from the example one:
cp .env.example .env
  1. IMPORTANT: Edit the .env file and set strong secrets (especially POSTGRES_PASSWORD and TOKEN_SECRET_KEY). You can generate a secure secret key using Python:
python -c "import secrets; print(secrets.token_hex(32))"
  1. If you have Ollama installed You can add the LLM features by setting LLM_ENABLED to True.

  2. Run the server

fastapi run --reload --host 0.0.0.0 --port 8000

Usage

The API documentation is available at http://localhost:8000/docs. To access the API from another device on the same network, replace localhost with the IP address of the host machine. Make sure the port is open and accessible to other devices.

Testing

To run the tests and coverage, use the following command in the root directory:

pytest --cov=app --cov-report=html

About

Memora is a memory training mobile app designed for Alzheimer’s patients. It uses Spaced Retrieval Training (Leitner system) to help exercise the brain with memories uploaded by relatives.

Topics

Resources

Stars

Watchers

Forks

Contributors