by Big Foo with the T
- Overview
- Features
- Required libraries and tools
- Instructions for building and running
- Presentation
- Team Members
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.
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 |
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. |
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.
- Install Python
- Nodejs is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- Install Node.js
To check the version installed, open a terminal window and entering the following:
- Linux/MacOS:
python3 –-version
- Windows:
python ––version
To check the version installed, open a terminal window and entering the following:
- Linux/MacOS:
node –-version
- Windows:
node ––version
Create database and table for connect to Fast and Foo project
- Create datebase in phpMyAdmin (MySQL)
- Create 3 tables in your datebase with schema as follows:
-
Clone Fast and Foo project to your machine. See how to clone the project.
-
Change directory to the directory that contain
fast-and-foo
foldercd fast-and-foo
-
Follows the setting up a virtual environment.
-
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.
-
Install OpenAPI-to-GraphQL
npm install -g [email protected]
- OpenAPI-to-GraphQL generates a GraphQL schema for a given OpenAPI Specification (OAS).
-
Edit
example.env
for your credentialOPENAPI_AUTOGEN_DIR="autogen" DB_HOST="Your database host" DB_USER="Your username" DB_PASSWD="Your password" DB_NAME="Your table name"
-
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.
- Linux/MacOS:
-
In another terminal, start openapi-to-graphql
openapi-to-graphql --cors -u http://localhost:8080/speed/v1 openapi/speed-api.yaml
- GraphQL window avalible on http://localhost:3000/graphql
-
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
- Quit the server
-
Exit the terminal window
- Linux/MacOS: Press
CTRL + C
button - Windows: Press
CTRL + C
button
- Linux/MacOS: Press
-
Deactivate virtualenv
deactivate
-
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
- Linux:
- 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
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
- Linux/MacOS:
- Create new virtual environment.
- Linux/MacOS:
virtualenv venv
- Windows:
virtualenv env
- Linux/MacOS:
- Activate a virtual environment.
- Linux/MacOS:
. env/bin/activate
- Windows:
env\Scripts\activate
- Linux/MacOS:
- Install a virtual environment.
-
You can just download
openapi-to-graphql
and run with this commandopenapi-to-graphql --cors -u https://daq-fast-and-foo.herokuapp.com/speed/v1 openapi/speed-api.yaml
- GraphQL window available on http://localhost:3000/graphql
(The query is quite slow, you need to wait for 15-30 second.)
-
Open the index page in
html\index.html
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]