This repository contains a comprehensive project developed as part of the "Software Documentation and Design Patterns" course. The project demonstrates the evolution from architectural design (UML) to the implementation of a multi-tiered web application, utilizing modern programming patterns and message brokers.
Primary Domain (Laboratories 1-3): Steam Gaming Platform (user registration, game catalog, gaming sessions).
Domain (Laboratory 4): Open Data Processing (NYPD Motor Vehicle Collisions).
- Language: Python 3.10+
- Web Framework: FastAPI, Jinja2
- Databases: SQLite (SQLAlchemy ORM), Redis, Google Firestore (NoSQL)
- Message Broker: Apache Kafka
- Infrastructure: Docker, Docker Compose
- UI/UX: HTML5, Bootstrap 5
- Data Generation: Faker
Designing the architecture of the "Steam" system using the Unified Modeling Language.
- Use Case Diagram: User registration and game purchasing.
- Class Diagram: Objects for game searching, session initiation, and status tracking.
- Activity Diagram: Demonstration of a gaming session and state recording.
- Sequence Diagram: The process of periodically saving the game session state to the database.
Implementing a strict three-tier architecture using Inversion of Control (IoC) and Dependency Injection (DI) patterns.
- DAL (Data Access Layer): Database interactions with SQLite via SQLAlchemy ORM.
- BLL (Business Logic Layer): Business logic that manages object creation and data parsing, completely isolated via interfaces.
- Presentation Layer: API endpoints for the automated import of 1000+ denormalized rows from a CSV file into relational tables.
Creating a fully functional web interface for data visualization and management.
- Implemented controllers to handle user HTTP requests.
- Created HTML representations (Views) using the Jinja2 template engine and Bootstrap.
- Implemented full CRUD (Create, Read, Update, Delete) operations for the "Game" entity via web forms.
Separating the data reading logic from the storage logic. Demonstrating dynamic, "on-the-fly" integration with various storage systems.
- Reading real-world dataset (NYPD Motor Vehicle Collisions). Link to dataset here.
- Dynamically switching the storage destination via the
config.jsonfile without modifying the core code. - Implemented Strategies:
ConsoleStrategy(formatted terminal output).RedisStrategy(writing to an In-memory DB).KafkaStrategy(publishing messages to a broker topic).FirestoreStrategy(saving to a Google Cloud NoSQL database).
- Clone the repository and navigate to the project directory.
- Create and activate a Python virtual environment.
- Install the required dependencies:
pip install -r requirements.txt
### Running Labs 2 & 3 (Gaming Platform)
*These tasks are executed in the root project directory.*
1. **Data Generation:** Create a test CSV file (1000+ rows):
```bash
python data_generator/generate_csv.py
- Start the Web Server: The
steam_app.dbdatabase will be created automatically.
python main.py
- Data Import (Lab 2): Open a new terminal and run the client script for bulk database population:
python client_test.py
- Web Interface (Lab 3): Open your browser and navigate to http://127.0.0.1:8000/games to access the game catalog and use CRUD operations.
This task is executed in its dedicated folder (e.g., strategy_pattern/).
- Environment Setup: Create a
.envfile for Google Firestore connection (add yourfirebase_key.json):
FIRESTORE_PROJECT_ID=your-data
FIRESTORE_COLLECTION=nyc_collisions
FIRESTORE_KEY_PATH=firebase_key.json
- Start Infrastructure: Spin up the Redis and Kafka containers using Docker:
docker-compose up -d
(Wait 15-20 seconds for Kafka to fully initialize).
3. Select Strategy: Open the config.json file and specify the desired storage type in the storage_type field (options: "console", "redis", "kafka", "firestore").
4. Execution: Run the main script:
python main.py
- Stop Infrastructure: Once finished, tear down the Docker containers:
docker-compose down