This Flask application processes receipt data and calculates points based on the provided information.
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Create and activate a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate # For Linux/macOS # venv\Scripts\activate # For Windows (Command Prompt) # venv\Scripts\Activate.ps1 # For Windows Powershell
-
Install dependencies:
pip install -r requirements.txt
-
Initialize the database:
flask init-db
-
Run the application:
python app.py
or, with debug mode:
export FLASK_DEBUG=True #Linux/macOS #set FLASK_DEBUG=True #windows command prompt #$env:FLASK_DEBUG = "True" #windows powershell python app.py
-
Docker (Optional):
- Build and run the Docker container:
docker-compose up --build
- Build and run the Docker container:
POST /receipts/process: Processes a receipt and returns a receipt ID.- Request body: JSON receipt data.
- Response: JSON containing the receipt ID.
GET /receipts/<receipt_id>/points: Retrieves points for a given receipt ID.- Response: JSON containing the points.
- SQLite database (
receipts.db) is used for data storage. - Database file is stored in the
datadirectory.
DATABASE_FOLDER: Specifies the directory for the SQLite database. Defaults to./data.FLASK_DEBUG: Enables Flask debug mode when set toTrue.