Importer

The Importer app is concerned with getting corpus data into the database. It defines a number of Django management commands for making this easier.

Commands

class msgvis.apps.importer.management.commands.import_corpus.Command[source]

Import a corpus of message data into the database.

$ python manage.py import_corpus <file_path>
class msgvis.apps.importer.management.commands.import_twitter_languages.Command[source]

Import supported languages from the Twitter API into the database. If the languages already exist in the database, they will not be duplicated.

Note

Requires the tweepy Twitter API library: pip install tweepy

Example:

$ python manage.py import_twitter_languages
class msgvis.apps.importer.management.commands.import_twitter_timezones.Command[source]

Obtains a mapping of the Twitter-supported timezones from the Ruby on Rails TimeZone class.

Get the mapping dictionary from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/values/time_zone.rb

Note

Requires Ruby on Rails to be installed: gem install rails.

Example:

$ python manage.py import_twitter_timezones setup/time_zone_mapping.rb

Twitter Integration

Utilities for working with Twitter.

msgvis.apps.importer.twitter.tweepy_installed()[source]

Return True if tweepy is installed

msgvis.apps.importer.twitter.get_tweepy_auth()[source]

Interactive commands for getting Twitter API authorization. Returns a tweepy.OAuthHandler.

msgvis.apps.importer.twitter.get_languages()[source]

Get a list of languages supported by Twitter.

msgvis.apps.importer.twitter.get_timezones(time_zones_mapping_file)[source]

Get a list of twitter-supported timezones as name/Olson code pairs.

Models

msgvis.apps.importer.models.create_an_instance_from_json(json_str, dataset_obj)[source]

Given a dataset object, imports a tweet from json string into the dataset.

msgvis.apps.importer.models.get_or_create_a_tweet_from_json_obj(tweet_data, dataset_obj)[source]

Given a dataset object, imports a tweet from json object into the dataset.

msgvis.apps.importer.models.load_research_questions_from_json(json_str)[source]

Load research questions from json string