An election twitter bot from BBC News

Wesley Stephenson @Wesstephenson

Alison Benjamin @Hey_benjamin

Link to this dropbox paper: https://tinyurl.com/s3ayd34



Agenda
  • Introduction: today’s workshop
  • Building graphics with R
  • Tweeting graphics with Python
  • Considerations 


Introduction: today’s workshop

What did our twitter bot do? 
We took the results for each of the 650 seats in the UK and we created 690 of these Twitter results cards:

One for each seat in the UK House of Commons and 40 in Welsh for the Welsh constituencies. 

As the night went on we also created 29 of these UK scorecards:
And scorecards for Scotland, England, Northern Ireland and Wales. 

What we’ll cover in today’s workshop:







Part 1 - Building graphics with R


Line 3 - delete it.

Let’s go

Lets deconstruct this card. How do we get this:

From this result csv:
gssId
constituency_shortName
newPartyCode
partyCodeLast
turnout_percentage
majorityNow
resultBanner
fullName
party_shortName
votesNow
candidate_party_code


UC0001
Nicarshire
MAC
MAC
87.1
6309
MAC HOLD
Lauren Davies
Modern Alliance Coalition
21098
MAC


UC0001
Nicarshire
MAC
MAC
87.1
6309
MAC HOLD
Justin Henderson
Social Advancement
14789
SA


UC0001
Nicarshire
MAC
MAC
87.1
6309
MAC HOLD
Habiba Khan
Moderate Resistance Party
2466
MRP


UC0001
Nicarshire
MAC
MAC
87.1
6309
MAC HOLD
Jean Cleveland
Environmental Climate Alliance
1017
ECA


UC0001
Nicarshire
MAC
MAC
87.1
6309
MAC HOLD
Elise Taylor
Traditional Preservation Movement
543
TPM