Compare commits
No commits in common. "8307a54fe046815f5cae8a5f9bc18558484c6180" and "ec1729e92c3e5588d68f9afab900e797d486c19f" have entirely different histories.
8307a54fe0
...
ec1729e92c
@ -4,14 +4,14 @@ from typing import List
|
||||
from bs4 import BeautifulSoup
|
||||
from requests import get
|
||||
|
||||
from constants import FLICKR_URL, DATASET_URL
|
||||
from constants import FLICKR_URL, URL
|
||||
|
||||
|
||||
def format_url(dataset) -> str:
|
||||
"""
|
||||
Constructs the API's URL for the requested dataset
|
||||
"""
|
||||
link = DATASET_URL.format(dataset)
|
||||
link = URL.format(dataset)
|
||||
return link
|
||||
|
||||
|
||||
|
@ -21,6 +21,5 @@ def create_map(df):
|
||||
"""
|
||||
m = Map(location=COORDINATES, zoom_start=12)
|
||||
for index, row in df.iterrows():
|
||||
lng, lat = row["fields.geo_shape.coordinates"]
|
||||
Marker(location=[lat, lng]).add_to(m)
|
||||
Marker(location=row["fields.geo_shape.coordinates"]).add_to(m)
|
||||
m.save("app/templates/map.html")
|
||||
|
@ -3,7 +3,7 @@ from app.preprocessing import create_dataframe, create_map
|
||||
|
||||
def create_table(df) -> str:
|
||||
df.fillna(value=0, inplace=True)
|
||||
table = df.to_html(classes=["table-striped", "table-sm", "table-responsive"])
|
||||
table = df.to_html(classes=["table-striped", "table-hover"])
|
||||
return table
|
||||
|
||||
|
||||
|
@ -33,5 +33,5 @@ def map():
|
||||
|
||||
@app.route("/photos")
|
||||
def photos():
|
||||
images = scrape_flickr("paris coronavirus")
|
||||
images = scrape_flickr("paris")
|
||||
return render_template("photos.html", title="Photos", images=images)
|
||||
|
@ -3,13 +3,9 @@
|
||||
|
||||
{% block app_content %}
|
||||
<h1>Dataset visualization</h1>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<iframe class="map", src="/map" width="400" height="400"></iframe>
|
||||
<table style="margin-left: 350px;">
|
||||
{{ table|safe }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<iframe class="map", src="/map" width="350" height="350"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</table>
|
||||
<p><a href="{{ url_for('data') }}">Back</a></p>
|
||||
{% endblock %}
|
||||
|
@ -4,7 +4,7 @@ DATASETS = [
|
||||
"deconfinement-parking-relais-doublement-des-places",
|
||||
"deconfinement-rues-amenagees-pour-pietons",
|
||||
]
|
||||
DATASET_URL = "https://opendata.paris.fr/api/records/1.0/search/?dataset={}&q=&rows=-1"
|
||||
URL = "https://opendata.paris.fr/api/records/1.0/search/?dataset={}&q=&rows=-1"
|
||||
FLICKR_URL = "https://www.flickr.com/search/?text={}"
|
||||
COLUMNS = {
|
||||
"deconfinement-pistes-cyclables-temporaires": [
|
||||
|
@ -3,7 +3,7 @@ from requests import get
|
||||
|
||||
from app.preprocessing import create_dataframe
|
||||
from app.data_request import request_dataset
|
||||
from constants import COLUMNS, DATASETS, DATASET_URL
|
||||
from constants import COLUMNS, DATASETS, URL
|
||||
|
||||
|
||||
def test_dataset_request():
|
||||
@ -11,7 +11,7 @@ def test_dataset_request():
|
||||
Checks that the datasets URLs are reachable
|
||||
"""
|
||||
for dataset in DATASETS:
|
||||
response = get(DATASET_URL.format(dataset))
|
||||
response = get(URL.format(dataset))
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user