For those who are not familiar, MARTA stands for Metropolitan Atlanta Rapid Transit Authority.
In this project, you'll be filtering data from the MARTA Rail Realtime RESTful API.
The intent is to poll the API periodically, filter the results, and write the filtered data to a file (out.log
). See the "Goals" section below for details.
The provided code is in go but feel free to start a new project from scratch if you'd prefer to use another language. Along the same lines, feel free to import additional packages / libraries as needed.
You should be able to run the project as-is without any issues connecting to the API.
If, however, you encounter a permissions issue, feel free to register for your own key and update the API_KEY Secret value.
You've taken over this project from a summer intern who has since returned to school. It has not been deployed or even reviewed by any other developer yet. (side note: Assume that any code comments were left by the original author!)
You are tasked with updating (or rewriting in another language) as if for a real production service. (For example, assume any stdout output will be archived.)
- Filter the original API response to only the "TRAIN_ID", "STATION", and "WAITING_SECONDS" key-value pairs. (Case-sensitivity of the resulting key/val strings is NOT important, however.)
- Implement the
filterStops
method to further filter to only items whereWAITING_SECONDS
is less than120
. - Importantly, to minimize disk space, this service should NOT write to
out.log
any MORE frequently than once every10
seconds. Writing LESS-frequently, on the other hand, is acceptable, if needed, to improve resiliency. - Audit for pre-existing bugs / easy-to-fix inefficiencies!
- Consider resiliency, idempotency, security, and error-handling.
- Handling interrupts / signals is outside the scope of this exercise, BUT -- you can assume that if the process dies, it will immediately be restarted!
- Writing tests is outside the scope of this exercise as well.