SlideShare una empresa de Scribd logo
1 de 15
Dash
Appsilon tech talks | Damian | 04/04/2018
Overview of Dash framework for building dashboards
What is Dash?
● Dash is a productive Python framework for building web applications.
● Created and maintained by Plotly. https://plot.ly/products/dash/.
● Written on top of Flask, Plotly.js, and React.js.
● Dashboard is implemented in pure Python.
● Dash is an open source library, released under the permissive MIT license.
What you get with Dash
● Frontend generated in Python
● Reactive computations abstraction
● Component class for every HTML tag as well as keyword arguments for all of the HTML arguments implemented in
dash_html_components package
● Interactive html elements implemented in dash-core-components
● Plotly python API implemented in dash-core-components available through Graph class
Dash demo
https://github.com/DamianRodziewicz/dash_example
app.py
What you see in the code
● The layout is composed of a tree of "components" like html.Div and dcc.Graph.
● The dash_html_components library has a component for every HTML tag. The html.H1(children='Hello Dash') component
generates a <h1>Hello Dash</h1> HTML element in your application.
● Not all components are pure HTML. The dash_core_components describe higher-level components that are interactive and are
generated with JavaScript, HTML, and CSS through the React.js library.
● Each component is described entirely through keyword attributes. Dash is declarative: you will primarily describe your
application through these attributes.
● The children property is special. By convention, it's always the first attribute which means that you can omit it:
html.H1(children='Hello Dash') is the same as html.H1('Hello Dash'). Also, it can contain a string, a number, a single component,
or a list of components.
● Attribute 'class' is replaced with 'className'.
● Style attribute can be a python dictionary.
● Attributes cannot have hyphen in name. If you need to write something like 'margin-left', you have to write 'marginLeft' instead.
● Attribute values must be serializable to JSON.
Interactivity
● The "inputs" and "outputs" of our application interface are described declaratively through the app.callback decorator.
● The inputs and outputs of our application are simply the properties of a particular component.
● Any "Output" can have multiple "Input" components.
○ @app.callback(Output('indicator-graphic', 'figure'),
[Input('xaxis-column', 'value'), Input('yaxis-column', 'value'), Input('year--slider', 'value')])
def update_graph(xaxis_value, yaxis_value, year_slider_value): …
● Each Dash callback function can only update a single Output property.
○ To update multiple Outputs, you have to write multiple functions.
● "State" allows you to pass along extra values without firing the callbacks.
○ @app.callback(Output('indicator-graphic', 'figure'),
[Input('xaxis-column', 'value'), Input('yaxis-column', 'value')],
[State('year--slider', 'value')])
def update_graph(xaxis_value, yaxis_value, year_slider_value): …
● There are no intermediate values in the reactive graph.
○ You have to add hidden div with intermediate data (as suggested by plotly)
○ Or you have to use redis to store intermediate values (as suggested by plotly)
How does this work?
● Declare app layout. It will generate react code that will be run in the browser.
● Each element has attributes that describe its state.
○ You can change them which makes the app re-render itself.
○ You can listen on any changes to those attributes and run callbacks.
● Frontend sends HTTP request every time an input is changed.
● Backend recalculates the graph of dependencies and sends back the list of changes to frontend.
One more look
into the code
https://github.com/DamianRodziewicz/dash_example
app.py
Dash core components
● Dropdown
● Slider
● RangeSlider
● Input
● TextArea
● Checkboxes
● RadioItems
● Button
● DatePickerSingle
● DatePickerRange
● Markdown
● Upload component
● Tabs
● Graph - component shares the same syntax as the open-source plotly.py library. See https://plot.ly/python/ for reference
● Interactive Table - under development in https://github.com/plotly/dash-table-experiments repository
Dash custom components - Dash semantic
● You can implement your own components in Dash. For more information on how to do that visit https://dash.plot.ly/plugins
● We have started implementing our own components and helpers in https://github.com/Appsilon/dash-semantic
○ Leaflet map
○ Timeline (react horizontal timeline port)
○ Mixpanel hook (to allow using Mixpanel with frontend plugin that identifies user by cookie)
○ IncludeScript (includes and runs an external script on demand - useful if app runs in local mode)
● We’ll cover this library (and instructions on using it in your project) in separate tech talk.
Dash blocking
computations demo
https://github.com/DamianRodziewicz/dash_example
longer_computations_app.py
Single threaded Dash
● Graph recalculation is blocking and is single threaded
● However we can extract the flask server that is generated and use gunicorn to make the computations concurrent
● http://gunicorn.org/ - Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model. The
Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly
speedy.
● Seems to still have a limit on concurrent users.
Dash threading
with gunicorn
https://github.com/DamianRodziewicz/dash_example
longer_computations_app.py
Dash limitations
● We don’t know how it scales for many concurrent users
● At some point you will need more sophisticated components than Dash provides by default
○ You’ll have to write your own components in React.js
○ Or you’ll have to port already existing components from React.js to Dash
● You’ll quickly find out that some quick wins are still under development (Mapbox raster example)
● There are no intermediate values in the reactive graph.
○ You have to add hidden div with intermediate data (as suggested by plotly)
● You have to write separate function for every Output which forces you to restructure the code
● There are some issues we may not be able to resolve without getting to know the way Dash works by heart
● There may be still some issues with Dash that we don’t know about - we have to add a margin to our work
Thanks!

Más contenido relacionado

La actualidad más candente

PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...
PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...
PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...Edureka!
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheDremio Corporation
 
Cosco: An Efficient Facebook-Scale Shuffle Service
Cosco: An Efficient Facebook-Scale Shuffle ServiceCosco: An Efficient Facebook-Scale Shuffle Service
Cosco: An Efficient Facebook-Scale Shuffle ServiceDatabricks
 
Simplifying Big Data Analytics with Apache Spark
Simplifying Big Data Analytics with Apache SparkSimplifying Big Data Analytics with Apache Spark
Simplifying Big Data Analytics with Apache SparkDatabricks
 
Prometheus – a next-gen Monitoring System
Prometheus – a next-gen Monitoring SystemPrometheus – a next-gen Monitoring System
Prometheus – a next-gen Monitoring SystemFabian Reinartz
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeDatabricks
 
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...HostedbyConfluent
 
PySpark dataframe
PySpark dataframePySpark dataframe
PySpark dataframeJaemun Jung
 
Siligong.Data - May 2021 - Transforming your analytics workflow with dbt
Siligong.Data - May 2021 - Transforming your analytics workflow with dbtSiligong.Data - May 2021 - Transforming your analytics workflow with dbt
Siligong.Data - May 2021 - Transforming your analytics workflow with dbtJon Su
 
Architecting Agile Data Applications for Scale
Architecting Agile Data Applications for ScaleArchitecting Agile Data Applications for Scale
Architecting Agile Data Applications for ScaleDatabricks
 
Diving into Delta Lake: Unpacking the Transaction Log
Diving into Delta Lake: Unpacking the Transaction LogDiving into Delta Lake: Unpacking the Transaction Log
Diving into Delta Lake: Unpacking the Transaction LogDatabricks
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkDatabricks
 
Data Mesh Part 4 Monolith to Mesh
Data Mesh Part 4 Monolith to MeshData Mesh Part 4 Monolith to Mesh
Data Mesh Part 4 Monolith to MeshJeffrey T. Pollock
 
Introduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingIntroduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingTill Rohrmann
 
Deep Dive into Building Streaming Applications with Apache Pulsar
Deep Dive into Building Streaming Applications with Apache Pulsar Deep Dive into Building Streaming Applications with Apache Pulsar
Deep Dive into Building Streaming Applications with Apache Pulsar Timothy Spann
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDatabricks
 
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Timothy Spann
 
Snowflake: The most cost-effective agile and scalable data warehouse ever!
Snowflake: The most cost-effective agile and scalable data warehouse ever!Snowflake: The most cost-effective agile and scalable data warehouse ever!
Snowflake: The most cost-effective agile and scalable data warehouse ever!Visual_BI
 

La actualidad más candente (20)

PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...
PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...
PySpark Programming | PySpark Concepts with Hands-On | PySpark Training | Edu...
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
 
