Skip to content

rsb0/TDT4856-Gruppe-3---IT-Styring-Av-Lastebiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

TDT4856 - Fuel Price Detection - Group #3

Build status License: MIT

The main goal of this project is to use computer vision systems to detect fuel prices from local fuel stations. In order to succeed with this project the group will develop an application which will be enable the user to take pictures of price signs and list fuel prices.

Mobile application - Repository

Take pictures and show price information to the users.

Downloading the app

The app is available as a downloadable apk-file for android phones. It is unfortunately not available for iPhone. To download, open this link on your phone. When completed, open the file to install the app.

Running the application locally

Prerequisites

Setup

  1. Navigate to the root folder of the project in your terminal.
  2. Install all dependencies.
    npm install
  3. start the development server
    npm start
  4. Scan the QR-code printed when the server starts using the Expo app on your phone.
  5. Open the project code in a text editor or IDE to make changes and see their effect in real time on your phone.

Backend - Repository

Process pictures and stores fuel price related information.

Prerequisites

Getting started

This project requires you to have Python3 and pip installed on your machine. Easiest way to get it is by installing Anaconda. After you have done this, run the command below in cmd/termnial to install the remaining prerequisites.

Running the application locally

When running the application locally you need a .env-file. Ask someone in the team for this.

  1. Navigate to the src folder
  2. Install all necessary requirements
pip install -r requirements.txt
  1. Navigate to the app folder
  2. Run the application
python main.py
  1. Access the application by navigating to "http://localhost:80" or "http://0.0.0.0:80".

CI/CD

Continous integration is set up so that all commits to the backend-master branch automatically will build a new container. This container wil then be deployed to a custom Azure Container Registry. The application will run as a web service and be available at https://fuelpriceapi.azurewebsites.net/ if everything succeeds!

Dockerkize application

If you want to build and run the Docker image locally use the below commands:

docker build -t <image-name>:<tag-name> .
docker run -p 80:80 <image-name>:<tag-name>

API reference

How to communicate with the server via the REST API. Remark: This is work in progress an breaking changes may occur!

GET

  • By location and ID: /prices/<string:location>/<string:id>
  • By location and coordinates: /prices/<string:location>/coordinates/<string:coordinates>
  • By location: /prices/<string:location>

POST

To insert an data directly as text to the database send a POST request to "/upload/prices" with JSON content on the following form:

{ 
   "new_prices":[{ 
   	"county":"trondelag",
      "price":15.85,
      "location":"63.420876,10.460610",
      "fueltype":"diesel"
   },{ 
   	"county":"trondelag",
      "price":16.34,
      "location":"63.420876,10.460610",
      "fueltype":"gasoline"
   },{ 
   	"county":"trondelag",
      "price":17.31,
      "location":"63.420876,10.460610",
      "fueltype":"gasoline"
   },{ 
   	"county":"trondelag",
      "price":15.84,
      "location":"63.420876,10.460610",
      "fueltype":"diesel"
   }]
}

To upload and process an image send a POST request to "/upload/image" with JSON content on the following form:

{
    "image": "Base64 string here",
    "location": "63.420876,10.460610"
}

Database design

Screenshot of database structure with example data: Database design

Questions

All questions related to the backend or CI/CD-config, can be directed to Mats Tyldum.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published