Shorten form choices labels
This commit is contained in:
parent
7a459da204
commit
a36cc719ef
|
@ -2,7 +2,7 @@ from json import dump
|
||||||
|
|
||||||
from requests import get
|
from requests import get
|
||||||
|
|
||||||
from constants import FILES, URL
|
from constants import URL
|
||||||
|
|
||||||
|
|
||||||
def format_url(dataset) -> str:
|
def format_url(dataset) -> str:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
from constants import DATASETS
|
from constants import CHOICES
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import SelectField, SubmitField
|
from wtforms import SelectField, SubmitField
|
||||||
|
|
||||||
|
|
||||||
# NOTE The choices should be shorter
|
|
||||||
class DatasetForm(FlaskForm):
|
class DatasetForm(FlaskForm):
|
||||||
dataset = SelectField(choices=DATASETS)
|
dataset = SelectField(choices=CHOICES)
|
||||||
submit = SubmitField("Submit")
|
submit = SubmitField("Submit")
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
<h1>Dataset visualization</h1>
|
<h1>Dataset visualization</h1>
|
||||||
<img src="data:image/png;base64,{{ plot }}" alt="Plot Placeholder">
|
{{ table|safe }}
|
||||||
<img src="data:image/png;base64,{{ map }}" alt="Map Placeholder">
|
|
||||||
<p><a href="{{ url_for('data') }}">Back</a></p>
|
<p><a href="{{ url_for('data') }}">Back</a></p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
12
constants.py
12
constants.py
|
@ -5,12 +5,6 @@ DATASETS = [
|
||||||
"deconfinement-rues-amenagees-pour-pietons",
|
"deconfinement-rues-amenagees-pour-pietons",
|
||||||
]
|
]
|
||||||
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"
|
||||||
FILES = {
|
|
||||||
"deconfinement-pistes-cyclables-temporaires": "data/cycling-paths.json",
|
|
||||||
"deconfinement-parking-relais-doublement-des-places": "data/relay-parking.json",
|
|
||||||
"coronavirus-commercants-parisiens-livraison-a-domicile": "data/home-delivery.json",
|
|
||||||
"deconfinement-rues-amenagees-pour-pietons": "data/pedestrian-streets.json",
|
|
||||||
}
|
|
||||||
COLUMNS = {
|
COLUMNS = {
|
||||||
"deconfinement-pistes-cyclables-temporaires": [
|
"deconfinement-pistes-cyclables-temporaires": [
|
||||||
"fields.geo_shape.coordinates",
|
"fields.geo_shape.coordinates",
|
||||||
|
@ -47,5 +41,11 @@ COLUMNS = {
|
||||||
"record_timestamp",
|
"record_timestamp",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
CHOICES = [
|
||||||
|
("coronavirus-commercants-parisiens-livraison-a-domicile", "home-delivery"),
|
||||||
|
("deconfinement-pistes-cyclables-temporaires", "cycling-paths"),
|
||||||
|
("deconfinement-parking-relais-doublement-des-places", "relay-parking"),
|
||||||
|
("deconfinement-rues-amenagees-pour-pietons", "pedestrian-streets"),
|
||||||
|
]
|
||||||
SECRET_KEY = "trolaso"
|
SECRET_KEY = "trolaso"
|
||||||
COORDINATES = [48.864716, 2.349014]
|
COORDINATES = [48.864716, 2.349014]
|
||||||
|
|
|
@ -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, FILES, URL
|
from constants import COLUMNS, DATASETS, URL
|
||||||
|
|
||||||
|
|
||||||
def test_dataset_request():
|
def test_dataset_request():
|
||||||
|
|
Loading…
Reference in New Issue