Cosco: An Efficient Facebook-Scale Shuffle Service
Cosco: An Efficient Facebook-Scale Shuffle ServiceCosco: An Efficient Facebook-Scale Shuffle Service
Cosco: An Efficient Facebook-Scale Shuffle Service
 
Simplifying Big Data Analytics with Apache Spark
Simplifying Big Data Analytics with Apache SparkSimplifying Big Data Analytics with Apache Spark
Simplifying Big Data Analytics with Apache Spark
 
Prometheus – a next-gen Monitoring System
Prometheus – a next-gen Monitoring SystemPrometheus – a next-gen Monitoring System
Prometheus – a next-gen Monitoring System
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta Lake
 
Dive into PySpark
Dive into PySparkDive into PySpark
Dive into PySpark
 
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
 
PySpark dataframe
PySpark dataframePySpark dataframe
PySpark dataframe
 
Azure Data Engineering.pptx
Azure Data Engineering.pptxAzure Data Engineering.pptx
Azure Data Engineering.pptx
 
Siligong.Data - May 2021 - Transforming your analytics workflow with dbt
Siligong.Data - May 2021 - Transforming your analytics workflow with dbtSiligong.Data - May 2021 - Transforming your analytics workflow with dbt
Siligong.Data - May 2021 - Transforming your analytics workflow with dbt
 
Architecting Agile Data Applications for Scale
Architecting Agile Data Applications for ScaleArchitecting Agile Data Applications for Scale
Architecting Agile Data Applications for Scale
 
Diving into Delta Lake: Unpacking the Transaction Log
Diving into Delta Lake: Unpacking the Transaction LogDiving into Delta Lake: Unpacking the Transaction Log
Diving into Delta Lake: Unpacking the Transaction Log
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache Spark
 
Data Mesh Part 4 Monolith to Mesh
Data Mesh Part 4 Monolith to MeshData Mesh Part 4 Monolith to Mesh
Data Mesh Part 4 Monolith to Mesh
 
Introduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingIntroduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processing
 
Deep Dive into Building Streaming Applications with Apache Pulsar
Deep Dive into Building Streaming Applications with Apache Pulsar Deep Dive into Building Streaming Applications with Apache Pulsar
Deep Dive into Building Streaming Applications with Apache Pulsar
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache Spark
 
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
 
Snowflake: The most cost-effective agile and scalable data warehouse ever!
Snowflake: The most cost-effective agile and scalable data warehouse ever!Snowflake: The most cost-effective agile and scalable data warehouse ever!
Snowflake: The most cost-effective agile and scalable data warehouse ever!
 

Similar a Tech Talk - Overview of Dash framework for building dashboards

A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsDaniel Koller
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...Codemotion
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
GDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJSGDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJSPratik Majumdar
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RPaul Richards
 
Developing Spatial Applications with CARTO for React v1.1
Developing Spatial Applications with CARTO for React v1.1Developing Spatial Applications with CARTO for React v1.1
Developing Spatial Applications with CARTO for React v1.1CARTO
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013Andy Bunce
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom componentsJeremy Grancher
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
Introduction to interactive data visualisation using R Shiny
Introduction to interactive data visualisation using R ShinyIntroduction to interactive data visualisation using R Shiny
Introduction to interactive data visualisation using R Shinyanamarisaguedes
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDKdigitaljoni
 
Hands on react native
Hands on react nativeHands on react native
Hands on react nativeJay Nagar
 
React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)Jarek Potiuk
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
 

Similar a Tech Talk - Overview of Dash framework for building dashboards (20)

A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny Apps
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
CS267_Graph_Lab
CS267_Graph_LabCS267_Graph_Lab
CS267_Graph_Lab
 
GDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJSGDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJS
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in R
 
Developing Spatial Applications with CARTO for React v1.1
Developing Spatial Applications with CARTO for React v1.1Developing Spatial Applications with CARTO for React v1.1
Developing Spatial Applications with CARTO for React v1.1
 
Dash Intro.pdf
Dash Intro.pdfDash Intro.pdf
Dash Intro.pdf
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Introduction to interactive data visualisation using R Shiny
Introduction to interactive data visualisation using R ShinyIntroduction to interactive data visualisation using R Shiny
Introduction to interactive data visualisation using R Shiny
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
Hands on react native
Hands on react nativeHands on react native
Hands on react native
 
