Compare commits
8 Commits
bb610f3935
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
a53d79fe5f
|
|||
|
b442532768
|
|||
|
f15ff39090
|
|||
|
af079f7907
|
|||
|
57c536e909
|
|||
|
34b9f76cf1
|
|||
|
5c32ad611b
|
|||
|
44785255b0
|
80
README.md
Normal file
80
README.md
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
graphPaname
|
||||||
|
===========
|
||||||
|
|
||||||
|
graphPaname is a system that collects real-time data, relevant to the
|
||||||
|
COVID-19 pandemic de-escalation, from the city of Paris.
|
||||||
|
|
||||||
|
It works with 4 datasets about the de-escalation:
|
||||||
|
|
||||||
|
- Retailers with home delivery
|
||||||
|
- Additional parking places in relay parkings (parkings connected to
|
||||||
|
public transportation)
|
||||||
|
- Temporary cycling paths
|
||||||
|
- Temporary pedestrian streets
|
||||||
|
|
||||||
|
For each dataset, we offer a table with the data, and a map of Paris
|
||||||
|
with markers. Additionally, there\'s a section with photos related to
|
||||||
|
the COVID-19 pandemic.
|
||||||
|
|
||||||
|
Technologies
|
||||||
|
------------
|
||||||
|
|
||||||
|
- Flask
|
||||||
|
- Pandas
|
||||||
|
- Folium
|
||||||
|
|
||||||
|
Data sources
|
||||||
|
------------
|
||||||
|
|
||||||
|
- [Open Data](https://opendata.paris.fr/pages/home/)
|
||||||
|
- [OpenStreetMap](https://www.openstreetmap.org/)
|
||||||
|
- [Flickr](https://flickr.com)
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
- Nix
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
1. Install Nix (compatible with MacOS and Linux):
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
curl -L https://nixos.org/nix/install | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
There are alternative installation methods, if you don\'t want to pipe
|
||||||
|
curl to sh
|
||||||
|
|
||||||
|
2. Clone the repository:
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
git clone https://coolneng.duckdns.org/gitea/coolneng/graphPaname
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Change the working directory to the project:
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
cd graphPaname
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Enter the nix-shell:
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
nix-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run the tests:
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Execute the Flask application:
|
||||||
|
|
||||||
|
``` {.shell}
|
||||||
|
flask run
|
||||||
|
```
|
||||||
|
|
||||||
|
The website can be accessed via **localhost:5000**
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
* graphPaname
|
|
||||||
|
|
||||||
This project aims to gather information about the smart city of Paris and
|
|
||||||
organize it in different plots and tables.
|
|
||||||
@@ -5,6 +5,7 @@ from flask_bootstrap import Bootstrap
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.secret_key = SECRET_KEY
|
app.secret_key = SECRET_KEY
|
||||||
|
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||||
bootstrap = Bootstrap(app)
|
bootstrap = Bootstrap(app)
|
||||||
|
|
||||||
from app import errors, routes
|
from app import errors, routes
|
||||||
|
|||||||
@@ -4,5 +4,9 @@ from wtforms import SelectField, SubmitField
|
|||||||
|
|
||||||
|
|
||||||
class DatasetForm(FlaskForm):
|
class DatasetForm(FlaskForm):
|
||||||
|
"""
|
||||||
|
Web form to select a dataset
|
||||||
|
"""
|
||||||
|
|
||||||
dataset = SelectField(choices=CHOICES)
|
dataset = SelectField(choices=CHOICES)
|
||||||
submit = SubmitField("Submit")
|
submit = SubmitField("Submit")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def reverse_coordinates(row):
|
|||||||
"""
|
"""
|
||||||
Reverses each tuples coordinates to ensure folium can parse them correctly
|
Reverses each tuples coordinates to ensure folium can parse them correctly
|
||||||
"""
|
"""
|
||||||
coord = [tuple(reversed(t)) for t in row["fields.geo_shape.coordinates"]]
|
coord = [tuple(reversed(t)) for t in row]
|
||||||
return coord
|
return coord
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def visualization():
|
|||||||
|
|
||||||
@app.route("/map")
|
@app.route("/map")
|
||||||
def map():
|
def map():
|
||||||
return render_template("map.html", title="Map")
|
return render_template("map.html")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/photos")
|
@app.route("/photos")
|
||||||
|
|||||||
@@ -3,6 +3,24 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h1 id="graphPaname">graphPaname</h1>
|
<h1 id="graphPaname">graphPaname</h1>
|
||||||
<p>graphPaname is an information system that aims to show real-time data, related to the COVID-19 outbreak, in the city of Paris</p>
|
<p>
|
||||||
|
graphPaname is a system that collects real-time data, relevant to the COVID-19 pandemic de-escalation, from the city of Paris.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
It works with 4 datasets about the de-escalation:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="org-ul">
|
||||||
|
<li>Retailers with home delivery</li>
|
||||||
|
<li>Additional parking places in relay parkings (parkings connected to public transportation)</li>
|
||||||
|
<li>Temporary cycling paths</li>
|
||||||
|
<li>Temporary pedestrian streets</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
For each dataset, we offer a table with the data, and a map of Paris with markers. Additionally, there’s a section with photos related to the COVID-19 pandemic.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
{{ table|safe }}
|
{{ table|safe }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
<iframe class="map", src="/map" width="350" height="350"></iframe>
|
<iframe id="map", src="/map" width="350" height="350"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p><a href="{{ url_for('data') }}">Back</a></p>
|
<p><a href="{{ url_for('data') }}">Back</a></p>
|
||||||
|
|||||||
@@ -10,17 +10,8 @@ pkgs.mkShell {
|
|||||||
flask
|
flask
|
||||||
flask-bootstrap
|
flask-bootstrap
|
||||||
flask_wtf
|
flask_wtf
|
||||||
matplotlib
|
|
||||||
folium
|
folium
|
||||||
pytest
|
pytest
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
# Development tools
|
|
||||||
black
|
|
||||||
isort
|
|
||||||
pyflakes
|
|
||||||
python-language-server
|
|
||||||
pyls-black
|
|
||||||
pyls-isort
|
|
||||||
pyls-mypy
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from requests import get
|
|||||||
|
|
||||||
from app.preprocessing import create_dataframe
|
from app.preprocessing import create_dataframe
|
||||||
from app.data_request import request_dataset
|
from app.data_request import request_dataset
|
||||||
from constants import COLUMNS, DATASETS, DATASET_URL
|
from constants import COLUMNS, DATASETS, DATASET_URL, FLICKR_URL
|
||||||
|
|
||||||
|
|
||||||
def test_dataset_request():
|
def test_dataset_request():
|
||||||
@@ -23,3 +23,11 @@ def test_dataframe_creation():
|
|||||||
df = create_dataframe(dataset)
|
df = create_dataframe(dataset)
|
||||||
assert isinstance(df, DataFrame)
|
assert isinstance(df, DataFrame)
|
||||||
assert all(df.columns == COLUMNS[dataset])
|
assert all(df.columns == COLUMNS[dataset])
|
||||||
|
|
||||||
|
|
||||||
|
def test_flickr_request():
|
||||||
|
"""
|
||||||
|
Checks that Flickr search is avalaible
|
||||||
|
"""
|
||||||
|
response = get(FLICKR_URL.format("paris coronavirus"))
|
||||||
|
assert response.status_code == 200
|
||||||
|
|||||||
Reference in New Issue
Block a user