Tag Archives: Semantic Web

Real-time Twitter heat map with MongoDB

Over the last few weeks I got in touch with the fascinating field of data visualisation which offers great ways to play around with the perception of information.

In a more formal approach data visualisation denotes “The representation and presentation of data that exploits our visual perception abilities in order to amplify cognition

Nowadays there is a huge flood of information that hit’s us everyday. Enormous amounts of data collected from various sources are freely available on the internet. One of these data gargoyles is Twitter producing around 400 million (400 000 000!) tweets per day!

Tweets basically offer two “layers” of information. The obvious direct information within the text of the Tweet itself and also a second layer that is not directly perceived which is the Tweets’ metadata. In this case Twitter offers a large number of additional information like user data, retweet count, hashtags, etc. This metadata can be leveraged to experience data from Twitter in a lot of exciting new ways!

So as a little weekend project I have decided to build a small piece of software that generates real-time heat maps of certain keywords from Twitter data.

This is a first static peek on what it’s gonna look like (apparently the friendly floatees use Twitter, too):

See a screencast here: screencast.com

To get this working I have used lots of shiny things:

The app is written in Python and consists of mainly three components:

tstream.py:
A small service based on tweepy that implements a StreamListener which inserts incoming data in a MongoDB capped collection. Here you can also set filter terms. This example uses mostly terms related to “Big Data”.

tweet_service.py:
A Flask based web app which get’s new data from MongoDB and makes use of the publish-subscribe pattern. Being “tailable” MongoDB’s capped collections come in handy. There is no need to remember which messages a client has already received, the cursor itself yields new documents on arrival. Also, capped collections are of a fixed size which is appropriate for this use case but your mileage may vary. Incoming Tweets are published to a redis channel for which there is also a listener that returns a “text/event-stream” “Content-Type” header for connecting clients.

map.html:
A few lines of HTML and JavaScript which bring up a Google Maps canvas and a listener for server-sent events. When new data, basically consisting of Lat/Lon tuples, arrives the new point is added to a heat map overlay based on heatmap-gmaps.js in real-time.

Rough overview:

Conclusion

With a relatively small amount of code it is possible to turn text data in astonishing visualizations. With only a little more effort different hash tags could be illustrated by different colors. Or one could count tweets on a topic in certain regions and then compare activity based on number of citizens. There are lots of interpretations possibel through the underlying data set.

You can find the code on github, feel free to fork and play around!

Community-Firma

Swiss-Re spricht es klar aus: Das Unternehmen als eine real existierende Community braucht die elektronische Abbildung, um den Informationsfluß zwischen den Mitarbeitern im komplexen Marktgeschehen auf Hochtouren zu bringen.

http://www.cio.de/strategien/methoden/2235769/?qle=rssfeed_

Langfristiger Markterfolg und keine kurzfristigen ROI-Betrachtungen werden Swiss-Re Recht geben!

Collective Intelligence: Idee & Konzept

Collective Intelligence – Collecting Tags

Die Webanwendungen lernen die von ihnen gespeicherten Daten nach Zugehörigkeit zu den Subjektgruppen zu unterscheiden. Diese Subjekte sind: User, Content (strukturiert und unstrukturiert) und Items (z.B. Produkte im Webshop).

Periodische Wissensgenerierungsprozesse bieten den Webanwendungen die Möglichkeit die gespeicherten Informationen über die Subjekte zu „verstehen“ und daraus zu „lernen“. Dies geschieht durch Collective Intelligence Algorithmen, die unstrukturierten Daten (z.B. Blogs, Forumbeiträge, Kommentare) analysieren und eine Metadatenschicht erzeugen. Diese „Daten über Daten“ werden in Form von Tags extrahiert und gespeichert.

Eine zweite wichtige Wissensquelle sind ereignisgesteuerte Prozesse, die auf der Interaktionsanalyse der User mit der Anwendung und der Subjekte untereinander beruhen. Diese so genannte „explizite Intelligenz“ kann beispielsweise durch Web 2.0 Funktionalitäten, wie z.B. Ratings, Tagging, Bookmarking oder andere typische Web 2.0 Module wie „Kontakte“ generiert werden.

Bezieht und analysiert man noch zusätzliche Daten aus vorhandenen Drittsystemen,  beispielsweise aus CRM und SCM, verfeinert man das Wissen über die Subjekte und deren Beziehungen untereinander um weitere Dimensionen, wie z.B. Zeit und Transaktionshistorie.

Dieser neuartige Ansatz, bei dem es nicht nur darum geht Wissen aus allen verfügbaren Datenquellen zu bündeln, sondern auch darum die gespeicherten Informationen für Maschinen „verständlich“ zu machen und die Daten auf der semantischen Ebene miteinander zu verknüpfen versetzt die Webanwendungen in die Lage neues Wissen zu akquirieren und neue Zusammenhänge zu erkennen, die zuvor unerkannt waren.

Dadurch liefert Collective Intelligence wirtschaftlich verwertbare Mehrwerte und Informationen, die sich im Bereich des Operational Reporting (kundenseitig) und des
Tactical / Strategic Reporting (unternehmensseitig) verarbeiten lassen.

Der Kunde / User profitiert von vollständig personalisierten Inhalten, die in Echtzeit auf sein Profil und seine Interessen individuell zugeschnitten werden, während die Unternehmen  in der Lage sind bisher unerkannte Informationen zu beziehen und die Effizenzindikatoren und Trends zu verfolgen.