Shorten form choices labels

This commit is contained in:
coolneng 2020-06-14 00:14:09 +02:00
parent 7a459da204
commit a36cc719ef
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
5 changed files with 11 additions and 13 deletions

View File

@ -2,7 +2,7 @@ from json import dump
from requests import get
from constants import FILES, URL
from constants import URL
def format_url(dataset) -> str:

View File

@ -1,9 +1,8 @@
from constants import DATASETS
from constants import CHOICES
from flask_wtf import FlaskForm
from wtforms import SelectField, SubmitField
# NOTE The choices should be shorter
class DatasetForm(FlaskForm):
dataset = SelectField(choices=DATASETS)
dataset = SelectField(choices=CHOICES)
submit = SubmitField("Submit")

View File

@ -3,7 +3,6 @@
{% block app_content %}
<h1>Dataset visualization</h1>
<img src="data:image/png;base64,{{ plot }}" alt="Plot Placeholder">
<img src="data:image/png;base64,{{ map }}" alt="Map Placeholder">
{{ table|safe }}
<p><a href="{{ url_for('data') }}">Back</a></p>
{% endblock %}

View File

@ -5,12 +5,6 @@ DATASETS = [
"deconfinement-rues-amenagees-pour-pietons",
]
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 = {
"deconfinement-pistes-cyclables-temporaires": [
"fields.geo_shape.coordinates",
@ -47,5 +41,11 @@ COLUMNS = {
"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"
COORDINATES = [48.864716, 2.349014]

View File

@ -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, FILES, URL
from constants import COLUMNS, DATASETS, URL
def test_dataset_request():