React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)
 
Dust.js
Dust.jsDust.js
Dust.js
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
 
Django wrapper
Django wrapperDjango wrapper
Django wrapper
 

Más de Appsilon Data Science

User! 2019 best practices for building shiny enterprise applications
User! 2019  best practices for building shiny enterprise applicationsUser! 2019  best practices for building shiny enterprise applications
User! 2019 best practices for building shiny enterprise applicationsAppsilon Data Science
 
Styling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projectsStyling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projectsAppsilon Data Science
 
Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)Appsilon Data Science
 
Successful Machine Learning projects in Fintech
Successful Machine Learning projects in FintechSuccessful Machine Learning projects in Fintech
Successful Machine Learning projects in FintechAppsilon Data Science
 
Tech talk - Data Validation with assertr
Tech talk - Data Validation with assertrTech talk - Data Validation with assertr
Tech talk - Data Validation with assertrAppsilon Data Science
 
Marek Rogala's Talk at User2017 on shiny.collections
Marek Rogala's Talk at User2017 on shiny.collectionsMarek Rogala's Talk at User2017 on shiny.collections
Marek Rogala's Talk at User2017 on shiny.collectionsAppsilon Data Science
 
Scaling Shiny Apps - EARL 2017 San Francisco
Scaling Shiny Apps - EARL 2017 San Francisco Scaling Shiny Apps - EARL 2017 San Francisco
Scaling Shiny Apps - EARL 2017 San Francisco Appsilon Data Science
 

Más de Appsilon Data Science (10)

User! 2019 best practices for building shiny enterprise applications
User! 2019  best practices for building shiny enterprise applicationsUser! 2019  best practices for building shiny enterprise applications
User! 2019 best practices for building shiny enterprise applications
 
Styling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projectsStyling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projects
 
SCRUM in Data Science
SCRUM in Data ScienceSCRUM in Data Science
SCRUM in Data Science
 
Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)
 
Successful Machine Learning projects in Fintech
Successful Machine Learning projects in FintechSuccessful Machine Learning projects in Fintech
Successful Machine Learning projects in Fintech
 
Making shiny shine brighter
Making shiny shine brighterMaking shiny shine brighter
Making shiny shine brighter
 
Tech talk - Data Validation with assertr
Tech talk - Data Validation with assertrTech talk - Data Validation with assertr
Tech talk - Data Validation with assertr
 
Marek Rogala's Talk at User2017 on shiny.collections
Marek Rogala's Talk at User2017 on shiny.collectionsMarek Rogala's Talk at User2017 on shiny.collections
Marek Rogala's Talk at User2017 on shiny.collections
 
Scaling Shiny Apps - EARL 2017 San Francisco
Scaling Shiny Apps - EARL 2017 San Francisco Scaling Shiny Apps - EARL 2017 San Francisco
Scaling Shiny Apps - EARL 2017 San Francisco
 
Open Data - Rada Innowacyjności
Open Data - Rada InnowacyjnościOpen Data - Rada Innowacyjności
Open Data - Rada Innowacyjności
 

Último

Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 

Último (20)

CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 

