Aggie is a web application for using social media and other resources to track incidents around real-time events such as elections or natural disasters.
Aggie can retrieve data from several sources:
- Twitter (tweets matching a keyword search)
- Facebook (comments from publicly accessible groups and pages)
- RSS (article titles and descriptions)
- ELMO (answers to survey questions)
Items (called reports) from all sources are streamed into the application. Monitors can quickly triage incoming reports by marking them as relevant or irrelevant.
Relevant reports can be grouped into incidents for further monitoring and follow-up.
Reports are fully searchable and filterable via a fast web interface.
Report queries can be saved and tracked over time via a series of visual analytics.
Aggie is built for scalability and can handle hundreds of incoming reports per second. The backend fetching and analytics systems feature a modular design well-suited to parallelism and multi-core architectures.
Users can be assigned to admin, manager, monitor, and viewer roles, each with appropriate permissions.
Aggie is built using Angular.js and Express.js, both state-of-the-art development frameworks.
Contact mikeb@cc.gatech.edu for more information on the Aggie project.
Sassafras Tech Collective offers managed instances of Aggie, along with development and support services.
- Install docker (version >= 1.0.0, such as 1.11.0).
- Follow the installation instructions for linux, Mac OS X, or Windows.
- On Linux installations, install docker-compose separately
- Checkout the aggie repo.
- In your terminal, navigate to your main projects folder (e.g. Documents).
- Use this command:
git clone https://github.com/TID-Lab/aggie.git
.
- Start aggie
- Navigate to the
docker
directory in aggie:cd aggie/docker
- run
docker-compose up
- In your terminal, a user and password were generated. You will use these credentials to log into the application. Example:
"admin" user created with password "password"
.
- Navigate to
https://localhost
in your browser.
- This will show you the running site. Login with the user name and password from your terminal mentioned above.
The following need to be installed.
- node.js (v.0.10.*, such as 0.10.32)
- There are two ways to install/update node.js.
- Install a specific version of node.js.
- Documentation and installation instructions can be found on the node.js site.
- Use Node Version Manager.
- Node Version Manager (nvm) allows multiple versions of node.js to be used on your system and manages the versions within each project.
- After installing nvm:
- in your terminal, navigate to the aggie project directory:
cd [aggie]
. - use this command:
nvm use
to install the version specified in.nvmrc
.
- Mongo DB (requires >= 2.6, such as 2.6.9)
- Follow the installation structions for your operating system.
- Stop and restart Mongo DB.
1. On Linux run
sudo service mongod stop
. Then runsudo mongod
. 2. Make sure mongodb is running in the terminal and listening on an appropriate port. Your terminal with the mongo db process running should display something similar to the following:[initandlisten] waiting for connections on port 27017
. - Note: You do not need to create a user or database for aggie in Mongo DB. These will be generated during the installation process below.
- JRE
- Install the Java SE Runtime Environment (JRE) from Oracle or your package manager
- Java is only required for running end-to-end tests with protractor. Installing Java can be safely skipped if these tests are not needed.
- Checkout the aggie repo.
- In your terminal, navigate to your main projects folder (e.g. Documents).
- Use this command:
git clone git@github.com:TID-Lab/aggie.git
.
- Copy
config/secrets.json.example
toconfig/secrets.json
. - Set
adminPassword
to the default password your want to use for theadmin
user during installation. - For production, set
log_user_activity
flag totrue
. For testing, set it asfalse
(default value). - To make https work, you need to copy your SSL certificate information to the
config
folder (two files namedkey.pem
andcert.pem
).
- If you do not have the certificate you can create a new self-signed certificate with the following command:
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
- This will allow you to start the server but it will generate unsafe warnings in the browser. You will need a real trusted certificate for production use.
- Adding the
-nodes
flag will generate an unencrypted private key, allowing you to run tests without going through a password prompt
- Run
npm install
from the project directory.
- This installs all dependencies and concatenates the angular application.
- Run
npm install -g gulp mocha karma-cli protractor@2
.
- This installs gulp, mocha, karma, and protractor globally so they can be run from the command line for testing.
- This is optional, as
npm
provides easy access to the local copies of these that are installed bynpm install
- Run
npm install -g migrate
.
- This installs node-migrate globally.
- To start server, run
npm start
.
- In your terminal, a user and password were generated. You will use these credentials to log into the application. Example:
"admin" user created with password "password"
.
- Navigate to
https://localhost:3000
in your browser.
- This will show you the running site. Login with the user name and password from your terminal mentioned above.
- If you did not set up the SSL certificate, use
http://localhost:3000
instead
- To run migrations run
migrate
. - To run unit tests, run
npm test
.
- Calling
npm run mocha
(ormocha
if you installed it globally) will run just the backend tests - Calling
npm run karma
(orkarma start --single-run
if installed globally) will run just the frontend tests
- To monitor code while developing, run
gulp
. You can pass an optional--file=[test/filename]
parameter to only test a specific file. - To run end-to-end tests:
- first start Aggie on the test database with
npm run testrun
- then run protractor with
npm run protractor
- To run end-to-end tests with external APIs
- Set up the appropriate keys in
secrets.json
(e.g. Twitter) - start Aggie on the test database with
npm run testrun
- run protractor with
npm run protractor-with-apis
You can adjust the settings in the config/secrets.json
file to configure the application.
Set config.adminParty=true
if you want to run tests.
- Follow these instructions to generate tokens to use the Twitter API.
- Go to Settings > Settings and edit the Twitter settings. Remember to toggle the switch on, once you have saved the settings.
- Visit your apps on the Facebook developers site. Create a new app if needed.
- Inside your Facebook app, obtain
client_id
andclient_secret
. - To obtain an access token, in a browser, visit
https://graph.facebook.com/oauth/access_token?client_secret=xxx&client_id=xxx&grant_type=client_credentials
using yourclient_id
andclient_secret
. - Go to Settings > Settings and edit the Facebook settings. Remember to toggle the switch on, once you have saved the settings.
- Log in to your ELMO instance with an account having coordinator or higher privileges on the mission you want to track.
- In your ELMO instance, mark one or more forms as public (via the Edit Form page). Note the Form ID in the URL bar (e.g. if URL ends in
/m/mymission/forms/123
, the ID is123
). - Visit your profile page (click the icon bearing your username in the top-right corner) and copy your API key (click 'Regenerate' if necessary).
- Go to Settings > Settings and edit the ELMO settings. Remember to toggle the switch on, once you have saved the settings.
Aggie uses Google Places for guessing locations in the application. To make it work:
- You will need to get an API key from Google API console for Google Places API.
- Read about Google API usage limits and consider whitelisting your Aggie deployment to avoid surprises.
- Go to Settings > Settings and edit the Google Places settings and add the key.
fromEmail
is the email address from which system emails come. Also used for the default admin user.email.from
is the address from which application emails will comeemail.transport
is the set of parameters that will be passed to NodeMailer 2.1.0. Valid transport method values are: 'SES', 'sendgrid' and 'SMTP'.- If you are using SES for sending emails, make sure
config.fromEmail
has been authorized in your Amazon SES configuration.
- Set
fetching
value to enable/disable fetching for all sources at global level. - This is also changed during runtime based on user choice.
Set various logging options in logger
section:
console
section is for console logging. For various options, see [winston](see https://github.com/flatiron/winston#working-with-transports)file
section is for file logging. For various options, see [winston](see https://github.com/flatiron/winston#working-with-transports)SES
section is for email notifications. For various options, see [winston-amazon-ses](see https://www.npmjs.com/package/winston-amazon-ses).- Set appropriate AWS key and secret values.
- Set
to
andfrom
email ids. Make surefrom
has been authorised in your Amazon SES configuration. - DO NOT set
level
to debug. Recommended value is error.
- Inside the application, go to
Sources > Create Source
. - To add a Twitter search, add all relevant keywords. - Twitter has more information on search terms.
- To add a Facebook source, copy and paste the URL of the Facebook group or page you want to follow (e.g.
https://www.facebook.com/nigerianforum
). - To add an RSS feed, visit the website or blog you wish to use and find the RSS or other feed. (For example,
https://wordpress.org/news/feed/
). - To add an ELMO source to track responses for a particular ELMO form, enter a URL like this:
https://yourdomain.com/api/v1/m/yourmission/responses.json?form_id=123
, where123
is the ID of the form you noted above. The user associated with your API key must have permission to view responses on the mission in order for this to work.
As the application pulls in data, the app may encounter warnings. These warnings help determine whether or not a feed is pulling in data correctly.
- Go to
Sources
. - In the
Name
column, click the appropriate source. - Under
Recent Events
, you can see recent warnings for the source.
Internally, we use forever to keep Aggie running. Since this is a multi-process application, the forever monitor will sometimes hang up when restarting the Aggie process after deploying a new version of the code. In this case, killing the forever process before deploying seems to fix it.
Aggie consists of two largely separate frontend and backend apps. Some model code (in /shared
) is shared between them.
The backend is a Node.js/Express app responsible for fetching and analyzing data and servicing API requests. There are three main modules, each of which runs in its own process:
- API module
- Fetching module
- Analytics module
See README files in the lib
subdirectories for more info on each module.
The model layer (in /models
) is shared among all three modules.
The frontend is a single-page Angular.js app that runs in the browser and interfaces with the API, via both pull (REST) and push (WebSockets) modalities. It is contained in /public/angular
.