Git Product home page Git Product logo

nuttapol-kor / fast-and-foo Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 74 KB

The Fast and Foo project establishes a link between vehicle speed and meteorological variables. Measure vehicle speed and factors influencing vehicle speed i.e, Air quality, Humidity that affect the speed and density of traffic.

Home Page: https://daq-fast-and-foo.herokuapp.com/speed/v1/ui/

License: MIT License

Dockerfile 1.00% Python 61.54% Shell 3.38% HTML 34.07%

fast-and-foo's Introduction

Fast and Foo

by Big Foo with the T


Contents


Overview

3d7def8b0aaadea790e24c4c982c31b7.png

In our daily lives, we must all travel regularly, whether from home to work or from home to university. As a result, travel is a vital and unavoidable aspect of our everyday lives, and vehicles have virtually become an extension of our bodies. It is indisputable that we have no means of knowing how long it will take us to reach our destination or what may cause delays when we are on a vehicle. As a result, it is where our project began. The pain points of our project are that users don't know what days of the week the traffic will be heavy and what variables will cause travel delays. So Big Foo with the T team created the Fast and Foo project. Our project is to monitor vehicle speed and the factors that influence it. Also show a graph to anticipate which variable affects the vehicle's speed i.e., air quality, humidity, and PM 2.5. The purpose of the project is to let the user know what variables affect the vehicle speed and average daily speed graph.

Back to contents

Features

APIs features

Method Endpoint(s) Feature(s)
GET /pm25/{lat}/{lon}/report Shows air quality report (Unhealthy, Moderate, or Good)
GET /pm25/{speedId} Shows PM 2.5 value
GET /speeds Shows a list of average speed data
GET /speeds/{lat}/{lon}/traffic-report Shows a traffic report (Clear road or Traffic jam)
GET /speeds/{speedId} Shows average speed value in km/hr
GET /tmd/{lat}/{lon}/report Shows rainfalls report (Rain or Clear sky)
GET /tmd/{speedId}/humidity Shows humidity value
GET /tmd/{speedId}/rainfall Shows rainfalls value
GET /tmd/{speedId}/temperature Shows temperature

Back to contents

Data visualization features

Graph Title Feature(s)
Speed and Date Let the user knows which days are most likely to be traffic jams, as indicated by the reduced speed. Help the user chooses travel dates that are convenient for travel.
Speed and PM 2.5 Shows the user where traffic is prone to traffic jams, which can be seen from the higher PM 2.5 value resulting from the high amount of car smoke along the route resulting in lower average speed.
Speed and Rainfalls Shows the user how much rainfall affects average speed, which is helpful so they can avoid picking days with low temperatures and high humidity that result in rainfall.

Back to contents

Required libraries and tools

Prerequisite (required) software

Name of software Versions
Python Using at least version 3.6 or higher
Nodejs Using at least version 16.13.0 or higher
  • Python is a programming language that lets you work more quickly and integrate your systems more effectively.
  • Nodejs is a JavaScript runtime built on Chrome's V8 JavaScript engine.

Back to contents

How to Check Python Version

To check the version installed, open a terminal window and entering the following:

  • Linux/MacOS:
    python3 –-version
    
  • Windows:
    python ––version
    

Back to contents

How to Check Nodejs Version

To check the version installed, open a terminal window and entering the following:

  • Linux/MacOS:
    node –-version
    
  • Windows:
    node ––version
    

Back to contents

Prerequisite (required) database

Create database and table for connect to Fast and Foo project

How to create the Database and Table

  1. Create datebase in phpMyAdmin (MySQL)
  2. Create 3 tables in your datebase with schema as follows:
    • aqiProject
      Imgur
    • speedmeter
      Imgur
    • tmdProject
      Imgur

Back to contents

Instructions for building and running

  1. Clone Fast and Foo project to your machine. See how to clone the project.

  2. Change directory to the directory that contain fast-and-foo folder

    cd fast-and-foo
  3. Follows the setting up a virtual environment.

  4. Install required libraries

    pip install -r requirements.txt

    Description of the require packages

    • PyMySQL This package contains a pure-Python MySQL client library, based on PEP 249. Most public APIs are compatible with mysqlclient and MySQLdb.
    • python-dotenv reads key-value pairs from a .env file and can set them as environment variables.
    • gunicorn is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model.
  5. Install OpenAPI-to-GraphQL

    npm install -g [email protected]
    • OpenAPI-to-GraphQL generates a GraphQL schema for a given OpenAPI Specification (OAS).
  6. Edit example.env for your credential

    OPENAPI_AUTOGEN_DIR="autogen"
    DB_HOST="Your database host"
    DB_USER="Your username"
    DB_PASSWD="Your password"
    DB_NAME="Your table name"
    
  7. Start the REST API server

    • Linux/MacOS:
      python3 app.py
      
    • Windows:
      python app.py
      
    • Swagger UI avalible on http://localhost:8080/speed/v1/ui

      • Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without having any of the implementation logic in place.
  8. In another terminal, start openapi-to-graphql

    openapi-to-graphql --cors -u http://localhost:8080/speed/v1 openapi/speed-api.yaml
  9. Open the index page in path of html\index.html file

  • Right click at html\index.html file location > Copy Path > Paste path in browser
  1. Quit the server
    • Exit the terminal window

      • Linux/MacOS: Press CTRL + C button
      • Windows: Press CTRL + C button
    • Deactivate virtualenv

      deactivate 
      

Back to contents

How to clone Fast and Foo project

  • Access to a command-line/terminal window.
    • Linux:
      CTRL-ALT-T or CTRL-ALT-F2
      
    • Windows:
      WIN+R > type powershell > Enter/OK or Type in search tap "cmd"
      
    • MacOS:
      Finder > Applications > Utilities > Terminal
      
  • Change directory to the directory that the user wants to run the project.
    cd directory name
    
  • Use git clone in the command line. (Link to clone the project https://github.com/nuttapol-kor/fast-and-foo.git)
    git clone https://github.com/nuttapol-kor/fast-and-foo.git
    

Back to contents

Instructions for setting up a virtual environment (virtualenv)

a virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them.

  • Access to a command-line/terminal window.
    • Install a virtual environment.
      • Linux/MacOS:
        python3 -m pip install virtualenv
        
      • Windows:
        python -m pip install virtualenv
        
    • Create new virtual environment.
      • Linux/MacOS:
        virtualenv venv
        
      • Windows:
        virtualenv env
        
    • Activate a virtual environment.
      • Linux/MacOS:
        . env/bin/activate
        
      • Windows:
        env\Scripts\activate
        

Back to contents

Interact with our database

  1. You can just download openapi-to-graphql and run with this command

    openapi-to-graphql --cors -u https://daq-fast-and-foo.herokuapp.com/speed/v1 openapi/speed-api.yaml

    (The query is quite slow, you need to wait for 15-30 second.)

  2. Open the index page in html\index.html

Back to contents

Team Members

Nuttapol Korcharoenrat
Software and Knowledge Engineering
Faculty of Engineering
Kasetsart University
[email protected]


Phinyaphak Chiradejthanankorn
Software and Knowledge Engineering
Faculty of Engineering
Kasetsart University
[email protected]


Pitchapa Sae-lim
Software and Knowledge Engineering
Faculty of Engineering
Kasetsart University
[email protected]

Back to contents

fast-and-foo's People

Contributors

pitchapasaelim avatar nuttapol-kor avatar vnsvakanda avatar

Watchers

 avatar

Forkers

pitchapasaelim

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.