Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0aec916
Added Oliver Steeles example code on interactive maps
laurengulland Mar 6, 2016
0ca3301
testing some shit
margocrawf Mar 6, 2016
a0d7a34
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
margocrawf Mar 6, 2016
292e4e4
Messed around with tabs, crosshair, and hovering functionality
laurengulland Mar 6, 2016
c9ffa2b
all of the tabby things in one place
margocrawf Mar 6, 2016
377c59a
update
margocrawf Mar 6, 2016
727a5e4
created csv file of all freshmen hallways with room number, inhabitan…
laurengulland Mar 7, 2016
9d497df
Added comments to describe current progress for readibility. Added mu…
laurengulland Mar 7, 2016
35c926d
Added data up to entry 29 on survey
laurengulland Mar 9, 2016
4b9a275
initializes all rooms from csv file data, draws on correct floors. Fi…
laurengulland Mar 9, 2016
4fc953a
Updated with current working file
laurengulland Mar 9, 2016
9e50035
made the map outline in the shape of west hall
margocrawf Mar 9, 2016
bc3dd40
Added data until survey response 48
laurengulland Mar 10, 2016
637ad0d
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
laurengulland Mar 10, 2016
7917604
Working on bokeh server functionality
margocrawf Mar 10, 2016
e201ad5
Draws rooms in correct location.
laurengulland Mar 10, 2016
06715c8
Updated to response 48, updated to included extraneous rooms and R2 r…
laurengulland Mar 10, 2016
51773df
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
laurengulland Mar 10, 2016
d835d18
separate file for server experiments and dropdown menu related things
margocrawf Mar 10, 2016
267899e
Tabs now based on evaluation metrics, show WH1-3 within the tabs. Dis…
laurengulland Mar 10, 2016
3a4e24c
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
laurengulland Mar 10, 2016
645df9a
Fixed one of our color problems, still doesnt work for light sleep an…
laurengulland Mar 10, 2016
2a8e065
Fixed more hallway time color errors. Still some boxes showing up whi…
laurengulland Mar 10, 2016
0274a8d
fixed some colors
margocrawf Mar 10, 2016
8220032
made rooms without responses black instead of red.
laurengulland Mar 10, 2016
b8595e3
updated to response 49 on survey
laurengulland Mar 10, 2016
40d8a87
fixed some more colors
margocrawf Mar 10, 2016
9cca0bd
Fixed hover prompts
laurengulland Mar 10, 2016
bf0b612
added N/A to all columns for hover responses
laurengulland Mar 10, 2016
7fb1a30
Updated with current working file
laurengulland Mar 10, 2016
8fed4a5
deleted grid lines
margocrawf Mar 10, 2016
0ecfc06
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
margocrawf Mar 10, 2016
b61ec15
Project Writeup and reflection
laurengulland Mar 10, 2016
705e9c6
Updated with current working file
laurengulland Mar 10, 2016
c92be07
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
laurengulland Mar 10, 2016
89234e9
cleaned up everything
margocrawf Mar 10, 2016
3f877ad
Merge branch 'master' of https://github.com/Margaretmcrawf/Interactiv…
margocrawf Mar 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added InteractiveProgrammingProjectWriteup.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# InteractiveProgramming
This is the base repo for the interactive programming project for Software Design, Spring 2016 at Olin College.


