|Version 66 (modified by 8 years ago) ( diff ),|
BluePrint: Social Media
Table of Contents
- Current Implementation
Social Media is playing a important role in Disaster and Emergency Management, for such things as:
- Sending warnings and emergency instructions to the public.
- Receiving help requests and incident reports from the public.
- Engaging with the public, encouraging preparedness, providing information.
- Detecting incidents not directly reported.
Best to start by seeing how the current system works.
For ease of getting a large dataset to play with, suggest using Twitter to start off with, although the same system can be used for other message channels, like Email, SMS & RSS.
Install on your own system:
- Install Eden
- Install the TwitterSearch library
- Follow the User Guidelines to get a Twitter OAuth account & use this to search
Some other ideas:
- Create searches/filters of various social media feeds
- Simple hashtag search
- Machine learning algorithms(?)
- Ability to display these feeds on Dashboards
- Display on the map
- Trends over time
- Ability to track actions (tasks?) take in response to Social Media messages
- Measure Social Media Engagement
- Number of followers (+ trends over time)
- Number of Tweets (+ trends over time)
- Number of re-tweets / likes (+ trends over time)
- Share information from Sahana Eden on Social Media
- A user sharing it on their accounts
- Allow Sahana Eden to publish new information automatically to it's own account
EOC staff are overwhelmed - in the first phases of an emergency they can only act on big picture information (e.g. clusters of incidents) rather than individual incidents. Displaying a screenful of photos allows one to quickly get a good amount of information.
As an Emergency Manager, in order to support the decision making for the type of the resources allocated, the type of response (containment, evacuation etc.) and the scale of response, the information needed woud possibly include:
- The type of incident (Fire, earthquake, chemical gas release, civil disturbance etc.)
- Secondary hazards
- Any information that would be helpful to prioritise the life saving activities (between incidents and within incident)
- Any logistics support that might be needed (crane to clear the path, mobile radio repeater to ensure flawless communication etc.)
- Secondary (non-life saving) response (food, shelter, communication etc.)
- Local response resources (human, tools, vehicles, facilities etc.) available that might be helpful
The following workflows describe how a message could be responded to. This message may be from Twitter, Facebook(?), SMS or Email. The idea is that Sahana can be used to record the response to all messages.
- A message is received reporting an incident
- The user decides to create an incident based on this message (perhaps it is from a trusted source, perhaps they checked to verify it, perhaps this is their policy)
- That incident is created with a link to this message (for verification)
- If other people see that message, they can see a link to the incident that was created from it.
- A message is received reporting an incident - which has already been recorded in Sahana
- The user links this message to an existing incident
- The message now has a link to this incident. That incident now has a link to this (and all other) related messages.
Request for Volunteers
- A message is received requesting volunteers
- The user creates a request for volunteers (which is linked to/from this message)
Request for Supplies
- A message is received requesting supplies
- The user creates a request for supplies (which is linked to/from this message)
Request for Information
- A message is received asking for information
- A Message is sent in response (either to the person or broadcast) (which is linked to/from the first message)
Some example diagrams are here:
There is a huge scope for for Social Media Integration in Sahana Eden some of which have been listed here. These are some more specific projects you may be able to engage with
Social Media Feeds
Enhance the feeds which are displayed on the homepage https://github.com/flavour/eden/blob/master/controllers/default.py#L283 which are controlled with these settings https://github.com/flavour/eden/blob/master/private/templates/000_config.py#L9.
- Improve the styling of these feeds
- Allow users to create their own dashboard with customized feeds
- Re-factor the code so that it is easy to insert feeds on other pages (eg. Module Index Pages)
This project allows the user to add layers of Geo-tagged data from Twitter onto the Map. It searches for tweets with specific keywords (that can be configured by user on Sahana web page). It then plots the location of these tweets on the Map.
- Configuring twitter account:
Sign into https://dev.twitter.com and create an app. (Select an application Type: Client). Put the Callback URL as blank and create your own Twitter application. After creating an app on twitter account, you will be able to see a tab called OAuth tool. Open eden/models/000_config.py file. Under Twitter Settings, add consumer_key and consumer_secret obtained from the twitter app's OAuth tool. Edit the following lines in 000_config.py
settings.msg.twitter_oauth_consumer_key = "<consumer key from twitter app>"
settings.msg.twiiter_oauth_consumer_secret = "<consumer_secret from twitter app>"
- Add keywords to be searched:
Go to a page eden/msg/twitter_search. You can add keywords / search queries records under this page. It will ask you for a PIN to enter before saving the keywords/queries. The pin is obtained from Twitter app that was created.
- Populating database with search results:
After saving the keywords/ queries, click on Results which triggers the search and msg_twitter_search_results table in the database gets populated.
After fetching the twitter feeds, the Geo-tagged tweets are processed. They are parsed to fetch user information, tweet data and location information in terms of latitude and longitude. All this information then goes into the msg_twitter_search_results table.
Plotting tweets on Map
To display tweets on map, a new layer named "Twitter" is added under the overlays section on the map page. When a user selects this option, the location ids from the msg_twitter_search_results are fetched and a marker is displayed on those locations. Clicking on the marker image displays additional tweet information such as content, time and user info.
- Major limitation is that the twitter search keyword is hard coded.We need to make the code access the msg_twitter_search table and use the keywords stored by the user through the GUI to search and display twitter feeds on the GIS map.
- Display twitter icon on map instead of the normal location bubble.
- Work on the pop-up contents. Ideally this would include any photo or video linked in the message (or a URL if it's to a page of text). Actually doing the part within the tweet parsing of following embedded URLs to identify if they're Media would be really useful addition to the parser (there is a commented-out stub).
- Create a cron job, to search tweets periodically and not only at user's request.
Publishing data to Social Media Account
Allow Sahana Eden to be configured to have a Facebook or Twitter account it updates to. Look at the msg_search_subscription_notifications function (https://github.com/flavour/eden/blob/master/modules/s3db/msg.py#L818) which is used to send emails to users for Saved Searches - ideally this could also be used to save search criteria, and then when new records in that search are updated - a FB or Twitter update for the system is updated.