sergio-gimenez / ieMaps

An inclusive eco-friendly app for mobility
1 stars 0 forks source link
ajax cors flask javascript maps python3 react

ieMaps: an inclusive eco-friendly app for mobility

This project started in October 2019 in the Hackaton UPC 2019 (Initial devpost submission :)). It has also being part of final project for Software and Distributed Applications course of the Telecommunications Engineering Bachelor at the Polythecnical University of Catalonia (UPC).

Contributors

/img/ieMaps.png

Table of contents

Overview

ieMaps is an inclusive and eco-friendly Google Maps implementation. It uses the Google Maps API to perform all actions related to mobility. Google Maps is the quintessential web mapping service, but still, it does not care about the environment neither the people with reduced mobility (PWRM since now).

Knowing all the above, we decided to implement a third-party app that gives you a service like google maps but taking care of enviroment and people at the same time. We calculate the footprint of every trip shown in screen, so that the user knows what impact has for the planet to move around. We also calculate the cost of the trip, as well as the air pollution and forecast prediction of today and tomorrow.

We care about people with reduced mobility. We take care of the subway stations that are not propperly equipped properly for them to move around the station. If the preffered transport mode is by car, we show the nearest reserved parking spot for reduced mobility people.

By know, we take care of the following parameters in the city of Barcelona:

Run the project

Requeriments

Google Maps API Key

Make sure you have a Google Maps API Key. To get it, go to the Google maps API page, sign-up and get a token to use. You must enter a credit card number to receive your token. However, Google claims they will not charge your account without you personally upgrading your service. Proceed at your own discretion.

To run the implementation, make sure you have installed Docker Engine and Docker-compose.

If not, check the following instructions:

Docker

To install docker check official installation guide for Windows, Mac or Linux.

For debian distros, fastest way is probably install from apt using the following commands:

Update software repositories

sudo apt-get update

Uninstall old versions of docker

sudo apt-get remove docker docker-engine docker.io

Install docker

sudo apt install docker.io

Start and automate docker. The Docker service needs to be setup to run at startup. To do so,type in each command followed by enter.

sudo systemctl start docker
sudo systemctl enable docker

IMPORTANT

Make sure you don't need to type sudo every time you run docker. To do so, run the following command:

sudo usermod -aG docker $(whoami)

Reboot to apply this change.


docker-compose

For docker-compose, just run these commands:

sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)"  -o /usr/local/bin/docker-compose
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose

Running

Fast run (plug-and-play)

In order to run the project in dockers, just run the deploy.sh bash script located in the root project folder. It will build and run two docker instances: ieMaps_react and ieMaps_flask.

MVC_diagram_docker

Run it locally

Node server and Flask server can be runned locally by installing all the dependencies locally.

For run the node (react) server:

For the flask (python) server:

How does it work?

MVC_diagram

Server Code (Model)

It consist of several python scripts that calculate the output parameters. Finally, ieMaps.py script merge all the information in a JSON file in order to be sent.

Flask (Controller)

Flask is a micro web framework written in Python. It listens in port 5000 for a POST method. If the POST method is OK, it returns an OK 200 HTTP response plus the JSON response prepared by the model.

React (View)

React is a JavaScript library for building user interfaces. Is the responsible of creating the input form and sending it to the Flask API. Then it waits to the JSON response and prints the information from the JSON in a map and in the screen.

Parameters calulation

Forecast prediction model

We have used a 'Exponential smoothing state space model' that predicts the weather for the following days.

We have implemented the model in R and used this forecast package for the Air Quality prediction.

Used API Forecasting Functions for Time Series and Linear Models

Air quality

We have implemented a non-linear scale between one and three averaging the scaled values for each non-healthy emitted gas.

footprint

Qualitat de l'aire dataset

Availability of electric vehicle chargers

We have used a dataset given at Everis talk.

Carbon footprint calculation

(Kg CO2 / l) l/km desplacement

Car parking spots for PRM (People with Reduced Mobility)

We have taken information of PRM spots at this dataset: Typology of the reserved parking spots in the infrastructure network of the city of Barcelona .

Bike parking spots for bikes

We have taken information of PRM spots at this [dataset]().

Temperature

We have used the Dark Sky API. It allows you to look up weather around the globe. Returning:

Precipitation in real time and precipitation prediction

We have used the Dark Sky API. It allows you to look up weather around the globe. Returning:

Taxi pricing

TaxiTable