To run code: simply run WH_ShapeMap.py to get the output graph (references WH_Freshmen.csv). See writeup document for more details.
51 changes: 51 additions & 0 deletions WH_Freshmen.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
101,R2,N/A,N/A,N/A,N/A,,,,,
102,Gwyn and Regina,Female,1,2,3,,,,,
103,Emily Y. and Jingyi,Female,12,2.5,2,,"J,E","12,12","3,2","1,3"
104,Andrew P. and Sam,Male,1,2,2,,"S,A","1,1","2,2","1,3"
105,Bryan and Nathan,Male,1,2,2,,,,,
106,Emma and Erica,Female,,,,,,,,
107,Alex S. and David,Male,,,,,,,,
109,[Nick Tatar],N/A,N/A,N/A,N/A,,,,,
110,[Nick Tatar],N/A,N/A,N/A,N/A,,,,,
118,[Kitchen],N/A,N/A,N/A,N/A,,,,,
120,[Gym],N/A,N/A,N/A,N/A,,,,,
123,[Ball Room],N/A,N/A,N/A,N/A,,,,,
125,[Service Room],N/A,N/A,N/A,N/A,,,,,
124,Anna,Female,,,,,,,,
126,Diego and Sean,Male,11,2,4,,,,,
127,Annie and Tehya,Female,11,2,3,,,,,
128,Louise and Katya,Nonbinary/Female,1,2.5,2,,"L,K","11,3","3,2","1,3"
129,Carl and Kevin G.,Male,2,2,2,,,,,
130,Danny and Will,Male,12,2,2,,,,,
131,Alex H. and Leon,Male,,,,,,,,
201,Eric and Max S.,Male,1,2.5,1,,"M,E","1,1","3,2","1,1"
202,Dhash and Taylor,Male,3,2,2,,,,,
203,Jamie and Jeremy,Male,2,2,3,,,,,
204,Margo and Nicole,Female,1,3,1,,,,,
205,Lauren G. and Uma,Female,2,2.5,2,,"L,U","2,2","3,2","2,2"
207,Claire and Liv,Female,12,1,3,,,,,
209,John Moreland and Joseph,Male,12,3,1,,,,,
210,Jared and Max D.,Male,1,2,1,,,,,
211,Katie and Serena,Female,2.5,3,2.5,,"S,K","1,4","3,3","2,3"
212,Ariana and Emily K.,Female,12,2,3.5,,"A,E","12,12","2,2","4,3"
213,Linnea and Mary,Female,12.5,2,2,,"M,L","1,12","2,2","3,1"
214,John Mathai and Justin,Male,12,3,1,,,,,
215,Daniel D. and Steven,Male,2.5,2,2,,"S,D","4,1","2,2","0,2"
218,R2,N/A,N/A,N/A,N/A,,,,,
220,R2,N/A,N/A,N/A,N/A,,,,,
223,Harper and Paige,Female,11,2,3,,,,,
224,Charlie and Rachel,Female,1.5,2,2.5,,"R,C","1,2","2,2","2,3"
225,Apurva and Sara,Female,1,2,3,,,,,
226,Jonah,Male,,,,,,,,
227,Matt and Arpan,Male,2,2,3.5,,"M, A","2,2","2,2","3,4"
228,Mica and Min,Female,11,2,3,,,,,
229,Lydia and Kim,Female,12.5,2.5,4,,"K,L","1,12","2,3","3,5"
230,Andrew and Hunter,Male,,,,,,,,
231,Bill and Isaac,Male,1.5,2,2.5,,"I,B","1,2","2,2","3,2"
301,Chloe and Kaitlyn,Female,11.5,1.5,3,,"K,C","12, 11","2,1","0,3"
302,Audrey and Izzy,Female,12.5,2.5,1,,"A,I","1,12","2,3","0,1"
303,Ian and Kevin Z.,Male,2,2,3,,,,,
304,Cedric and Duncan,Male,,,,,,,,
305,Lauren P. and March,Female,1.5,2.5,4,,"L,M","2,1","2,3","4,4"
306,Coleman and Max W.,Male,,,,,,,,
307,Jonathan and Sung,Male,12,2.5,1.5,,"S,J","1,11","3,2","2,1"
128 changes: 128 additions & 0 deletions WH_Interactive_Map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
from bokeh.models import BoxSelectTool, BoxZoomTool, LassoSelectTool, HoverTool, Quad
from bokeh.plotting import figure, output_file, show, gridplot, ColumnDataSource
from bokeh.models.widgets import Dropdown, Panel, Tabs, CheckboxButtonGroup, RadioGroup
from bokeh.io import output_file, show, vform, save
import csv

#PROJECT OVERVIEW:
#Create an interactive map of West Hall showing hallway culture via gender distribution, sleeping habits, time spent in hallways, etc.
#(If we hear back from STAR, we'll also have data on how people move from year to year, which will be awesome to implement)

#PROGRESS:
#currently outputs to an html file which has 3 tabs - WH1, WH2, and WH3
#rooms are currently blue squares, have hover functionality with correct labels but no data
#Also have buttons that are currently nonfunctional but are planned to be able to display different color coordinations for each room.
#Initializes and draws all rooms from a .csv file with data from survey sent to first years.

