Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Applied Python Systems Suite

Python 3.10+ Pillow Architecture: Modular Package Concurrency: Multi--Threaded Code Style: Clean & PEP8 License: MIT

Course: Data Analytics (Finals Practicum & Lab Assignment 05)
Author: Imran Mian (@memrranmian)
Domain: Applied Software Engineering, Systems Architecture & Core Python Internals


🎯 Skills & Competency Matrix (Recruiter & Academic Overview)

This suite is structured to demonstrate proficiency in core software engineering, data analytics workflows, and systems-level programming:

Competency Domain Core Technical Skills & Applied Modules Production Pattern Implemented
Concurrency & Synchronization threading.Thread, threading.Lock, race condition prevention Multi-threaded pipeline decoupling compute and I/O reporting
Functional Data Pipelines map(), filter(), functools.reduce(), zip(), lambda Declarative, pure-function data pipelines (ETL, financial aggregations)
Modular Systems & Architecture Python Packaging (__init__.py, __all__), importlib.reload(), sys.path Enterprise package design, decoupling interfaces from implementation
Systems & Storage Engineering os, os.stat, seek(), tell(), file streams (read, readline, readlines) Low-level pointer manipulation, atomic file operations, resource safety (try...finally)
Computer Vision & Media Pillow (PIL.Image, PIL.ImageDraw), color matrices (RGB, RGBA, L) Batch multichannel transformations, spatial validation, dimension filtering
Defensive Programming & QA Custom Exception Hierarchies (InvalidMarksError), strict validation Boundary defense against non-numeric data, missing records, zero-division
Temporal & Calendar Analytics datetime.datetime, datetime.date, calendar.monthrange, calendar.TextCalendar Automated fiscal and working-day schedule calculations

πŸ“Œ Executive Overview

The Applied Python Systems Suite is an enterprise-grade collection of five modular, real-world Python applications engineered to demonstrate advanced programming paradigms, systems programming, and algorithmic design.

The suite emphasizes:

  • Production-Grade Architecture: Custom packaging, dynamic module loading, and clean separation of concerns.
  • Concurrency & Synchronization: Multi-threaded pipeline execution with thread safety and mutual exclusion locks (threading).
  • Functional Programming: Declarative transformations and reductions utilizing map(), filter(), reduce(), and lambda expressions.
  • Resilient I/O & OS Internals: Low-level file pointer manipulation with seek(), OS stat querying, atomic file operations, and safe resource lifecycle management (try-finally).
  • Digital Image Processing: Multichannel image transformation and filtering pipelines powered by Pillow (PIL).

πŸ—οΈ Repository Architecture

applied-python-systems-suite/
β”‚
β”œβ”€β”€ Question_1.py                  # University Student Result & Exception Management Engine
β”œβ”€β”€ Question_2.py                  # Smart Business Utility & Financial Reporting Pipeline
β”œβ”€β”€ Question_3.py                  # Library Inventory & Low-Level File Management System
β”œβ”€β”€ Question_4.py                  # Digital Image Processing & Transformation Pipeline
β”œβ”€β”€ Question_5.py                  # Multi-Threaded Employee Attendance & Payroll System
β”‚
β”œβ”€β”€ business_utils.py              # Custom Utility Module (Financial & DateTime operations)
β”œβ”€β”€ report_utils.py                # Custom Reporting Module (Calendar & Ledger generation)
β”œβ”€β”€ book_operations.py             # Root Interface for Library Operations
β”‚
β”œβ”€β”€ library/                       # Custom Python Package (Modular Architecture)
β”‚   β”œβ”€β”€ __init__.py                # Package Initialization & Public Symbol Exposure
β”‚   β”œβ”€β”€ book_operations.py         # Inventory CRUD, Title Search (*args), & Attributes (**kwargs)
β”‚   └── file_operations.py         # Low-level I/O, File Pointers (seek/tell), & os.stat Inspection
β”‚
β”œβ”€β”€ SampleInputImages/             # Test Image Corpus for Image Processing Pipeline
β”‚   β”œβ”€β”€ campus_view.png            # High-resolution test image (800x600 PNG)
β”‚   β”œβ”€β”€ library_hall.jpg           # High-resolution photo (700x700 JPEG)
β”‚   β”œβ”€β”€ student_badge.png          # Transparent RGBA sample (400x300 PNG)
β”‚   β”œβ”€β”€ icon_logo.bmp              # Bitmap graphic (300x300 BMP)
β”‚   └── corrupt_image.xyz          # Faulty input asset for exception verification
β”‚
β”œβ”€β”€ AttendanceRecords/             # Auto-generated Enterprise Attendance & Payroll Data
β”‚   β”œβ”€β”€ employee_attendance.txt    # Pipe-delimited raw attendance storage
β”‚   └── monthly_payroll_report.txt # Formatted final payroll audit report
β”‚
β”œβ”€β”€ LibraryRecords/                # Auto-generated Library Records & Metadata
β”‚   β”œβ”€β”€ library_inventory.txt      # Master inventory flat file
β”‚   └── final_inventory_report.txt # Formatted tabular inventory report
β”‚
β”œβ”€β”€ ProcessedImages/               # Batch Image Processing Outputs (16 transformed assets)
β”‚   β”œβ”€β”€ *_cropped.*                # Center-cropped image assets
β”‚   β”œβ”€β”€ *_gray.*                   # Grayscale converted assets
β”‚   β”œβ”€β”€ *_resized_300x300.*        # Standardized resolution assets
β”‚   └── *_rot90.*                  # 90-degree orthogonal rotated assets
β”‚
β”œβ”€β”€ student_results_report.txt     # Generated Academic Performance Audit
β”œβ”€β”€ business_monthly_report.txt    # Generated Monthly Financial Audit
β”œβ”€β”€ .gitignore                     # Git Exclusion Rules (pycache, envs, binaries)
└── README.md                      # Comprehensive Project Documentation

πŸš€ System Modules & Engineering Deep-Dive

Module 1: University Student Result & Exception Management System (Question_1.py)

A grading and academic classification engine featuring domain-specific exception models and safe file streaming.

  • Variadic Functions (*args): Ingests arbitrary numbers of subject marks per student.
  • Functional Analytics: Employs map() with lambda for percentage computations and filter() for identifying high-scoring subjects ($\ge 80$).
  • Domain Exception Handling: Custom user-defined exception InvalidMarksError alongside handling for non-numeric marks (TypeError), missing metadata (ValueError), and empty sequences (ZeroDivisionError).
  • Resource Safety: Guarantees deterministic file handle closure via try...finally blocks.

Module 2: Smart Business Utility & Financial Reporting Pipeline (Question_2.py)

A business analytics engine showcasing modularization, module resolution internals, and dynamic reloading.

  • Modular Decoupling: Implements custom modules business_utils.py and report_utils.py.
  • Python Runtime Internals: Demonstrates module path resolution via sys.path and runtime hot-reloading with importlib.reload().
  • Functional Sales Processing:
    • Uses map() to dynamically compute a 5% tax surcharge.
    • Uses filter() to extract high-value corporate transactions ($> \text{Rs. } 10,000$).
    • Uses functools.reduce() to compute total enterprise revenue and tax liabilities.
    • Uses zip() to map generated transaction IDs (TXN-XXXXXX) to transaction amounts into a hash map.
  • Benchmark Timing: Measures exact report compilation latency via time.time().

Module 3: Library Inventory & Low-Level File Management System (Question_3.py)

An inventory management package illustrating enterprise package structures and low-level byte/stream manipulation.

  • Package Architecture: Organizes logic into an importable library package containing book_operations and file_operations.
  • Variadic Parameter Handling: Flexible book ingestion using **kwargs and multi-title batch search queries using *args.
  • Stream Operations & Pointer Manipulation: Demonstrates granular file operations using read(), readline(), readlines(), and explicit pointer rewinding with seek() and tell().
  • OS Systems Programming: Inspects inode metadata and file permissions via os.stat(), verifies file existence, and performs transactional file rename/deletion.

Module 4: Digital Image Processing & Transformation Pipeline (Question_4.py)

A batch digital signal and media processing engine powered by the Python Imaging Library (Pillow / PIL).

  • Attribute Inspection: Extracts dimensions, color channels, formats, and compression modes across JPEG, PNG, and BMP formats.
  • Batch Transform Pipelines: Utilizes map() with higher-order functions to execute batch image operations:
    • Resizing to standard dimensions ($300 \times 300$).
    • Orthogonal coordinate cropping with boundary validation.
    • Coordinate matrix transformations (90Β° rotations).
    • Color quantization and grayscale mode conversions (L mode).
  • Predicate Filtering: Filters images with dimensions exceeding $500 \times 500$ pixels using filter().
  • Fault Tolerance: Robust handling for unsupported image formats (UnidentifiedImageError), missing paths, and out-of-bound crop coordinates.

Module 5: Multi-Threaded Employee Attendance & Payroll System (Question_5.py)

A concurrent workforce payroll engine designed with Python's threading and POSIX calendar tools.

  • Calendar Calculations: Calculates working days (Mon–Fri) dynamically for any target calendar month via calendar.monthrange() and datetime.date.
  • Threaded Concurrency: Decouples heavy calculation from report generation across concurrent worker threads:
    • Thread 1 (HoursCalculationThread): Validates and calculates daily hours and daily wage maps using map().
    • Thread 2 (PayrollReportThread): Performs salary reductions (reduce()), flags underperforming staff ($< 6.0\text{ hrs/day}$ via filter()), and formats the final ledger.
  • Thread Safety: Implements mutual exclusion locks (threading.Lock) over shared data structures.
  • Continuous File Streaming: Preserves historical audit records through sequential file append operations.

πŸ› οΈ Technology Stack & Python Concepts

Category Modules & Concepts Demonstrated
Language & Runtime Python 3.10+, sys, importlib, math, random, time
Concurrency & Threading threading.Thread, threading.Lock, thread synchronization
Functional Paradigms map(), filter(), functools.reduce(), zip(), lambda expressions
Systems & Storage I/O os, os.stat(), open(), read(), readline(), readlines(), seek(), tell()
Temporal Calculations datetime.datetime, datetime.date, calendar.TextCalendar, calendar.monthrange()
Computer Vision / PIL PIL.Image, PIL.ImageDraw (Pillow)
Data Structures Dictionaries, Sets, Lists, Tuples, *args, **kwargs
Exception Handling Custom Exceptions (InvalidMarksError), ZeroDivisionError, TypeError, ValueError, FileNotFoundError

⚑ Getting Started

1. Prerequisites

Ensure you have Python 3.10 or higher installed:

python --version

2. Clone the Repository

git clone https://github.com/memrranmian/applied-python-systems-suite.git
cd applied-python-systems-suite

3. Install Dependencies

The suite uses standard library modules for Questions 1, 2, 3, and 5. Question 4 requires Pillow:

pip install Pillow

4. Running the Systems

Each question is an independent, self-contained system. Execute each using the standard Python interpreter:

# Run Question 1: Student Result & Exception Management
python Question_1.py

# Run Question 2: Business Utilities & Modular Analytics
python Question_2.py

# Run Question 3: Library Package & File Stream Management
python Question_3.py

# Run Question 4: Batch Image Processing & Transformations
python Question_4.py

# Run Question 5: Multithreaded Employee Attendance & Payroll
python Question_5.py

To run all test suites in sequence:

python Question_1.py; python Question_2.py; python Question_3.py; python Question_4.py; python Question_5.py

πŸ§ͺ Verification & Output Reports

All systems run deterministically and generate persistent artifacts in their respective directories:


πŸ“„ License

This repository is licensed under the MIT License.

Releases

Packages

Contributors

Languages