Exercise
You are tasked with creating a data-processing app that pre-processes and enriches the data coming from crawlers, with the following requirements.
- INPUT: csv-like data submitted by crawlers
- OUTPUT: clean data saved into mongodb collections
- The app is an HTTP API server. Every year, crawlers will submit the data saved in a file, using the API endpoint designed by you.
- Examples of data the crawlers will submit every year: see
data-2018.txt
,data-2019.txt
,data-2020.txt
. You can't change the format of the data. - As you can see, the data coming from crawlers is not 100% well-structured, the API should parse it correctly.
- a repeated submission with the data of the same year should perform an update on the existing yearly data.
- if there is any error in the submission or processing, the API should return a proper error message with proper HTTP response status
- For each university, enrich the data with a URL and a text description of it using Duckduckgo API e.g. https://api.duckduckgo.com/?q=harvard&format=json&pretty=1
- The app inserts or updates clean data in 2 mongodb tables/collections:
- table 1 - the yearly data table
- table 2 - the universities info
- table 1 contains data from every year, table 2 contains only the latest data.
- the data processing and transformations should be covered by tests.
- The solution should be in Python programming language, however you may use any 3rd party library you like.
Feel free to clarify the requirements further, if you have any doubts.
Bonus (Optional)
If you have indicated any DevOps skillsets in your resume, please create a Dockerfile, and using docker deploy the web app onto a free cloud platform, such as Heroku.
How the solution is assessed
The criteria are as follows (descending importance)
- Your code should perform the functionalities required
- Your code should be well-covered by tests
- Your code should be modular, readable and maintenable by other engineers.
- Your code should be robust, and can handle failure such as missing field, disconnection from DB or external server.
- Your code should be efficient and fast.
- Your code should be pretty.