#NEXT STEPS:
#Get more room data from people (keep collecting survey responses)
#Draw rooms in correct places
#Make import for roommate names work correctly
#Make hover display room number and inhabitant names instead of '???'
#Make buttons functional
#figure out how to make buttons active
#make metric for color changing and coordination


# output to static HTML file
output_file("WH_Firstyears.html")

class Room(object):
def __init__(self, roomNum='000', roommates='[Roommate Names Here]', gender='[Some Gender Here]', bedtime=0, lightsleep=0, halltime=0, top=1, bottom=0, left=0, right=1):
self.roomNum = roomNum
self.roommates = roommates
self.gender = gender
self.bedtime = bedtime
self.lightsleep = lightsleep
self.halltime = halltime
self.top = top
self.bottom = bottom
self.left = left
self.right = right

def __str__(self):
return 'Room Number: %s / Current Inhabitants: %s / Gender: %s / Average Bedtime: %s' %(self.roomNum, self.roommates, self.gender, self.bedtime)

def drawRoom(self):
if int(self.roomNum)<200:
#draw on first floor
rooms1 = p1.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)

elif int(self.roomNum)<300:
#draw on second floor
rooms2 = p2.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)
else:
#draw on third floor
rooms3 = p3.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)


TOOLS = "box_zoom,box_select,resize,reset,hover,tap"

#draws first floor of WH
p1 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall First Floor")
tab1 = Panel(child=p1, title="WH1")
p1.segment(x0=[1, 1, 1, 6], y0=[1, 6, 1, 1], x1=[6, 6, 1, 6],
y1=[1, 6, 6, 6], color="#F4A582", line_width=3)
p1.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]

#draws second floor of WH
p2 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall Second Floor")
tab2 = Panel(child=p2, title="WH2")
p2.segment(x0=[1, 1, 1, 6], y0=[1, 6, 1, 1], x1=[6, 6, 1, 6],
y1=[1, 6, 6, 6], color="#F4A582", line_width=3)
p2.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]

#draws third floor of WH
p3 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall Third Floor")
tab3 = Panel(child=p3, title="WH3")
p3.segment(x0=[1, 1, 1, 6], y0=[1, 6, 1, 1], x1=[6, 6, 1, 6],
y1=[1, 6, 6, 6], color="#F4A582", line_width=3)
p3.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]


#Pull data from csv file and create Room objects from it!
with open('WH_Freshmen.csv') as csvfile:
freshmen_data = csv.reader(csvfile, delimiter=',', quotechar='\"')
#roomList = []
for row in freshmen_data:
roomA = Room() #initializes a new Room for each row in the csv data file
roomA.roomNum = row[0]
roomA.roomates = row[1] #not working for some reason?
roomA.gender = row[2]
roomA.bedtime = row[3]
roomA.lightsleep = row[4]
roomA.halltime = row[5]
roomA.top = 2
roomA.bottom = 1
roomA.left = 1
roomA.right = 2
roomA.drawRoom()
#roomList.append(roomA) #creates list of all Room objects

dropdown_choices = [("Gender", "gender"), ("Bedtime", "bedtime"), ("Light Sleeper", "lightsleep"), ("Time in Hallway", "halltime")]
dropdown = Dropdown(label="Hallway Metrics", type="warning", menu=dropdown_choices)

tabs = Tabs(tabs=[tab1, tab2, tab3])
layout = vform(dropdown, tabs)

# show the results
save(tabs)
show(layout)
137 changes: 137 additions & 0 deletions WH_ServerExperimentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
from bokeh.models import BoxSelectTool, BoxZoomTool, LassoSelectTool, HoverTool, Quad
from bokeh.plotting import figure, output_file, show, gridplot, ColumnDataSource, output_server
from bokeh.models.widgets import Dropdown, Panel, Tabs, CheckboxButtonGroup, RadioGroup
from bokeh.io import output_file, show, vform, save
import csv

#PROJECT OVERVIEW:
#Create an interactive map of West Hall showing hallway culture via gender distribution, sleeping habits, time spent in hallways, etc.
#(If we hear back from STAR, we'll also have data on how people move from year to year, which will be awesome to implement)

