Giter Site home page Giter Site logo

frontend-dash's People

Contributors

epogrebnyak avatar perevedko avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

frontend-dash's Issues

current version cannot start locally

  File "D:\Continuum\Anaconda3\lib\site-packages\werkzeug\serving.py", line 691, in run_simple
    s.bind((hostname, port))

OSError: [WinError 10013] Сделана попытка доступа к сокету методом, запрещенным правами доступа

group selector for variable list

1. Group selector added before each variable name selector.

We now have 2 variables selectors. For each of these selectors I would like to have a two selectors(dropdown menus) on one line: one chooses varibale group (eg GDP components, Prices, Foreign Trade) and the other chooses a ariable from a smaller list.

Need a) loyout for this on a separate branch b) data structure, c) callbacks.

add 1 integration test

Am integration test must:

  • show the application displays first page
  • run on travis (minimal setup on travis is preferred)

Make table for variable information

frontend-dash/app.py

Lines 276 to 313 in f9fea1b

# --------------------------------------------------------------------------
# FIMXE: this is a call back to update variabl einformation on the screen, it is
# a draft / placeholder
#
# Needed following change
#
# a. Layout: make every variable information block an html table
#
# Variable BRENT
# Frequency: d
# Start: 1987-05-20
# End: 2017-10-30
# Latest value: 60.65
# Download: <api/datapoints?freq=d&name=BRENT&format=csv>
# Short link: <oil/series/BRENT/d>
# More info: <api/info?name=BRENT>
#
# b. content - retrieve this data from api/info?name=BRENT
#
# c. NOT TODO: update with slider change ?
# start placeholders for variable information
@app.callback(output=Output('var1-info', 'children'),
inputs=[Input('frequency', component_property='value'),
Input('name1', component_property='value')
])
def update_varinfo1(freq, name):
return varinfo(freq, name)
@app.callback(output=Output('var2-info', 'children'),
inputs=[Input('frequency', component_property='value'),
Input('name2', component_property='value')
])
def update_varinfo2(freq, name):
return varinfo(freq, name)
# end placeholders for variable information
# ------------------------------------------------------------------------

change `Download data` to one link

We currently have:

Download data: q_GDP_yoy.csv q_CPI_rog.csv. 

This should link to:

Download data: csv

with proper start date.

Links to individual files should appear in variable information.

current version crahes in heroku

2017-11-01T15:07:36.729843+00:00 heroku[router]: at=info method=POST path="/_dash-update-component" host=macrodash.herokuapp.com request_id=796fd55c-29b8-4178-acf1-ce3f90e1010e fwd="91.220.93.136" dyno=web.1 connect=0ms service=3ms status=200 bytes=419 protocol=https

2017-11-01T15:07:36.918710+00:00 heroku[router]: at=info method=POST path="/_dash-update-component" host=macrodash.herokuapp.com request_id=1277318b-79b8-490e-bb8f-45d4771191d9 fwd="91.220.93.136" dyno=web.1 connect=0ms service=191ms status=500 bytes=456 protocol=https

2017-11-01T15:07:36.914720+00:00 app[web.1]: [2017-11-01 15:07:36,914] ERROR in app: Exception on /_dash-update-component [POST]

2017-11-01T15:07:36.914737+00:00 app[web.1]: Traceback (most recent call last):

2017-11-01T15:07:36.914740+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app

2017-11-01T15:07:36.914741+00:00 app[web.1]:     response = self.full_dispatch_request()

2017-11-01T15:07:36.914742+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request

2017-11-01T15:07:36.914742+00:00 app[web.1]:     rv = self.handle_user_exception(e)

2017-11-01T15:07:36.914743+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception

2017-11-01T15:07:36.914744+00:00 app[web.1]:     reraise(exc_type, exc_value, tb)

2017-11-01T15:07:36.914744+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise

2017-11-01T15:07:36.914745+00:00 app[web.1]:     raise value

2017-11-01T15:07:36.914746+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request

2017-11-01T15:07:36.914747+00:00 app[web.1]:     rv = self.dispatch_request()

2017-11-01T15:07:36.914747+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request

2017-11-01T15:07:36.914748+00:00 app[web.1]:     return self.view_functions[rule.endpoint](**req.view_args)

2017-11-01T15:07:36.914749+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 541, in dispatch

2017-11-01T15:07:36.914750+00:00 app[web.1]:     return self.callback_map[target_id]['callback'](*args)

2017-11-01T15:07:36.914750+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 498, in add_context

2017-11-01T15:07:36.914751+00:00 app[web.1]:     output_value = func(*args, **kwargs)

2017-11-01T15:07:36.914751+00:00 app[web.1]:   File "/app/app.py", line 132, in update_graph_parameters

2017-11-01T15:07:36.914752+00:00 app[web.1]:     data_list = [get_time_series_dict(freq, name1)]

2017-11-01T15:07:36.914753+00:00 app[web.1]:   File "/app/app.py", line 81, in get_time_series_dict

2017-11-01T15:07:36.914753+00:00 app[web.1]:     data = get_from_api_datapoints(freq, name)

2017-11-01T15:07:36.914754+00:00 app[web.1]:   File "/app/app.py", line 74, in get_from_api_datapoints

2017-11-01T15:07:36.914754+00:00 app[web.1]:     data = requests.get(url).json()

2017-11-01T15:07:36.914755+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/requests/models.py", line 892, in json

2017-11-01T15:07:36.914756+00:00 app[web.1]:     return complexjson.loads(self.text, **kwargs)

2017-11-01T15:07:36.914757+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/json/__init__.py", line 354, in loads

2017-11-01T15:07:36.914758+00:00 app[web.1]:     return _default_decoder.decode(s)

2017-11-01T15:07:36.914758+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/json/decoder.py", line 339, in decode

2017-11-01T15:07:36.914759+00:00 app[web.1]:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())

2017-11-01T15:07:36.914760+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/json/decoder.py", line 357, in raw_decode

2017-11-01T15:07:36.914760+00:00 app[web.1]:     raise JSONDecodeError("Expecting value", s, err.value) from None

2017-11-01T15:07:36.914765+00:00 app[web.1]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

URLs to access specific plot in browser

I have an app in plotly/Dash, that draws some charts. Dash produces JavaScript code,
which is rendered by browser. In is working fairly nicely, but has one limitation:
once it is browser-side Javascript code, there is just one address for the whole application.

App: http://macrodash.herokuapp.com
Code: https://github.com/mini-kep/frontend-dash/blob/master/app.py

My desired behaviour is the following: I want to have URLs that link to
to specific charts, eg:

It is a bit tricky to do that with Dash and Flask.

In Dash there are callbacks to update/reload browser address:

https://plot.ly/dash/urls

This functionality is ok for changing the addresses once you are at http://macrodash.herokuapp.com and further navigate by selecting variable names and frequencies.

What I'm lacking now is the landing page functionality: how can I type and addrress like http://macrodash.herokuapp.com/q/GDP_yoy+CPI_rog in the browser and further find myself on a page with these indicators plotted?

This functionality involves wrapping Dash with Flask, and I could not find an easy way to do that. Th possible routes are outlined here: plotly/dash#38 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.