updated presentation
This commit is contained in:
parent
96cc6abfa5
commit
2e9cdef714
2 changed files with 57 additions and 35 deletions
|
|
@ -29,23 +29,50 @@ app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
"""
|
||||||
|
Index page built by converting index.md to html, then inserting that into the index.html template
|
||||||
|
|
||||||
|
go to your base_url + / to view this page
|
||||||
|
"""
|
||||||
body = markdown.markdown(render_template('index.md'),
|
body = markdown.markdown(render_template('index.md'),
|
||||||
extensions=['markdown.extensions.fenced_code'])
|
extensions=['markdown.extensions.fenced_code'])
|
||||||
return render_template('index.html', body=body)
|
return render_template('index.html', body=body)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
# if this is ran as the main program run the app
|
||||||
|
# if the program is imported it will not run allowing us to reuse some components in other projects easily.
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Javascript
|
||||||
|
|
||||||
|
For the Enthusiast page we need to implement some javascript in order to update the page dynamically without a page refresh We need to implement a bit of javascript that will talk to our api and change the information on the page. Currently javascript is the only client side scripting language for the browser. There are a number of languages that can be transpiled into browser ready javascript, but javascript is the only language that run in the browser.
|
||||||
|
|
||||||
|
I believe that modern (ES6) is a much better language. It looks much closer to python than older javascript. Currently ES6 does not run in many browsers natively and needs to be compiled down to browser ready javascript. I am trying to keep this project very simple, and did not want a complicated build tool chain. If you are using javascript more often, or have a more complicated use case do yourself a favor and look into setting up build tools that compile ES6 to browser ready javascript. For this reason I have chosen to use jquery. It provides a simple interface into the features that I need, and runs natively in the browser.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
$('#top').change(function(){update_kpi()})
|
||||||
|
// ties the update function to the top div, and triggers an update any time there is a change in the top div that contains our form data
|
||||||
|
|
||||||
|
function update_kpi()
|
||||||
|
{
|
||||||
|
var url = '/api/score_timeseries?' + $('top').val()
|
||||||
|
var kpi_data = $.get(url); // gets the json response data from our python api
|
||||||
|
kpi_data.done(function(results) // waits for the response to come back from python
|
||||||
|
{
|
||||||
|
$('#gross').html(results.responseJSON.gross) // updates the gross kpi that sits in the gross div
|
||||||
|
})
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### [Slides](/slides)
|
### [Slides](/slides)
|
||||||
|
|
||||||
Since we are serving up a web app we can embrace the power and flexibility that this gives us. The slides for this event will be served along side of the visualization. This will make these slides available anywhere you have a connection to the web. These slides were written in markdown, and are very simple to write.
|
Since we are serving up a web app we can embrace the power and flexibility that this gives us. The slides for this event will be served along side of the visualization. This will make these slides available anywhere you have a connection to the web. These slides were written in markdown, and are very simple to write.
|
||||||
<div class="col6 center"><br></div>
|
<div class="col6 center"><br></div>
|
||||||
#### Example Markdown Code for Slides
|
#### Example Markdown Code for Slides
|
||||||
|
This file wil be placed into a slides.html template that has been setup to render reveal slides from markdown. The reveal.js web page has examples of how to setup the html. It will render typical markdown code as html, and will create a new slide at every ```----``` and a new fragment at every ```---```
|
||||||
``` markdown
|
``` markdown
|
||||||
|
|
||||||
# pyDataVizDay
|
# pyDataVizDay
|
||||||
*a python implementation for Data Viz Day*
|
*a python implementation for Data Viz Day*
|
||||||
|
|
||||||
|
|
@ -62,7 +89,6 @@ Since we are serving up a web app we can embrace the power and flexibility that
|
||||||
* Tools Used
|
* Tools Used
|
||||||
* Other Considerations
|
* Other Considerations
|
||||||
* Pros/Cons
|
* Pros/Cons
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### [api](/api/doc/#/pyDataVizDay)
|
### [api](/api/doc/#/pyDataVizDay)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# pyDataVizDay
|
# pyDataVizDay
|
||||||
|
---
|
||||||
*a python implementation for Data Viz Day*
|
*a python implementation for Data Viz Day*
|
||||||
|
|
||||||

|

|
||||||
|
|
@ -6,10 +7,9 @@
|
||||||
----
|
----
|
||||||
|
|
||||||
# Agenda
|
# Agenda
|
||||||
|
---
|
||||||
1. Viz Walk (3 Views)
|
1. Viz Walk (2 Views)
|
||||||
1. Full Web App
|
1. Full Web App
|
||||||
* Simple Web App
|
|
||||||
* Exploritory Notebook
|
* Exploritory Notebook
|
||||||
* Tools Used
|
* Tools Used
|
||||||
* Other Considerations
|
* Other Considerations
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## About Me
|
# About Me
|
||||||
|
---
|
||||||

|

|
||||||
|
|
||||||
Waylon Walker
|
Waylon Walker
|
||||||
|
|
@ -28,7 +28,7 @@ Product Engineering
|
||||||
----
|
----
|
||||||
|
|
||||||
# Open The Viz
|
# Open The Viz
|
||||||
|
---
|
||||||
[pydatavizday.herokuapp.com](pydatavizday.herokuapp.com)
|
[pydatavizday.herokuapp.com](pydatavizday.herokuapp.com)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -39,7 +39,7 @@ Product Engineering
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## External Resources
|
# External Resources
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -90,10 +90,12 @@ Python
|
||||||
----
|
----
|
||||||
|
|
||||||
## Other Considerations
|
## Other Considerations
|
||||||
|
---
|
||||||
* Jupyter Notebooks
|
* Jupyter Notebooks
|
||||||
* Jupyter Dashboards
|
* Jupyter Dashboards
|
||||||
* DASH (just released in mid JUNE)
|
* DASH (just released in mid JUNE)
|
||||||
|
* Bokeh
|
||||||
|
* Data shader
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -125,7 +127,7 @@ Python
|
||||||
----
|
----
|
||||||
|
|
||||||
## Pros of Python
|
## Pros of Python
|
||||||
|
---
|
||||||
* Fast High Level Data Science
|
* Fast High Level Data Science
|
||||||
* reusable
|
* reusable
|
||||||
* Powerful Web stack
|
* Powerful Web stack
|
||||||
|
|
@ -142,20 +144,17 @@ python has a vast ecosysytem for data wrangling
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import glob, os
|
|
||||||
|
|
||||||
path = "C:/reports"
|
raw_example = pd.read_csv('example_data.csv')
|
||||||
files = glob.glob(path + os.sep + '*_report.csv*')
|
|
||||||
|
|
||||||
frames = []
|
example = (raw_example
|
||||||
for file in files:
|
.groupby(['Date'])
|
||||||
frames.append(pd.read_csv(file))
|
.sum()
|
||||||
|
.resample('m')
|
||||||
all_reports = (pd.concat(frames)
|
.fillna(0)
|
||||||
.dropna()
|
|
||||||
.query('DIVISION == ACCOUNTING')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
example.plot()
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -176,19 +175,23 @@ data.update()
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
The ability to easily reuse code/datasets/plot gives us the ability to spend time making large projects more .
|
Well written tests give us the confidence to push to production without manually spending our own time testing each feature of our end product.
|
||||||
|
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
|
import unittest
|
||||||
|
import etl
|
||||||
|
|
||||||
class Testdata(unittest.TestCase):
|
class Testdata(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
Test suite for my dataframe data
|
Test suite for my dataframe data
|
||||||
"""
|
"""
|
||||||
|
def setUp(self):
|
||||||
|
self.data = etl.Data()
|
||||||
|
important_cols = ['DATE', 'PRODUCT', 'QTY']
|
||||||
|
|
||||||
def test_cols(self):
|
def test_cols(self):
|
||||||
for col in important_cols:
|
for col in important_cols:
|
||||||
self.assertLess(len(data[data[col].isnull()]), 0, msg=f'column {col} has unexpected null values')
|
self.assertIn(col, sdata.columns.tolist())
|
||||||
self.assertIn(col, data.columns.tolist(), msg=f'column {col} is missing - check the /data/raw/shipments.csv file to ensure logistics has not changed the data format')
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -227,10 +230,9 @@ else:
|
||||||
----
|
----
|
||||||
|
|
||||||
## Cons on python
|
## Cons on python
|
||||||
|
---
|
||||||
* Code
|
* Code
|
||||||
* Interactivity
|
* Interactivity
|
||||||
* Speed
|
|
||||||
* ML research
|
* ML research
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -244,12 +246,6 @@ else:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Slow
|
|
||||||
|
|
||||||
*slow runtime compared to statically typed languages (c, java)*
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Latest ML aglorithms are typically developed in R
|
### Latest ML aglorithms are typically developed in R
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue