Skip to content

IBM-Cloud/election-insights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Election Insights

Currently hosted here

The Election Insights app uses Alchemy News API to display a bubble map of what's being talked about in real time and how people feel about them. The app uses Alchemy's taxonmy breakdown to focus specifically on the election, and uses Alchemy's entity breakdown and sentiment analaysis to display the data visually.

The size of the bubbles are dictated by how much they're being discussed and the color is dictated by the average sentiment around that entity.

screenshot

Deploy to Bluemix

Prerequisities:

Create a Bluemix, and register for an Alchemy API Key.

Create a MongoLab account, and create your database

Once you have a MongoLab account and a database and run the command

cf cups mongolab_ei_jk -p '{"uri": "mongodb://username:password@yourdatabase/port/db_name"}'

(You can name your service whatever you want but you'll need to update the manifest file)

You can find out the link of your database by clicking on the "Tools" menu. On the top of the page you'll see something like.

mongodb://username:password@yourdatabase/port/db_name

There are two ways to deploy this to Bluemix:

Option 1: Click the button below:

Now all you gots to do is click this button!

Deploy to Bluemix

This will set up a build pipeline - every time you push to the jazzhub repo this will create, it will automatically trigger a build and deploy.

After the initial deploy is done, you'll need to go to your dashboard, go to the space that you choose for this application, go to the application itself,

Option 2: The manual route:

In Bluemix:

  1. Create a Node.js runtime
  2. Bind a Mongolabs service instance with the "sandbox" plan
  3. Bind Alchemy with your API key

Once this is set up add these to your manifest.yml:

host: newsinsights
name: newsinsights

Then:

npm install
npm run build
cf push "electioninsights"

(or whatever you named your app), and you'll be all set.

Running the app locally

All you need to do is:

npm install
npm run build
npm start

There's also a helper npm dev that kicks off the server and runs gulp dev which handles watchify and re-compiling less->css when files change.

Make server/VCAP_SERVICES.json that is the same structure as VCAP_SERVICES is on Bluemix. For example:

{
  "user-provided": [{
    "name": "AlchemyAPI-2e",
    "label": "user-provided",
    "credentials": {
      "apikey": "your-key-goes-here"
    }
  }],
  "mongolab": [{
    "name": "MongoLab-bh",
    "label": "mongolab",
    "plan": "sandbox",
    "credentials": {
      "uri": "mongodb://yourmongouri"
    }
  }]
}

Using IBM DevOps

Note: if you used the "Deploy to Bluemix" button, this will all be set up for you.

I like to use IBM DevOps to automatically build and deploy my code whenever I push to git. Your build stage should look like:

#!/bin/bash
npm install
npm run build

And your deploy should look like:

#!/bin/bash
cf push "${CF_APP}"

# view logs
#cf logs "${CF_APP}" --recent

Contributing

Feel free to fork this repo and open a Pull Request or open an issue!

License

This app is licensed under the Apache 2.0 License. Full license text is available in LICENSE.

Contact Me

All of my contact information can be found here

About

Sentiment analysis and visualization on all things election

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published