In the past year or so, I’ve become a little bit obsessed with politics. So naturally, I’ve been following the 2016 election since the first official candidate, Ted Cruz, threw his hat into the ring back in March (my how time flies). Although we’re still a long way off from the Iowa caucuses, we’re officially in primary debate season. The Republican party has had two debates so far, and the first Democratic debate takes place this upcoming Tuesday. What I’ve noticed after the debates is that although I can remember reacting to particular statements by a given candidate, at the end of a marathon 3 hours, I’ll tend to forget most of them. Wouldn’t it be nice if I could rate a candidate each time they speak and then find out at the end how I ranked everyone?
I thought so, so I made a Shiny app to do it! The first step was figuring out how to persistently store the data. I ended up going with a MySQL database since I already had it available to me on my web server. Although my first instinct from my neuroscience background was to store all the data in one table, my ever-patient husband introduced me to the concept of database normalization. This meant that my final database was composed of six tables linking the user, debate, candidates, and topics (a list which I took from OnTheIssues).
Here’s what the final design looks like. After you enter your email address (used only to uniquely identify your ratings — no spam I promise!), you’re shown a series of dropdown boxes which allow you to select a debate, candidate, and topic. Enter your rating using the slider bar and hit Submit to save your rating. When you’re ready to view your results, just hit the “View Your Results” button and you’ll be presented with a chart ranking the candidates in descending order based on your mean rating. You can also download your data as a csv file if you’d like to play around with it some more. For example, you could see how your views of a particular candidate varied over the night, or you could see who you agreed with most on a particular topic.