For the past four years, we’ve done a Game of Life lab as part of the Decisions and Loops unit in AP Computer Science. I love that lab for many reasons. However, after four years and not using GridWorld anywhere else in the curriculum, I’ve decided it was time for a change. I’ve wanted to incorporate data analytics and visualization into a lab. After some research and ideas from a couple of labs developed by others, I’m excited to try a new lab this year: Twitter Mapping.
From what I provide students:
Your application will allow the user to search Twitter for a particular word or phrase in tweets located in each of the 50 US states and then display on a map of the US the degree of positive or negative sentiment associated with that search term in each state. For example, if the search term is coding, the following map may be displayed.
- This lab has several goals beyond the immediate concepts of decisions, loops, and unit tests in this unit:
Exposure to data analytics. In this lab you will search a large data set (tweets on Twitter) and analyze that data to derive a new understanding (the sentiment of tweets containing a given keyword in each of the 50 US states).
Experience using an API (Application Programming Interface) within the context of an unfamiliar software application. In this lab, you will use the Twitter4J API to access Twitter and write code within the partially implemented Twitter Mapping Lab application.
Exposure to data visualization. In this lab you will visually represent the average sentiment in a map of the 50 US states.
This lab and parts of this document arebased on Ria Galanos’ Twitter Project.
This lab is based on Stanford’s Nifty Lab’s Twitter Trends project by Aditi Muralidharan, John DeNero, and Hamilton Nguyen. The sentiment file included is from the Twitter Trends project.
The data for the geographic center and area of each state was obtained from Wikipedia.