#PROGRESS:
#currently outputs to an html file which has 3 tabs - WH1, WH2, and WH3
#rooms are currently blue squares, have hover functionality with correct labels but no data
#rooms are 1 unit squares with an x position between 0 and 11 and a y position between 1 and 13.
#Also have buttons that are currently nonfunctional but are planned to be able to display different color coordinations for each room.
#Initializes and draws all rooms from a .csv file with data from survey sent to first years.

#NEXT STEPS:
#Get more room data from people (keep collecting survey responses)
#Draw rooms in correct places
#Make import for roommate names work correctly
#Make hover display room number and inhabitant names instead of '???'
#Make buttons functional
#figure out how to make buttons active
#make metric for color changing and coordination
#bokeh server things


# output to static HTML file

class Room(object):
def __init__(self, roomNum='000', roommates='[Roommate Names Here]', gender='[Some Gender Here]', bedtime=0, lightsleep=0, halltime=0, top=1, bottom=0, left=0, right=1):
self.roomNum = roomNum
self.roommates = roommates
self.gender = gender
self.bedtime = bedtime
self.lightsleep = lightsleep
self.halltime = halltime
self.top = top
self.bottom = bottom
self.left = left
self.right = right
self.gendercolor = "green"
self.bedtimecolor = "blue"
self.color =

def __str__(self):
return 'Room Number: %s / Current Inhabitants: %s / Gender: %s / Average Bedtime: %s' %(self.roomNum, self.roommates, self.gender, self.bedtime)

def drawRoom(self):
if int(self.roomNum)<200:
#draw on first floor
rooms1 = p1.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)

elif int(self.roomNum)<300:
#draw on second floor
rooms2 = p2.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)
else:
#draw on third floor
rooms3 = p3.quad(top=self.top,bottom=self.bottom, left=self.left, right=self.right,
nonselection_fill_alpha=0.01,
nonselection_fill_color=None,
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0,
selection_color="blue",
selection_fill_alpha=.5)

TOOLS = "box_zoom,box_select,resize,reset,hover,tap"

#draws first floor of WH
p1 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall First Floor")

p1.segment(x0=[0, 4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0], y0=[13, 13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10],
x1=[4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0, 0], y1=[13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10, 13], color="green", line_width=3)
p1.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]

#draws second floor of WH
p2 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall Second Floor")

p2.segment(x0=[0, 4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0], y0=[13, 13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10],
x1=[4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0, 0], y1=[13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10, 13], color="#F4A582", line_width=3)
p2.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]

#draws third floor of WH
p3 = figure(plot_width=400, plot_height=400, tools=TOOLS,title="West Hall Third Floor")

p3.segment(x0=[0, 4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0], y0=[13, 13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10],
x1=[4, 4, 7, 7, 11, 11, 7, 7, 4, 4, 0, 0], y1=[13, 12, 12, 13, 13, 10, 10, 1, 1, 10, 10, 13], color="#F4A582", line_width=3)
p3.select_one(HoverTool).tooltips = [('Room Number','@roomNum'),('Inhabitants','@roommates')]


#Pull data from csv file and create Room objects from it!
with open('WH_Freshmen.csv') as csvfile:
freshmen_data = csv.reader(csvfile, delimiter=',', quotechar='\"')
#roomList = []
for row in freshmen_data:
roomA = Room() #initializes a new Room for each row in the csv data file
roomA.roomNum = row[0]
roomA.roomates = row[1] #not working for some reason?
roomA.gender = row[2]
roomA.bedtime = row[3]
roomA.lightsleep = row[4]
roomA.halltime = row[5]
roomA.top = 13
roomA.bottom = 12
roomA.left = 0
roomA.right = 1
roomA.color = roomA.gendercolor
roomA.drawRoom()
#roomList.append(roomA) #creates list of all Room objects

dropdown_choices = [("Gender", "gender"), ("Bedtime", "bedtime"), ("Light Sleeper", "lightsleep"), ("Time in Hallway", "halltime")]
dropdown = Dropdown(label="Hallway Metrics", type="warning", menu=dropdown_choices)

#creating a callback function for changing the color of the room
def callback(obj, attr, old, new):
...
dropdown.on_change('selected', callback)

tabs = Tabs(tabs=[Panel(child=p1, title="WH1"), Panel(child=p2, title="WH2"), Panel(child=p3, title="WH3")])
layout = vform(dropdown, tabs)

# show the results
save(tabs)
show(layout)
Loading