- [Narrator] Next up, we're going to take
a look at a case study using a MongoDB
JSON Document Database.
And in particular what we're going to do
is set up a Twitter streaming listener.
Where we're going to be looking for
Tweets to, from and about the
100 current U.S. Senators.
Every one of whom has a Twitter handle.
And, we'll be storing the actual
JavaScript object notation objects that
represent those Tweets directly
in a MongoDB database.
Now, we're going to capture 10 thousand such Tweets.
Then we're going to use the Panda's library
to help us summarize that information.
And we'll do things like display the
top 10 Senators by their Tweet activity.
And again that will be Tweets to them,
from them and about them as well.
And, once we have all that information
we're also going to summarize on a
state by state basis on an
interactive U.S Folium map.
The names of the states, the names of the Senators
and the Tweet activity associated with
each Senator in decreasing order of most Tweets.
Now, to do all of this we're going to be working
with a free cloud-based MongoDB Atlas cluster.
This is their online MongoDB service that
enables you to work with MongoDB
without having to install anything
locally on your computer other than
the library that we need in order
to interact with MongoDB.
As we'll discuss it only allows you to
store up to 512 megabytes of data.
Which nowadays is of course tiny.
And, this is to give you a taste of
what MongoDB all about.
And of course they would then expect
you to sign up to use their paid service.
Or, if you need to store more data
and don't want to pay for the service,
you can also download their free
MongoDB community server and you can run
that locally on your own systems.
And again of course they do have their
paid online atlas service.
Now, for the purpose of this example
you will need two additional libraries.
So, you'll need to install pymongo.
Which is the python module for
interacting with MongoDB databases.
And the pymongo module requires
dnspython when we are connecting
to a MongoDB Atlas clusters.
So, you will need to install both of those
libraries before continuing with this example.
Now, in the ch16 examples folder there's
a sub folder called TwitterMongoDB.
And, within there you'll find the keys.py file.
Similar to the one that we created back
when we were discussing the
Twitter Data Mining.
And you will need your Twitter credentials
and your OpenMapQuest key from back in the
Twitter Data Mining lesson.
So, you'll want to copy that stuff
in to this keys.py file.
And, separately we will be adding to this
keys.py file a MongoDB connection string.
Which is a key piece of information
that will need to be able to
communicate with the cluster properly.