Hashtag sentiment Analyzer using Node-RED,Cloudant, dashDB,R script

2

Twitter Node Configuration:7

Switch Node Configuration:

3

Not so positive function node configuration:

4

Positive sentiment Function Node configuration:

5

Cloudant Node Configuration:

6

Once after wiring the nodes, click on DEPLOY ( top right corner of Node-RED).

Launch Cloudant and then you will find your database in the list

8

Create a dashDB warehouse to graphically analyze the sentiment

9

Goto dashDB and then run R script

10

Rscript.PNG

Data has been graphically analyzed using R Scripts.

1

1 represents Positive sentiment and 0 represents not-so-Positive sentiment

 

Advertisements

Weather Notification App using IBM Insights for Weather, Node-RED and Twilio in IBM Bluemix

 

IBM® Bluemix™ is the Platform as a Service(PaaS) cloud offering from IBM®. It enables organizations and developers to quickly and easily create, deploy, and manage applications on the cloud. Bluemix delivers enterprise-level services that can easily integrate with your cloud applications without you needing to know how to install or configure them. Bluemix provides a dashboard for you to create, view, and manage your applications and services as well as monitor your application’s resource usage. Bluemix dashboard also provides the ability to manage organizations, spaces, and user access.

IBM Insights for Weather service lets you retrieve weather data for an area specified by a geolocation. The data allows you to forecast, detect, and visualize disruptive weather events that might affect decision making in your application.

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.Node-RED provides a browser-based flow editor that makes it easy to wire together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single-click.JavaScript functions can be created within the editor using the a rich text editor.A built-in library allows you to save useful functions, templates or flows for re-use.

Twilio is a mobile service that is available on Bluemix which allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs.

This tutorial will help you build a weather notification app that will send you weather update every morning and necessary precautions you have to take to save you from daily weather.

Prerequisites

Step 1: Create a Node-RED service in Bluemix and then bind Insights for Weather and Twilio Service

2

Step 2: Click on Environment Variables(visible in the left side) and then make note of weather insights username and password in a Notepad

3

Step 3: Goto https://twcservice.mybluemix.net/rest-api/ and click on twc_observations_current

4

Step 4: Change the geocode according to your geography and then scroll down

5

Step 5: Click on Try it out! You would be prompted to enter the username and password.Enter it from the notepad

6

Step 5: Save the Request URL, you will require that subsequently

7

Step 6: Goto the Bluemix App URL and then click on Node-RED flow editor. Start dragging in the nodes. You will require

  • Inject Node
  • Http Request Node
  • JSON node
  • Function node
  • Twilio node and
  • Debug node

Let’s configure each node and then wire them accordingly!

Inject node: It will be triggered, every day 6:00AM thereby sending weather notification SMS

trigger.PNG

Http Request Node:

Enter the REQUEST URL, Click on Basic Authentication and then enter the Weather insights credentials

http_request

JSON Node: It will convert the output string from Http Request to JSON format which is fed into a function

json.PNG

Output of JSON node:

json_output.PNG

Function node: Write a function to extract the value

function

Twilio node: Insert the twilio credentials, To number to receive the Notification

twilio.PNG

You can add a debug node to understand whether it is functioning properly.

Click on Deploy button which is in the top right corner and then click on the left side of the Inject node to trigger.

Yipee! I just received a notification!! 🙂 You can schedule to receive it everyday morning!

13235034_1082577601799736_714966582_o

Courtesy:IBM Bluemix™(bluemix.net), Twilio, Weather Insights and Node-RED

Simple application using Node-RED Starter(SDK for Node js, Cloudant NoSQL database) in IBM Bluemix

bluemix1

IBM® Bluemix™ is the Platform as a Service(PaaS) cloud offering from IBM®. It enables organizations and developers to quickly and easily create, deploy, and manage applications on the cloud. Bluemix delivers enterprise-level services that can easily integrate with your cloud applications without you needing to know how to install or configure them. Bluemix provides a dashboard for you to create, view, and manage your applications and services as well as monitor your application’s resource usage. Bluemix dashboard also provides the ability to manage organizations, spaces, and user access.

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.Node-RED provides a browser-based flow editor that makes it easy to wire together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single-click.JavaScript functions can be created within the editor using the a rich text editor.A built-in library allows you to save useful functions, templates or flows for re-use.

In IBM® Bluemix™, a boilerplate is a container for an application and its associated runtime environment and predefined services for a particular domain. You can use a boilerplate to quickly get up and running. The Node-RED Starter boilerplate has Node-RED,Cloudant databse and Monitoring and Analytics Services as a combo pack.You don’t have to spend time in adding or binding services.

The steps below will help you to build a simple twitter feed application and insert those tweets into Cloudant database with the Node-RED Starter boilerplate.

Prerequisites

Step 1: Choose the Boilerplate Node-RED Starter from the CATALOG tab1.2

Step 2: Input the host name and click on CREATE

1.1

Step 3: Hurray! The application is created with Cloudant NoSQL DB and SDK for Node js

blog2

Step 4: One instance of the application is running perfectly! Click on the URL

blog3Step 5: Click on the button Go to your Node-RED flow editor


3

Step 6: The Node-RED page opens up with the nodes for each functionality on the left side


4.1

Step 7: Drag and drop the twitter node to the sheet1 (ensure you drag and drop the correct node)

twitter

Step 8: Double click on the twitter node and enter the required fields(ensure that you authenticate it with your twitter id) and click Oktwitter3Step 9: Drag and drop debug node in sheet 1


debug

Step 10: Enter the required field as shown below

debug2

Step 11: Drag and drop cloudant node to sheet1(ensure that you have choosen the correct node)

cloudant

Step 12: Double click the node and enter the required details

cloudant2

Step 13: Wire the nodes from its node points and click on DEPLOY

out

Step 14:Yes,now you can see live tweets for the hastag #bluemix on your debug console!!

output

Step 15: Goto the cloudant database

cloudb

Step 16: Click on Launch

cloud1

Step 17: You can see the database (tweets) ! Click on it. 

cloud2

Step 18: You can see the documents with unique id and _rev

we

Step 19: Click on one of the document and you can see the tweet,date,time,created by whom and all other details in JSON format.

out2

You can use the documents inserted in the Cloudant NoSQL database for further use and Yes,the application was ready within few minutes! That’s the power of Node-RED in IBM Bluemix. You can drag and drop other several nodes which are available in Node-RED to make this a better application(for analysis,for sending notifications etc)

Thanks to Node-Red,Cloudant NoSQL database and IBM Bluemix! You just saved our time from writing 1000 lines of code!

Courtesy: IBM Bluemix, Node-RED, Cloudant NoSQL Database