Tech Talk - Overview of Dash framework for building dashboards

  • 1. Dash Appsilon tech talks | Damian | 04/04/2018 Overview of Dash framework for building dashboards
  • 2. What is Dash? ● Dash is a productive Python framework for building web applications. ● Created and maintained by Plotly. https://plot.ly/products/dash/. ● Written on top of Flask, Plotly.js, and React.js. ● Dashboard is implemented in pure Python. ● Dash is an open source library, released under the permissive MIT license.
  • 3. What you get with Dash ● Frontend generated in Python ● Reactive computations abstraction ● Component class for every HTML tag as well as keyword arguments for all of the HTML arguments implemented in dash_html_components package ● Interactive html elements implemented in dash-core-components ● Plotly python API implemented in dash-core-components available through Graph class
  • 5. What you see in the code ● The layout is composed of a tree of "components" like html.Div and dcc.Graph. ● The dash_html_components library has a component for every HTML tag. The html.H1(children='Hello Dash') component generates a <h1>Hello Dash</h1> HTML element in your application. ● Not all components are pure HTML. The dash_core_components describe higher-level components that are interactive and are generated with JavaScript, HTML, and CSS through the React.js library. ● Each component is described entirely through keyword attributes. Dash is declarative: you will primarily describe your application through these attributes. ● The children property is special. By convention, it's always the first attribute which means that you can omit it: html.H1(children='Hello Dash') is the same as html.H1('Hello Dash'). Also, it can contain a string, a number, a single component, or a list of components. ● Attribute 'class' is replaced with 'className'. ● Style attribute can be a python dictionary. ● Attributes cannot have hyphen in name. If you need to write something like 'margin-left', you have to write 'marginLeft' instead. ● Attribute values must be serializable to JSON.
  • 6. Interactivity ● The "inputs" and "outputs" of our application interface are described declaratively through the app.callback decorator. ● The inputs and outputs of our application are simply the properties of a particular component. ● Any "Output" can have multiple "Input" components. ○ @app.callback(Output('indicator-graphic', 'figure'), [Input('xaxis-column', 'value'), Input('yaxis-column', 'value'), Input('year--slider', 'value')]) def update_graph(xaxis_value, yaxis_value, year_slider_value): … ● Each Dash callback function can only update a single Output property. ○ To update multiple Outputs, you have to write multiple functions. ● "State" allows you to pass along extra values without firing the callbacks. ○ @app.callback(Output('indicator-graphic', 'figure'), [Input('xaxis-column', 'value'), Input('yaxis-column', 'value')], [State('year--slider', 'value')]) def update_graph(xaxis_value, yaxis_value, year_slider_value): … ● There are no intermediate values in the reactive graph. ○ You have to add hidden div with intermediate data (as suggested by plotly) ○ Or you have to use redis to store intermediate values (as suggested by plotly)
  • 7. How does this work? ● Declare app layout. It will generate react code that will be run in the browser. ● Each element has attributes that describe its state. ○ You can change them which makes the app re-render itself. ○ You can listen on any changes to those attributes and run callbacks. ● Frontend sends HTTP request every time an input is changed. ● Backend recalculates the graph of dependencies and sends back the list of changes to frontend.
  • 8. One more look into the code https://github.com/DamianRodziewicz/dash_example app.py
  • 9. Dash core components ● Dropdown ● Slider ● RangeSlider ● Input ● TextArea ● Checkboxes ● RadioItems ● Button ● DatePickerSingle ● DatePickerRange ● Markdown ● Upload component ● Tabs ● Graph - component shares the same syntax as the open-source plotly.py library. See https://plot.ly/python/ for reference ● Interactive Table - under development in https://github.com/plotly/dash-table-experiments repository
  • 10. Dash custom components - Dash semantic ● You can implement your own components in Dash. For more information on how to do that visit https://dash.plot.ly/plugins ● We have started implementing our own components and helpers in https://github.com/Appsilon/dash-semantic ○ Leaflet map ○ Timeline (react horizontal timeline port) ○ Mixpanel hook (to allow using Mixpanel with frontend plugin that identifies user by cookie) ○ IncludeScript (includes and runs an external script on demand - useful if app runs in local mode) ● We’ll cover this library (and instructions on using it in your project) in separate tech talk.
  • 12. Single threaded Dash ● Graph recalculation is blocking and is single threaded ● However we can extract the flask server that is generated and use gunicorn to make the computations concurrent ● http://gunicorn.org/ - Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy. ● Seems to still have a limit on concurrent users.
  • 14. Dash limitations ● We don’t know how it scales for many concurrent users ● At some point you will need more sophisticated components than Dash provides by default ○ You’ll have to write your own components in React.js ○ Or you’ll have to port already existing components from React.js to Dash ● You’ll quickly find out that some quick wins are still under development (Mapbox raster example) ● There are no intermediate values in the reactive graph. ○ You have to add hidden div with intermediate data (as suggested by plotly) ● You have to write separate function for every Output which forces you to restructure the code ● There are some issues we may not be able to resolve without getting to know the way Dash works by heart ● There may be still some issues with Dash that we don’t know about - we have to add a margin to our work