Aggie is a web application for using social media and other resources to track groups around real-time events such as elections or natural disasters.
Aggie can retrieve data from several sources:
- Twitter (tweets matching a keyword search)
- Telegram
- Crowdtangle (Facebook, Instagram, and Reddit posts 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 groups 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 React and Express.js, commonly used and popular web frameworks.
Contact [email protected] for more information on the Aggie project.
Sassafras Tech Collective offers managed instances of Aggie, along with development and support services.
Extensive documentation about using the application can be found in ReadTheDocs page.
- node.js (v18.20 LTS)
- 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.
- on windows, you can either use
nvm-windows
andnvs
- After installing nvm:
- Navigate to the aggie project directory:
cd aggie
. - Run
nvm install
to install the version specified in.nvmrc
. - then
nvm use
to switch to that version.
- Navigate to the aggie project directory:
- Use Node Version Manager.
- Mongo DB (requires >= 4.2.0)
- Follow the installation instructions for your operating system.
- You can connect to the live database, ask a maintainer for a copy of the db access token. you will need mongoCompass installed.
- if you are running a copy of the dabase locally:
- Make sure MongoDB is running:
- On Linux run
sudo systemtl status mongod
to see whether themongod
daemon started MongoDB successfully. If there are any errors, you can check out the logs in/var/log/mongodb
to see them.
- On Linux run
- 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.
- Make sure MongoDB is running:
-
Clone the aggie repo.
- you can use github-desktop, or clone using git.
- In your terminal, navigate to your main projects folder (e.g. Documents).
- Use this command:
git clone https://github.com/TID-Lab/aggie.git
. cd aggie
-
Copy
backend/config/secrets.json.example
tobackend/config/secrets.json
.- ask current developers for a copy of the secrets.json
-
Copy
.env.example
to.env
.- ask current developers for a copy of the .env
- the
DATABASE_URL
key should be the current mongo database, ask developers for a copy of this key
-
(optional, rarely needed) You might have issues with HTTPS. if so, 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 passphrase prompt
- If you do not have the certificate you can create a new self-signed certificate with the following command:
-
Run
npm install
from the project directory.- This installs all dependencies.
- Use
npm run dev
for development.- you can run frontend and backend in separate shells with
npm run dev:frontend
andnpm run dev:backend
- you can run frontend and backend in separate shells with
- Navigate to
https://localhost:8000
in your browser.- This will show you the running site. Login with the user name and password, which you can obtain from the current devs
- build react app with
npm run build
- run
npm start
- remember to have your
ENVIRONMENT=production
in the.env
file.
- remember to have your
When collaborating with multiple developers, we adopt a feature-branch workflow. If you are unfamiliar, read this article.
the develop
branch is our main/staging branch. production will be built from this branch. try not to push directly to this branch.
when writing PRs, include high-level changes and notable/interesting engineering challenges. However, you don't need to be particularly granular.
PR's should be reviewed by another developer, ideally the developer lead or the developer with domain knowledge of the feature before merging.
resolve conflicts with the main develop
branch by merging the latest into the current branch. for example, if you are working on a PR example-feature-branch
then:
checkout develop
git fetch --all
git pull
checkout example-feature-branch
git merge develop
- resolve any merge conflicts then push to branch
TODO: create proper maintenance
1. To run migrations run npx migrate
.
You can adjust the settings in the config/secrets.json
file to configure the application.
TODO: tests are broken at the moment. this is a work in progress
Set config.adminParty=true
if you want to run tests.
changes to many social media APIs means we need new ways of obtaining data from these sites. crowdtangle is being sunset. work in progress.
Follow these instructions to generate tokens to use the Twitter API.Go to Settings > Configuration and edit the Twitter settings. Remember to toggle the switch on, once you have saved the settings.
Create a dashboard on CrowdTangle and generate the dashboard token.Add your CT API token toconfig/secrets.json
.Runnpm run update-ct-lists
to fetch data.- This will update
config/crowdtangle_list.json
. - This also happens automatically every night at midnight while Aggie is running.
- This will update
Note: To have git ignore changes, run git update-index --skip-worktree config/crowdtangle_list.json
The WhatsApp feature is documented in a conference paper. As WhatsApp does not currently offer an API, a Firefox extension in Linux is used to redirect notifications from web.whatsapp.com to Aggie server. Thus, you need a Linux computer accessing WhatsApp through Firefox for this to work. Follow these steps to have it working.
- Install Firefox in Linux using your distribution preferred method.
- Install GNotifier add-on in Firefox.
- Configure the add-on about:addons:
- Set Notification Engine to Custom command
- Set the custom command to
curl --data-urlencode "keyword=<your own keyword>" --data-urlencode "from=%title" --data-urlencode "text=%text" http://<IP address|domain name>:2222/whatsapp
- We suggest setting your
keyword
to a unique string of text with out spaces or symbols, e.g., the phone number of the WhatsApp account used for Aggie. This keyword must be the same one as the one specified in the Aggie application, when creating the WhatsApp Aggie source. - Replace
IP address|domain
with the address or domain where Aggie is installed (e.g.,localhost
for testing).
- We suggest setting your
- Visit web.whatsapp.com, follow instructions, and enable browser notifications
- Notifications will not be sent to Aggie when browser focus is on the WhatsApp tab, so move away from that tab if not replying to anyone.
- 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 > Configuration 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 > Configuration and edit the Google Places settings and add the key.
The current build does not have email support
Email service is required to create new users.
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. Valid transport method values are: 'SES', 'sendgrid' and 'SMTP'.If you are using SES for sending emails, make sureconfig.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/winstonjs/winston#transports)file
section is for file logging. For various options, see [winston](see https://github.com/winstonjs/winston#transports)SES
section is for email notifications.- Set appropriate AWS key and secret values.
- Set
to
andfrom
email ids. Make surefrom
has been authorised in your Amazon SES configuration.
Slack
section is for Slack messages.- Set the webhook URL to send logs to a specific Slack channel
- DO NOT set
level
to debug. Recommended value is error.
Only the console
and file
transports are enabled by default. Transports can be disabled using the "disabled"
field included in each section in the config/secrets.json
file.
See the first part of the Tableau docs in BI Connector setup.
Setting up and viewing Tableau visualizations in Aggie requires installing Tableau's MongoDB BI Connector on the server that acts as a bridge between Tableau and MongoDB.
To set up the BI Connector, follow these steps: BI Connector setup.
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.
See detailed Frontend at FRONTEND.md
The frontend is a SPA react app that runs in the browser and interfaces with the API, via both pull (REST) and push (WebSockets) modalities. It source files contained in /src
and /public
. when built, files are served from /build
would be nice to have modern docs, but we dont at the moment
To build the docs locally, do the following: