IBM Intelligent Operations Center and Police

In this scenario I use IOC to view official announcements by Finnish Police. In previous post about IOC I mentioned that any image can be used as a location map and in the screenshot below I use an image of Finland’s main police stations as a location map to show police announcements.

IOC_police_announcements_wk40


Location map is divided in areas based on Finland’s main police stations. IOC makes it easy for administrator to define areas in a location map using the location map editor. Below is a screenshot of location map and the editor where administrator can draw areas in the location map image.

IOC_location_map_editor

Each area has a name and when I specify a data source, I define area name for the data item and IOC displays the item in the correct area in the location map.

The data is retrieved periodically from the RSS-feed using Linux cron-job and then transformed to CSV using the following Python-script (presented here for the curious).

#/usr/bin/python

import sys
import datetime
import time
startTime=str(datetime.datetime.now())
endTime=startTime

def getContent(xml,tag):
  startTag='<%s>' % tag
  endTag='</%s>' % tag
  content=xml[xml.find(startTag):xml.find(endTag)]
  content=content.replace(startTag,'').replace(endTag,'')
  return content

filename='feedrss.xml'
if len(sys.argv)>1:
  filename=sys.argv[1]
f = open(filename)

print "id,area,title,starttime,endtime,timezoneoffset,latitude,longitude,link"
for line in iter(f):
  index=line.find('<item>')
  while index>-1:
    endIndex=line.find('</item>',index)
    item=line[index:endIndex]
    title=getContent(item,'title')
    area=title[title.find('(')+1:].replace(')','').strip()
    title=title[title.find(',')+1:title.find('(')].strip()
    title=title.replace(",",'-')
    link=getContent(item,'link')
    pubDate=getContent(item,'pubDate')
    timestruct=time.strptime(pubDate[:pubDate.find('+')].strip() ,"%a, %d %b %Y %H:%M:%S")
    timestamp=time.strftime("%Y-%m-%d %H:%M:%S.000", timestruct)
    id=link[link.rfind('/')+1:]
    csvLine="%s,%s,%s,%s,%s,2,62.6741,25.7519,%s" % (id,area,title,timestamp,timestamp,link)
    print csvLine
    line=line[endIndex:]
    index=line.find('<item>')

f.close()

In retrospect, I should have made separate CSV for each police station, instead of one CSV for all stations. This way I could have had one data source for each police station and then I would have had more control what I want to see and filter in IOC.

Leave a Reply

Your email address will not be published. Required fields are marked *