You will need to have NodeJS (version >= 12.13) and npm (version >= 6.14). Using previous
versions does not guarantee that the program will run correctly as it uses some ES2018 methods
which have only been available in the latest versions of Node (e.g. Array.pototype.flat()
).
First, you will need to install the dependencies. From the command line run:
npm install
According to the task instructions, the program runs through the unit tests created using Jest. To run them, use the command:
npm test
- The first-registration-date field ONLY refers to the specific VRM and NOT the registration
date at first purchase. This implies that one has to check if the specific car has any
prior vrm-change events in its timeline in order to gather the entire car's timeline.
- The timeline array of events of a specific car, can contain AT MOST ONE vrm-change event
indicating the previous VRM and ONE vrm-change event indicating the next VRM. This reduces
the data duplication (by avoiding the storage of the same events multiple times) and also
allows for the timeline of a car to be modeled as a directed graph that can be traversed
using the VRM as the key: Each vehicle only 'knows' about its direct ancestor and successor.
- When calculating the average-mileage, only the latest two events are used, and the rest are ignored. The decision was based on data found here which shows that there is a decreasing trend in the annual mileage of vehicles over the last few years. This makes older mileage values less reliable estimators of the current average mileage.