Objective:
Your task is to develop a RESTful service that manages and queries event data based on a user's geographical location and a specified date. This service will ingest data from a provided CSV dataset and then offer an API to find events for users.
Dataset:
You will be provided with a CSV dataset containing details of various events, including event names, city names, dates, times, latitudes, longitudes for each event.
Core Requirements:
External APIs: Below two external APIs are provided to you. Make use of these to build the response of the finder API.
Weather API: Retrieve weather conditions for an event based on its location and date.
Example request:
curl -w "\n" "https://gg-backend-assignment.azurewebsites.net/api/Weather?code=KfQnTWHJbg1giyB_Q9Ih3Xu3L9QOBDTuU5zwqVikZepCAzFut3rqsg==&city=Port%20Rebeccaberg&date=2024-03-01" |
Distance Calculation API: Calculate the distance between the user's location and the event location.
Example request:
curl -w "\n" "https://gg-backend-assignment.azurewebsites.net/api/Distance?code=IAKvV2EvJa6Z6dEIUqqd7yGAu7IZ8gaH-a0QO6btjRc1AzFu8Y3IcQ==&latitude1=40.7128&longitude1=-74.0060&latitude2=25.5169968004073&longitude2=-173.22570039222800" |
Things to consider:
Pick the right database and index to optimize query performance. Optimize the Event Finder API to make parallel calls to the external Weather and Distance Calculation APIs to minimize response times.Implement robust error handling for external API failures and other errors, ensuring graceful degradation
Tech Stack: You are free to choose any tech stack for this project.
Deliverables (Partial deliverables will not be evaluated):
The ReadME file should contain -
Test Case for the finder API:
Input:
User's Source Latitude: 40.7128, User's Source Longitude: -74.0060, Search Date: 2024-03-15
Output:
Page1:
{ "events": [ { "event_name": "Structure support choice", "city_name": "Fryland", "date": "2024-03-15", "weather": "Rainy 25C", "distance_km": 8910.23984646717 }, { "event_name": "Party development available", "city_name": "Port Alexander", "date": "2024-03-15", "weather": "Windy 27C", "distance_km": 12710.135679990924 }, { "event_name": "Air quickly home", "city_name": "Lawrenceview", "date": "2024-03-16", "weather": "Sunny 12C", "distance_km": 12674.554607967306 }, { "event_name": "Of ask open", "city_name": "New Andrew", "date": "2024-03-16", "weather": "Rainy 3C", "distance_km": 15346.670405580746 }, { "event_name": "Create success", "city_name": "New Susanmouth", "date": "2024-03-16", "weather": "Sunny 5C", "distance_km": 8301.79106018215 }, { "event_name": "Phone city", "city_name": "Riveraberg", "date": "2024-03-16", "weather": "Rainy 16C", "distance_km": 16078.589188877986 }, { "event_name": "Political check five", "city_name": "Lake Timothymouth", "date": "2024-03-17", "weather": "Snowy 12C", "distance_km": 14210.540682363631 }, { "event_name": "Glass although", "city_name": "Kathleenfort", "date": "2024-03-17", "weather": "Windy 1C", "distance_km": 10573.065392070204 }, { "event_name": "Assume by", "city_name": "East Brandyfort", "date": "2024-03-18", "weather": "Rainy -1C", "distance_km": 16561.73323780224 }, { "event_name": "Democrat seat nor", "city_name": "South Mark", "date": "2024-03-18", "weather": "Rainy 32C", "distance_km": 13743.417820685168 } ], "page": 1, "pageSize": 10, "totalEvents": 44, "totalPages": 5 } |
Page2:
{ "events": [ { "event_name": "May", "city_name": "New Brittany", "date": "2024-03-19", "weather": "Windy 10C", "distance_km": 12064.028098110557 }, { "event_name": "Involve describe", "city_name": "Port Jessica", "date": "2024-03-19", "weather": "Sunny 6C", "distance_km": 12599.102440105282 }, { "event_name": "Parent recognize", "city_name": "East Teresa", "date": "2024-03-19", "weather": "Rainy 27C", "distance_km": 14527.66932211488 }, { "event_name": "Player", "city_name": "Lewischester", "date": "2024-03-19", "weather": "Cloudy 16C", "distance_km": 15232.42376978484 }, { "event_name": "Build successful democratic article", "city_name": "South Misty", "date": "2024-03-20", "weather": "Cloudy 9C", "distance_km": 10666.823058586893 }, { "event_name": "Discover environmental left", "city_name": "Jennifertown", "date": "2024-03-20", "weather": "Windy 26C", "distance_km": 16949.357175041365 }, { "event_name": "Unit step remember", "city_name": "Scottfort", "date": "2024-03-21", "weather": "Rainy 0C", "distance_km": 11510.979200878548 }, { "event_name": "Take bill travel nearly", "city_name": "Melissaborough", "date": "2024-03-22", "weather": "Rainy 26C", "distance_km": 12108.74168258985 }, { "event_name": "Network still camera", "city_name": "New Amandastad", "date": "2024-03-22", "weather": "Snowy 8C", "distance_km": 7483.974180272756 }, { "event_name": "Camera", "city_name": "Kelleyborough", "date": "2024-03-22", "weather": "Cloudy 19C", "distance_km": 15992.150199618112 } ], "page": 2, "pageSize": 10, "totalEvents": 44, "totalPages": 5 } |
Good luck with your assignment.
Submit your assignment here - https://forms.gle/KCtJPzusoPqVogGA9
There is no deadline for the assignment, we will keep evaluating submissions till we close a candidate.