You recently created a new company in the GAMING industry
. The company will have the following scheme:
As a data engineer you have asked all the employees to show their preferences on where to place the new office. Your goal is to place the new company offices in the best place for the company to grow. You have to find a place that more or less covers all the following requirements (note that it's impossible to cover all requirements, so you have to prioritize at your glance):
Notice you'll have to do two things:
There is a couple of ways you can do this:
From the existing companies, choose one to steal their current venue 🥷: query and filter the database based on some of your criteria. Then use an API to do queries (from those companies) and check the companies' surroundings to check the other criteria.
Your result will be coordinates
.
Choose three cities that exist in your database. From these cities, query and filter the database according to any other criteria if necessary. Then, make API calls to see if the rest of your criteria are met. Then, compare the three cities. Are any of them better than the other two? Using data, justify why.
Once you chose the city, what would be an approximate location?
Your result will be a city
and a neighbourhood/zip code or adress/coordinates.
Be creative. But remember: always try to follow a general-to-specific approach and base your decisions always using data.
Filter your database
Find some candidate cities based on amount of companies (or other criteria)
Find the geoJSONS for the neighbourhoods of those cities. Import these polygons into mongoDB as a collection on its own. Eg: berlin-neigh
Set the index of this collection to 2ndsphere
Do API calls to get info for the desired cities
Save each result of the API calls as a document in a specific document: eg.: one collection for schools and each document will be a school in berlin, another school in nyc, etc
# Collections with "type": "Polygon"
munich/ #collection of its neighbourhoods as polygons
london/ #collection of its neighbourhoods as polygons
rotterdam/ #collection of its neighbourhoods as polygons
# Collections with "type": "Point"
schools/ #collection of schools in all three cities
starbucks/ #collection of starbucks in all three cities
restaurants/ #collection of restaurants in all three cities
(...)
Make decisions based on that:
What is your conclusion? best place: neighbourhood? some other company? a given point?
You found a perfect location for your company: but it's either taken by another company or there's too many options in the city you chose. After all, a whole city is not too specific.
Web scrape real state sites 🏠 to get the best prices and choose a neighbourhood, a block or an adress.
{ type: "Point", coordinates: [ 40, 5 ] }
db.collection.createIndex( { <location field> : "2dsphere" } )
$near
operator: https://docs.mongodb.com/manual/reference/operator/query/near/#op._S_nearmy-project.md
(within the parentheses) on this repo.lat
and long
for the new office proposals.