Archive

Archive for February, 2014

Broadcast data to all viewers of your webpage using Firebase

firebase

Firebase is a cloud-hosted JSON based database, which can be used to replace the back-end of web applications.
It excells in certain cases, using websockets to communicate seamlessless between client and server, it removes the need for postbacks or Ajax polling.

Here is a simple example using Firebase to broadcast a message to all viewers of a particular web-page. I have removed the security settings for this particular instance, so no username or password is required.

The callback is event-orientated, so whenever the value held in the database changes, the event is fired on all clients, with the snapshot object containing the updated value.

<html>
 <head>
  <script type='text/javascript' src='https://cdn.firebase.com/js/client/1.0.6/firebase.js'></script>
  <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  <script language="javascript">
    var myRootRef = new Firebase('https://vivid-fire-7206.firebaseio.com/');
    function setData()
	{		
		myRootRef.set($("#message").val());
	}
	myRootRef.on('value', function(snapshot) {	 
	  $("#lastMessage").html(snapshot.val());
	});
  </script>   
  Say something to all users viewing this page:<br>
  <input name="text" id="message" onkeyup="setData()"> 
   <br>
   <br>
   <h2 id="lastMessage"></h2>
 </head>
 <body>  
 </body>
</html>
Categories: Uncategorized

Flu Trends App

Flu Trends App

Tracking flu epidemics in real-time

Overview:

People report their daily lives through social media, and it’s only natural when someone has a cold or flu, they mention this on social media sites, such as Twitter. – Sample tweets like the one below indicate, not only when people are ill, but where they are also.

tweet

This project seeks to trawl social media sites in a systematic manor looking for tweets relating to “flu”, “cough”, “sneeze”, “ill” etc., and using sentiment analysis on the messages to ensure that the message is genuinely referring to an ailment, and not taken out of context.

The objective of the project is to present this data as an App, that people can use to see if flu epidemics are developing in their area, or at their child’s school.

Innovation:

Projects such as Google Flu trends (http://www.google.org/flutrends/) have existed for some time, and they draw on data from public health institutions to provide a global picture of Flu patterns over time. This is certainly useful, but fails to provide a real-time, up to the minute picture of Flu outbreaks in the local area of the user.

Social media is an excellent source of real-time information, and feeding this into a mobile App, provides excellent coverage of those who mention they are ill via Twitter, or other similar social media sites.

Implementation:

A server-side application will constantly gather data on tweets sent using certain key phrases relating to flu, this will then analyse the tweet data for context, and then store them in a database, along with any geo-tagging information associated with the tweet.
An app, which will be made available for iOS and Android, – based on the PhoneGap framework, which will appear, similar to the prototype below, will display data that is relevant to the user, by using the user’s current physical location

Extra historical data will be taken in from other sources, such as Google Flu Trends, to allow users see past flu trends in their area.

Commercial applications:

Although the app will be designed primarily for the general health benefit of its users, and will be offered free. The data collected will be available for sale to other organisations via an API (Application programming Interface), chargeable per request, and advertised via ProgrammableWeb and Mashape.

It is expected that healthcare institutions may be interested in using this data in order to better allocate resources, and spot emerging epidemics before they become a serious public health threat.

Categories: Uncategorized