Too Close to Call, a US Election Aggregator

Project URL: https://too-close.glitch.me

I was getting annoyed refreshing ten different media outlet’s election maps and searching for the differentials of the handful of states that actually matter. Too Close to Call is my way of making the data accessable and readable. It shows only the raw vote counts, and when the latest votes were reported.

PWA Update I had no idea how ridiculously simple it is to enable a site like this to be a PWA so now it is one if anyone’s interested.

14 Likes

HECK YES!!!

I’ve been looking for this. Bing bing bong bong bong

4 Likes

Oh, this is quite neat! What API do you use?

4 Likes

There’s no reliable, free, real-time election data API, for good reason too. Wouldn’t want inaccurate information flying around.

I’m using data from the internal API that the Wall Street Journal setup to update their election map. You might call this scraping or an unofficial API, I call it the open internet.

5 Likes

You should probably use the Associated Press’ API:

4 Likes

The Associated Press Election API is the gold standard of election data but it’s not free to use. As far as I know it’s one of the most expensive API’s money can buy. That said their data is what powers the majority of election trackers available online. Google, New York Times, Fox News, Washington Post, Wall Street Journal, among others all cite the AP as one of their election data providers.

This was a side project I did over a couple hours in my free time so I can’t justify spending any money on it (that’s why it’s on Glitch*). I also don’t pretend to be a news outlet, I’m just aggregating the data that’s interesting and available to me.

*It’s also now mirrored on Heroku because it keeps hitting Glitch’s rate limit :sunglasses:

5 Likes

Awesome, love it - leave it up to developers to cut through the trash and make something useful, haha. What package are you using to web scrape? Or did you just look for the API endpoint that the WSJ was calling from?

*Also it’s cool to see a python app on Glitch!

Someone on Twitter brought the WSJ endpoint to my attention and that got the wheels turning in my mind. I wanted to do something but good, free election data is hard to come by so once I had the link and time on my lunch break I got to work.

I really really really don’t like javascript and python + flask is so simple it’s my go to.

2 Likes

Haha, I’ve only written in Javascript so can’t say anything there :smiley:

1 Like

And I really, really, really, love TypeScript. Oh yes. Types + JS = awesomeness

It didn’t really say it costed any money on the site, so I was a bit confused :joy: Then it mentioned API Key and I was wondering how to get one! It said something like ‘if you have any questions about the API, please contact us’, so I assumed it didn’t mean for access. I can totally understand why you wouldn’t pay for access, especially when the WSJ have a free, open one!

Typescript is really just fancy JavaScript. It also gives warnings such as function validation:

function hello(str:string){
console.log(str)
}
hello("World!"); // Valid Typescript
hello(2) // Invalid Typescript
1 Like

interesting, this is kind of like rust typing

2 Likes

This is great! Saves me checking sky news…

1 Like

That’s misleading, we have a projected winner of the election, but it’s far from done.

If you check my site you’ll see that votes are still being counted and that the totals are being updated every few hours. The margins in a few states remain incredibly close and while each state sets it’s own election laws, the closer states will go to either a mandatory vote recount or a candidate requested recount. Plus, there are outstanding legal challenges that will be addressed by the courts which need to be resolved.

It won’t be until mid December when the election results are certified by each state and the Electoral College is convened that the election will be complete.

So yeah, we have a projected winner, and that winner will almost definitely take office come January, but the election process has a long way to go.

3 Likes

I don’t think this forum is appropriate for politics, and I’ve been careful in both my project this is about and my replies to remain apolitical.

I hold a degree in political science so I feel I have a bit of credibility to respond to this though:

It’s important in a democracy to have sources of trustworthy information, and it’s critical that the organizations that call elections get it right the first time, everytime. No information is better than incorrect information and that’s why this election wasn’t projected until Saturday. If the electorate doesn’t know or doesn’t agree on who they elected, every level of a democratic body falls apart, and that’s not a world I want to live in. It would be bad for democracy if everyone was surprised by the outcome, irrelevant who the winner is.

8 Likes