This project implements a full-stack application with the following tech stack:
- Backend: Flask Framework
- Frontend: React with Vite
- Database: SQLite
The initial backend development began with Spring Boot, chosen for its design-pattern enforcement (e.g., factory design pattern with strategy method). However, it was later switched to Flask for better performance and simplicity. The backend adheres to the Model-View-Controller (MVC) design pattern:
- Models: Data ingestion is handled by services and stored in repositories.
- Controllers: Contain endpoints and route logic. CRUD endpoints are included for testing purposes.
Data filtering is implemented on the frontend to reduce backend API calls, optimizing system performance. This trade-off aligns with scalability concerns, especially for large applications. For such cases, GraphQL may be a preferable alternative to REST APIs.
The frontend features a table, a pie chart and a line chart to represent data visually, ensuring an interactive and informative user experience. Feel free to interact with the charts
Key considerations:
- Null values in the datasets were excluded instead of being mocked.
- Duplicated data (e.g.,
dataset4.pptxslide 2) was ignored if it was already present indataset2.csv.
The backend entry point is located in backend/app.py.
git clone https://github.com/JingRonggg/TOPO_assignment.git
cd TOPO_assignment- Have docker installed
- Open up docker application
- Run
docker-compose up --build
- Frontend is hosted on http://localhost:5173/
- Backend is hosted on http://localhost:5000/
- Navigate to the backend directory:
cd ./backend - Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
venv/Scripts/activate # For Windows source venv/bin/activate # For macOS/Linux
- Install required packages:
pip install -r requirements.txt
- Create a
.envfile:- Follow the structure in
example.env. - Update the database path:
sqlite:///database.db.
- Follow the structure in
- Run the Flask app:
flask --app app --debug run
- Open a new terminal and navigate back to the project root:
cd ../frontend - Install required node packages:
npm install
- Run the frontend development server:
npm run dev
- Navigate to the backend directory:
cd ./backend - Activate the virtual environment (Assuming you have installed the env):
venv/Scripts/activate # For Windows source venv/bin/activate # For macOS/Linux
- Execute tests using Pytest:
pytest -v
- Null data points were considered erroneous and excluded during processing.
- Data in
dataset4.pptx(slide 2) was assumed redundant, as it overlapped withdataset2.csv. - The
pptxdataset's structure was assumed fixed for string manipulation.
- Extracting data from
pptxfiles required learning new parsing techniques (Using python-pptx). - Limited experience with frontend development posed challenges in implementing UI components like charts.