Hosted on AWS EC2: Mind-hive
LinkedIn: Amirul Iman GitHub: Mind Hive Interview Assessment - Amirul
This assessment showcases an application combining web scraping, geospatial analysis, and AI-driven search functionalities.
It involves constructing a full-stack solution with a Django-powered backend and a React.js frontend, focusing on the efficient gathering, storage, and visualization of geospatial data from Subway outlets in Kuala Lumpur.
The project leverages technologies including MongoDB for data storage and leaflet.js for geospatial analysis and mapping, and OpenAI's gpt-4-turbo-preview model to enhance search capabilities.
- Python 3
- MongoDB
- OpenAI API Key
- Create a Python Virtual Environment (Optional but Recommended)
- python3 -m venv mindhive_venv
- source mindhive_venv/bin/activate
- Install Required Libraries
- Navigate to
mindhive/requirements.txt
. - Run
pip install -r requirements.txt
.
- Start the Django Application
- Export MongoDB URI and OpenAI API key as environment variables.
- Change directory to
mindhive/api
and run:export MONGO_CONNECTION_STRING="<MongoDB_URI>" export OPENAI_API_KEY="<OpenAI_API_Key>" python3 manage.py runserver
- Node.js and npm
- Install Node Modules
- In the project root directory, run
npm install
.
- Start the Frontend Application
- Run
npm start
.
- Target URL for Scraping:
https://subway.com.my/find-a-subway
- view-source:https://subway.com.my/find-a-subway to better understand the structure
- Example
<div
class="fp_listitem fp_list_marker2"
data-latitude="3.128099"
data-longitude="101.678678"
>
<div class="location_left">
<h4>Subway Menara UOA Bangsar</h4>
<div class="infoboxcontent">
<p>Jalan Bangsar Utama 1, Unit 1-2-G, Menara UOA Bangsar, Kuala Lumpur, 59000</p>
<p></p>
<p>Monday - Sunday, 8:00 AM - 8:00 PM</p>
<p></p>
<p class="infoboxlink">
<a href="/find-a-subway" title="Subway Menara UOA Bangsar">Find out more...</a>
</p>
</div>
<div class="infopointer"></div>
</div>
<div class="location_right">
<div class="directionButton">
<a target="_blank" href="https://goo.gl/maps/8n6W5Syy3vUAGeQV8">
<i class="fa-solid fa-location-dot"></i>
</a>
<a target="_blank" href="https://www.waze.com/en/live-map/directions/my/federal-territory-of-kuala-lumpur/kuala-lumpur/subway-@-menara-uoa-bangsar?place=ChIJPWFRH5RJzDERvHvlO1uTQpY">
<i class="fa-brands fa-waze"></i>
</a>
</div>
</div>
</div>
- Scrape details such as name, address, operating hours, Waze link and geographical coordinates, in Kuala Lumpur ensuring pagination handling.
- Store the data in MongoDB with an appropriate schema.
- Develop a backend API using Django to serve outlet data.
- Establish MongoDB connection
- Create a React.js web application for visualizing outlets on a map.
- Implement a 5KM radius catchment visualization for each outlet and highlight intersections.
- Frameworks and Libraries
- leaflet.js: For interactive mapping.
- web-vitals: For measuring web vitals.
- Add a search box for queries.
- Use OpenAI's gpt-4-turbo-preview model