top
(README.md)
# Interview Task

## Install and usage

'go get github.com/samihiltunen/interview_task'
'go get github.com/gorilla/websockets'
'python datagenerator.py'
'go run main.go'

Browse to localhost:3000. Important to be run on the same machine as the WebSocket will be opened to localhost:3000/events.

## Comments

I chose WebSockets for transmitting the event data as there is a need to pass large amounts of information quickly. A WebSocket suits this well as it is a single persistent connection. 

For visualizing the events, I picked Leaflet maps combined with a heatmap. A heatmap shows nicely where the majority of the events are coming from. Problem with the example dataset is that it is evenly distributed which doesn't make for very interesting a heatmap. Real world event data would be a bit more focused, thus yielding a more interesting heatmap. 

I took liberty in changing the provided source files as there were some show stopper bugs in them. Datageneratory.py doesn't print seconds with leading zeroes (which leads to time's like 15:16:2) which causes Go's time parsing to fail. The files were also looking for differently named files, which I corrected. Biggest change to the original Go file is that I modified it to be a pretty standard HTTP server with a route for a WebSocket for providing the event data.

## Time constraints

Unfortunately I didn't have much time to spare during the work week. The given task is fulfilled in a basic and not so beautiful manner. Some notable things I would have liked to improve:

* Distribution
	- The JavaScript files could be fetched with npm or other such package manager. Currently some of the dependencies have been included with the distribution and some will be fetched from CDN networks.

* Environment
	- Docker would be nice just to smoothen the installation out and make it easy to run. I trust you have Go readily available so only fetching a single Go dependency should be enough. :)

* Go-source
	- Everything in a single file, some workarounds to randomize the dataset plus goroutine and a file handler that will be leaked if the socket closes early. The code is not nice and mostly just serves to implement the requested functionality.

* Actual application
	- To make the heatmap visualization more useful, a rolling window should be implemented for the heatmap. Currently it just visualizes all the events which isn't a good approach if the purpose is to monitor current system load for example. More information should also be made available on the map.

Imports 1 package(s) ΒΆ

  1. github.com/gorilla/websocket