Let's build a weather service. In this task, you will digest the weather data source and expose it via an amazing API that you are going to build!
For this task, we will use CSV files as our data source just to make it simple. In the "real world", we won't use CSV, but other formats that are more optimized for weather data such as NetCDF, Zarr. Attached you will find 3 files in CSV format. The files represent weather forecast data. The files are world coverage so you will be able to know what is the weather all over the world! Each file represents a weather forecast of a different time (day/hour).
BTW: this is just mock data, don't try to plan your next trip based on this forecast :)
In this task, we want you to create a web service that will give the user a timeline of a weather insight - if a certain condition, based on the weather parameters, is met for a specific location. To do so, you will have to ingest several files containing weather data into a database of you choice. Each file has 5 columns: Longitude, Latitude, forecast time, Temperature, Precipitation. The service will expose a single route:
/weather/insight?condition={condition}&lat={lat}&lon={lon}
- will return eithertrue
orfalse
for every timestamp, for two predefined conditions:veryHot
- based on the conditiontemperature > 30
rainyAndCold
- based on the conditiontemperature < 10 AND precipitation > 0.5
**Please note that Temperature is in Celsius, and Precipitation Rate is in mm/hr.
-
Query Parameters: lat, lon, condition
condition
can be eitherveryHot
orrainyAndCold
-
Output (JSON) - Example:
[ { "forecastTime": "2018-12-10T13:00:00.000Z", "conditionMet": true, }, { "forecastTime": "2018-12-10T14:00:00.000Z", "conditionMet": false, }, { "forecastTime": "2018-12-10T15:00:00.000Z", "conditionMet": false, }, ]
- A working end to end service.
- A github repository with your solution.
- Add a section to your readme:
How to use this service
for examplehttp://my-cool-service.com/weather/insight?condition=veryHotlat=42.332&lon=35.421
Make sure that the URL that you are providing is WORKING! (curl <YOUR_URŁ>
should provide a result)
The service should have 2 parts:
- Ingest the CSV into Database.
- Web Server that reads the data from the Database and displays it.
- Programming Language: Pick whatever you like, pick the language that you are most comfortable with.
- Database: SQL/NoSQL, whatever you think will be fast and good for this task.
- You can use any free hosting provider such as render.com, Heroku, AWS, GCS, Azure, DigitalOcean, etc... (if you don't know any of them, we recommend using render.com as it is the easiest to start with and we tested that the task can run on it).
- Take your time to go over the instructions and attached data before you begin.
- You can use the following examples to validate that your code is working as expected:
-
Request:
http://{url}/weather/insight?lon=51.5&lat=24.5&condition=veryHot
Response:
[ { "forecastTime": "2021-04-02T13:00:00Z", "conditionMet": true }, { "forecastTime": "2021-04-02T14:00:00Z", "conditionMet": true }, { "forecastTime": "2021-04-02T15:00:00Z", "conditionMet": false } ]
-
Request:
http://{url}/weather/insight?lon=51.5&lat=24.5&condition=rainyAndCold
Response:
[ { "forecastTime": "2021-04-02T13:00:00Z", "conditionMet": false }, { "forecastTime": "2021-04-02T14:00:00Z", "conditionMet": false }, { "forecastTime": "2021-04-02T15:00:00Z", "conditionMet": true } ]
-
- Attach to your task a list of things that you think should be optimized/pitfalls in your solution.
- Write any assumptions that you make (if any).
- This is not a production service, but we will be happy to know what is missing to make it one.
- If you think that you are investing too much time on the task, please let us know and write what is missing to complete it.
Please contact us, WhatsApp, email, phone call.
Good luck!