Giter Club home page Giter Club logo

receipt-parser's Introduction

Receipt Parser Service

The objective of this service, as implied by its name, is to speed up the process of updating products' availability. This is achieved by parsing receipts and linking products to the corresponding shops in the database. We begin by addressing the more accessible digital receipts, before progressing to handling physical ones.

Running the service locally

  1. Install Python 3.11
  2. Install Pipenv
  3. Run export PIPENV_VENV_IN_PROJECT=1 && pipenv sync --dev
  4. Run pipenv shell
  5. Create database and required tables python src/migrations.py with EnvType.DEV
  6. Run func start

Deploying to Azure Functions

  1. Install Azure CLI
  2. az login
  3. az --version
  4. func azure functionapp publish plante-receipt-parser

Running tests

Unit tests

Run python -m unittest discover -s src/tests/unit

Integration tests

  1. Set up environment variables locally:
    • TEST_COSMOS_DB_ACCOUNT_HOST=https://{Cosmos-DB-account-name}.documents.azure.com:443/
    • TEST_COSMOS_DB_ACCOUNT_KEY={key}
    • TEST_COSMOS_DB_DATABASE_ID=PlanteTest
  2. Create database and required tables by running python src/migrations.py with EnvType.TEST
  3. Run python -m unittest discover -s src/tests/integration

Functional tests

  1. Set up environment variables locally:
    • TEST_COSMOS_DB_ACCOUNT_HOST=https://{Cosmos-DB-account-name}.documents.azure.com:443/
    • TEST_COSMOS_DB_ACCOUNT_KEY={key}
    • TEST_COSMOS_DB_DATABASE_ID=PlanteTest
    • APP_HOST=https://plante-receipt-parser-test.azurewebsites.net/api
  2. Deploy service to test environment func azure functionapp publish plante-receipt-parser-test
    1. If the service was never deployed before, add these values to Function App Configuration:
      • TEST_COSMOS_DB_ACCOUNT_HOST=https://{Cosmos-DB-account-name}.documents.azure.com:443/
      • TEST_COSMOS_DB_ACCOUNT_KEY={key}
      • TEST_COSMOS_DB_DATABASE_ID=PlanteTest
      • ENV_NAME=test
  3. Run python -m unittest discover -s src/tests/functional

Architecture

The code aims at modularity and loose coupling. External interfaces like database and endpoint handlers should be easily replaceable. Schemas aim to add predictability and consistency to the domain objects but not at the expense of flexibility.

Architecture and infrastructure diagram

Code style

To check the code formatting, run pylint src function_app.py To fix most of the formatting issues, run black src function_app.py

receipt-parser's People

Contributors

dependabot[bot] avatar verilyanton avatar

receipt-parser's Issues

Integrate Google Sign-In

Adding availability and other data to the database has to be performed by an authenticated user

Try to find products on OFF

Use product name, country and shop name to guess the product
Maybe propose a couple of options to the user
ChatGPT can be used to read properly product names from the receipt

Add support for multiple identities

Add ability to link multiple user identities to a single account. For example, a user can log in to their account from google, apple, and other providers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.