-
Notifications
You must be signed in to change notification settings - Fork 2
/
notes
38 lines (27 loc) · 1.25 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Show me data!
in python:
data, stuff, things
take those things, and show them to me in pretty ways
pipeline
mongo <-> python(stuff) <-> flask (to web) <-> javascript <-> d3 <-> d3 layouts
Not all of thes parts are necessary (like mongo)
First usecase
#!/usr/bin/env python
data_dict = {'a': {'b': 10, 'c': 10}, 'd': {'e' : 70, 'f': 5}, 'g': 5}
explore(data_dict, tree)
this will take the data_dictionary, push it to javascript,
convert it to json that fits a heirarchy layout
show it as a tree layout
To do this:
1) convert data dictionary to json object (of a certain structure)
2) serve up a template that requests for the data (ajax)
3) display template and data
--------------------- main object ----------------------------
register_type_conversion(dict, layout) : convert from python type to layout type
result = dict of dicts where k1 = python type, k2 = layout type, v = converter function
register_template(layout, filename) : show a layout
data : dictionary (gets fetched by /data/<layout>/<name> (or as certain layout??)
register_static_file(filename)
get_available_templates(layout) : get templates for a given layout
get_available_data(layout) : get data available for a given layout
get_layouts(data) : get available layouts for a given data object