By Jenn Schiffer

November 17, 2020

Too Close to Call: A conversation with creator Daniel Flanagan

Throughout the election season, we saw data from a small number of states captivate the attention of a global audience. Social media feeds were a constant stream of numbers and maps; it was nearly impossible to make sense of it all in real-time. Instead of getting overwhelmed, Daniel Flanagan created Too Close to Call, a Glitch project that does all the marginal math needed to follow close races in competitive states. I reached out to Daniel, a recent college graduate and freelance visual effects artist, to talk about his process and the aftermath of creating a popular app during, and for, such an energizing national moment.

Jenn: With every election there are lots of maps and data–I, for one, often get overwhelmed. What drove you to create your own app among all that noise?

Daniel: That feeling of data overload is exactly what drove me to make this app.  I knew the election was going to come down to a handful of states, but once early counts confirmed as much, I, and I’m quoting myself here, “was annoyed with constantly searching” a whole map of the country when only a few states were relevant.

Add to that the fact that all these maps would only tell you which way the state was leaning and maybe a percentage/vote count if you selected a specific state, it was a pain to find the information that was truly relevant.  I wanted to know how close each state’s race was: 200 votes or 200,000 votes?

I do appreciate the work that goes into all those maps, I follow a few of their developers on Twitter and I think they knocked it out of the park.  My little app is not possible without all their work and the ease with which those maps convey the state of the race at a glance is incredibly valuable.  In this case I just wanted a more concise version of only the data I found relevant.

You mentioned in the support forum that you hold a degree in political science! Do you often build apps that are politics related, or was this a special opportunity for you?

I did yes. Technically it's a minor in political science but I definitely got more out of my poli sci classes than any others.  To be honest, I don’t build all that many apps in the first place, this sort of user-facing development is a hobby more than anything else.

I build things around stuff that interests me, and to say that I was interested in this election would be an understatement.  The challenging thing with anything political is the fact that everyone comes to it with their own politics.  I’m not looking to make something that drives people apart, or even something that affirms someone’s beliefs; the interesting projects to me are the ones that provide the opportunity to bring understanding and context to an area, as Malcolm Gladwell would say, otherwise overlooked or misunderstood.

This was a special opportunity for numerous reasons, chiefly because it allowed me to channel my election energy into something productive.  I was also excited to be working with real-time live data, that’s not something I get to do often.

How long was the process from getting the idea to sharing it with the world?

I had the idea as I was scrolling through Twitter that morning and set up the project on Glitch shortly thereafter.  I didn’t get to start in earnest until lunch around noon, and my work on this project was sporadic throughout the day as I was working on, well, work.  I’d say it probably got 4-5 hours of dedicated attention throughout the day. I took a look at my commit history and it looks like the first commit was at 10am, the UI was done by about 2pm, I made a commit noted “Functional Prototype” just before 5pm, and I shared it on Twitter an hour later at 6:03pm. So from commit to tweet we’re looking at 8 hours and 3 minutes.

What made Glitch the place you chose to build and share this project?

For any project or idea that requires a web server, Glitch is always my first choice.  I don’t quite understand how Glitch is able to provide so much for free but I’m not complaining.  Glitch containers allow for websocket connections, terminal access, and persistent storage, all while abstracting the infrastructure away from me. Aside from the technical, I feel like my kind of app development, small, one-off experiences fits so well within the Glitch community.  I’ve come across so many awesome small projects on Glitch and being a part of that is something that’s hard to find on the internet.

Did you know how you were going to build the app when you got started or did those decisions come to you as you were coding? For instance, did you go into the process knowing you’d be using WSJ data?

I didn’t start this app until I had the Wall Street Journal data source, which I didn’t even find myself, it came across my Twitter feed courtesy of Paul Miller. I knew when I started this was going to be a Flask based Python app because I’m super familiar with that setup and how it interacts with Glitch.  I built out the UI first, and comparing what it looks like now to a sketch in my notebook, I can confidently say that I built exactly what I set out to build.

Updating the data went through a few design ideas:  First I thought I’d have the data be filled out server-side and sent to the client using Flask’s built-in Jinja templates.  The biggest benefit to that approach was not having to write JavaScript.  JavaScript is a great language and it powers a lot of what I do, but I really don’t like writing it.

Eventually I came to my senses and decided the flexibility of being able to update the data without a full page reload was worthwhile.  I did that with a Flask endpoint and a fairly simple client JavaScript file.  Ironically I built in this flexibility and didn’t take advantage of it until I started getting some feedback on the app.

Once you shared the app, it really took off! How was it received, and did you need to make changes to the app in response to the reception? Was there anything you would have done differently given more planning and time?

It was so exciting, and a little frightening, to see this app take off.  It was a crash course in social media virality for me; I tweeted it to my 81 followers and to date it’s reached 3,000 unique users totaling more than 7,000 page views.

The reception was awesome, it was great to see so many people using it, and it turned out a lot of people were looking for something to cut out all the noise for them.  One of my best friends sent me a photo of the app on his company’s office flat screen and told me how the app flickered as they refreshed it.  Conveniently, I had built in the flexibility to have the app update the data automatically, I just hadn’t implemented it.  That’s where the two minute refresh countdown came from.

In response to comments on Twitter I added the electoral vote counts, the map color changes, and the minimize maps toggle.  I also added PWA (Progressive Web App) capabilities after I kept losing the tab on my phone.

I enjoyed the time pressure, knowing that at any moment it could become irrelevant was a motivator to get it done.  The one thing I wish I did was cache the data and show some sort of trend line from it.  Even something as simple as showing which direction the vote margin was trending would have been awesome.  There’s a similar app another group of developers made that was brought to my attention by people commenting on my app on Twitter that I think does that really well.

What do you plan on building next?

This week I’ve been a part of an awesome Glitch ✕ Twitter collaboration on an in-browser Jeopardy board.  I adapted an old API of mine that allows a frontend developed by Patrick Weaver and Trent Willis to pull clues from previously aired episodes of Jeopardy.  You can check out my API, the gameboard, and the Twitter thread.

Other than that I’ve got a lot of ideas but no concrete plans as of yet.  Maybe something similar to this app for the upcoming Georgia Senate runoff elections. Although answering these questions for the Glitch blog is making me think that maybe I want to have my own blog 👀.

Thanks to Daniel, who should most definitely start his own blog, for telling his story and for building Too Close to Call on Glitch! If you build or see an app on Glitch that you want us to feature, tell us about it by emailing [email protected].