Skip to content

davidvella/MAT-Coding-Challenge

 
 

Repository files navigation

MAT Fan Engagement Coding Challenge

Prerequisites:

Introduction

The purpose of this challenge is for you to demonstrate

  • write and structure a simple backend application in an appropriate language of your choice
  • parse and transform streamed telemetry data
  • deliver a component to integrate into a stack of technologies

Feel free to use any libraries, frameworks or dependencies you want in order to achieve the task.

Please include instructions on how to build and run your code, any tests you've written and some text explaining what you did.

If you are already familiar with the underlying technologies we hope that it won't take you more than a couple of hours to get your application up and running.

Scenario

Real-time data from a Formula 1 race has been recorded and streamed into our system. We want to use that data in order to increase fan engagement by providing a live visualisation.

Challenge

Raw telemetry data is arriving via MQTT. A basic front-end application has been developed to visualise F1 cars going around a track. It can also display an event stream and car status information such as speed and position, but currently it is not receiving this information.

Please develop a data processing application which subscribes to the provided MQTT broker and consumes data from the following MQTT topic with the format shown:

  • carCoordinates

      {
        timestamp: number,
        carIndex: number,
        location: {
          lat: float,
          long: float
         }
      }

    e.g.

      {
        "timestamp": 1541693114862,
        "carIndex": 2,
        "location": {
          "lat": 51.349937311969725,
          "long": -0.544958142167281
         }
      }

It should then publish aggregated and enriched data on the following MQTT topics using the format described:

  • carStatus

      {
        timestamp: number,
        carIndex: number,
        type: string<SPEED|POSITION>,
        value: number
      }

    e.g.

      {
        "timestamp": 1541693114862,
        "carIndex": 2,
        "type": "POSITION",
        "value": 1
      }
  • events

      {
        timestamp: number,
        text: string
      }

    e.g.

      {
        "timestamp": 1541693114862,
        "text": "Car 2 races ahead of Car 4 in a dramatic overtake."
      }

All these topics will then be forwarded via a gateway-like MQTT-to-WebSocket service to the frontend application.

Architecture

Components

Getting started

Start all components:

$ docker-compose pull
$ docker-compose up -d
Creating network "mat-coding-challenge_default" with the default driver
Creating broker ... done
Creating source_gps        ... done
Creating mqtt-to-websocket ... done
Creating webapp            ... done

Open (http://localhost:8084)

Test the setup with mosquitto_pub or a similar MQTT client:

$ mosquitto_pub -t events -f examples/event.json
$ mosquitto_pub -t carStatus -f examples/position.json
$ mosquitto_pub -t carStatus -f examples/speed.json

You should now see a car's position and an event in the webapp.

About

MAT Fan Engagement coding challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.5%
  • Dockerfile 0.5%