Published:Jun 25, 2025
Category:MySQL Database Engineering
Status:Completed
Next.jsFastAPIPythonMySQL
Federal Forensic Case Management Suit - Portfolio Project

Full-Stack Software Engineering ยท Database Design

Federal Forensic Case Management Suit

Federal Forensic Case Management Suit is an enterprise-grade case dossier and physical evidence tracking platform. Engineered with advanced MySQL Views, Transactions, Stored Procedures, and Automated Triggers to preserve data integrity and maintain a legally auditable Chain of Custody.

Core Systems
๐Ÿ”’ ACID Transactions โšก Database Triggers ๐Ÿ‘๏ธ Relational Views ๐Ÿ–จ๏ธ Court Printable Dossier

Federal Forensic Case Management Suit Dashboard Overview

Federal Forensic Case Management Suit Dashboard โ€“ live metrics, recent activity feed, and security logs


Problem & Solution

Understanding the core value proposition of Federal Forensic Case Management Suit.

โŒ The Problem

  • โ€ข Manual spreadsheets for physical evidence logs lead to broken Chain of Custody errors in court.
  • โ€ข Relational database constraints and log consistency are often neglected at the database server level.
  • โ€ข Deleting user accounts or cases can orphan records, ruining forensic accountability audit trails.

โœ… The Solution

  • โ€ข Database transactions bundle handover logs and evidence statuses atomically to guarantee consistency.
  • โ€ข Custom SQL Views offload complex multi-table queries and count aggregations to the MySQL engine.
  • โ€ข Database triggers automatically log user actions, maintaining an immutable security audit history.

My Role โ€” Full-Stack Developer & Database Architect

As the sole developer, I designed the database schemas, built the Python FastAPI controllers, wrote custom SQL stored procedures, views, and database triggers, and created the responsive frontend layout using Next.js.

Key Responsibilities

โœ… Next.js Frontend Integration & Reactivity โœ… Python FastAPI Controller Engineering โœ… MySQL Relational View Aggregations โœ… MySQL Transaction Stored Procedures โœ… Database-level Audit Trigger Programming โœ… CSS Print Stylesheet Dossier Formatting

๐Ÿ“Š Database & Project Metrics

Project Duration 3 Weeks
Lines of Code Approx. 7,500
MySQL Tables 10 Tables
REST API Routes 14 Routes
Stored Procs & Triggers 1 Proc, 2 Triggers, 1 View

Application Interface Showcase

Explore the core features of the Forensic Federal Case Management Suit.

๐Ÿ“‹ Case Dossier Printable Briefing

Case Dossier Briefing Layout

Printed Case briefing - optimized format for legal case portfolios

Enables officers to export case details into a printable file. The stylesheet strips out interactive buttons, background panels, and search bars, creating a clean document with case metadata, crime scenes, evidence registries, and suspect lists.

  • โœ… Strips out interactive components automatically
  • โœ… Structured tables for evidence grids and personnel listings
  • โœ… Formatted case history logs

๐Ÿ›ก๏ธ Global Evidence Vault & Timeline

Global Evidence Locker Workspace

Chain of custody logs - interactive handover timeline and tracking

A centralized list of all physical evidence items logged in the system. Selecting an item loads its complete Chain of Custody handoff log history, tracking officers, coordinates, dates, and transfer remarks.

  • โœ… Live Chain of Custody vertical timelines
  • โœ… One-click locker seal status toggling
  • โœ… Transaction-backed custody handover forms

๐Ÿ‘ฅ User Accounts Administration Panel

User Management Console

User Management โ€“ search, register credentials, and delete profiles

Allows administrators to manage profiles, assign roles, and allocate departments. New profiles receive hashed passwords and auto-generated employee IDs, while deleted accounts safely update referencing tables.

  • โœ… Search and filter profiles by name or employee ID
  • โœ… Add User modal with secure credentials creation
  • โœ… Safety checks to prevent self-deletion

MySQL Database Integrations

Reviewing the custom views, stored procedures, and triggers implemented directly in MySQL.

๐Ÿ”’ Stored Procedure with ACID Transaction

Bundles evidence custody handoffs into an atomic database operation, rolling back updates if either logging or status changes fail.

CREATE PROCEDURE sp_transfer_custody(
  IN p_evidence_id INT, IN p_from_user INT, IN p_to_user INT,
  IN p_purpose VARCHAR(255), IN p_location VARCHAR(255),
  IN p_remarks TEXT, IN p_status VARCHAR(50), OUT p_success BOOLEAN
)
BEGIN
  DECLARE EXIT HANDLER FOR SQLEXCEPTION
  BEGIN
    ROLLBACK;
    SET p_success = FALSE;
  END;

  START TRANSACTION;
    INSERT INTO evidence_custody (evidence_id, from_user, to_user, transfer_date, purpose, location, remarks)
    VALUES (p_evidence_id, p_from_user, p_to_user, NOW(), p_purpose, p_location, p_remarks);

    UPDATE evidence SET current_status = p_status, storage_location = p_location
    WHERE evidence_id = p_evidence_id;
  COMMIT;
  SET p_success = TRUE;
END;

โšก Automatic Audit Triggers

Triggers automatically write state changes on cases and evidence tables to the `audit_logs` table, maintaining an independent audit history.

CREATE TRIGGER trg_evidence_update
AFTER UPDATE ON evidence FOR EACH ROW
BEGIN
  IF OLD.current_status <> NEW.current_status OR OLD.storage_location <> NEW.storage_location THEN
    INSERT INTO audit_logs (user_id, action, table_name, record_id, timestamp, ip_address)
    VALUES (NEW.collected_by, CONCAT('EVIDENCE_STATUS: status=', NEW.current_status), 'evidence', NEW.evidence_id, NOW(), '127.0.0.1');
  END IF;
END;

๐Ÿ‘๏ธ Aggregated SQL Reporting Views

Calculates total counts for cases, scenes, investigators, and evidence on the database side to optimize query performance.

CREATE OR REPLACE VIEW v_case_summaries AS
SELECT 
  c.case_id, c.case_number, c.title, c.crime_type, c.priority, c.status,
  CONCAT(u.first_name, ' ', u.last_name) AS lead_investigator_name,
  (SELECT COUNT(*) FROM evidence e WHERE e.case_id = c.case_id) AS evidence_count,
  (SELECT COUNT(*) FROM suspects s WHERE s.case_id = c.case_id) AS suspect_count
FROM cases c
LEFT JOIN users u ON c.lead_investigator = u.user_id;

Architecture & Directory Structures

Platform component structures, directory mapping, and local setups.

๐Ÿ“ VS Code Workspace Explorer

Explorer: Forensic Workspace
๐Ÿ“ backend/
๐Ÿ“ app/
๐Ÿ“„ main.py (FastAPI Controllers)
๐Ÿ“„ db.py (DB Setup & Procs)
๐Ÿ“„ requirements.txt
๐Ÿ“ database/
๐Ÿ“„ schema.sql
๐Ÿ“„ seed.sql
๐Ÿ“ src/
๐Ÿ“ app/
๐Ÿ“„ page.tsx (Routing View)
๐Ÿ“ components/
๐Ÿ“„ EvidenceView.tsx (Timeline Catalog)
๐Ÿ“„ UsersView.tsx (Credentials Panel)

โ˜๏ธ Runtime Architecture Stack

Frontend HostNext.js dev server (Port 3000)
Backend EnginePython FastAPI / Uvicorn (Port 8000)
Database ServerMySQL Server (Port 3306)
Hashing Cipherbcrypt (Python / JS)

โฑ๏ธ Development Timeline

Planning โ†’ Vite to Next Migration โ†’ API Controllers โ†’ MySQL Advanced Layer โ†’ Cleanup & Commits

Challenges & Solutions

Engineering solutions implemented to address system limitations and integration challenges.

MySQL Semicolon Procedural Parsing

Python splits schema files using semicolon separators, breaking stored procedures and triggers. I bypassed this by executing advanced features as unified raw SQL blocks directly during bootstrap.

Session Reactivity & Page Refreshes

Browser refreshes reset tab selections. I solved this by synchronizing tab states with URL parameters (`?tab=...&caseId=...`), preserving coordinates across browser reloads.

Cascade Integrity Safeguards

Prevented orphaned records when deleting user profiles. Configured `ON DELETE SET NULL` for user-creator attributes while protecting the active session user profile from self-deletion.


What I Learned

  • โ€ข Designing transactional stored procedures in MySQL.
  • โ€ข Coding automated triggers for table updates.
  • โ€ข Constructing views to offload join queries.
  • โ€ข Synchronizing Next.js client states with URL parameters.
  • โ€ข Managing uvicorn connection pools in Python.
  • โ€ข Structuring print-ready CSS dossiers.

Future Improvements

  • โ€ข Barcode Scanner API: Integrating mobile camera APIs to support barcode scanning.
  • โ€ข Digital Signatures: Adding signature pad components to sign custody logs.
  • โ€ข Audit Log Visualizer: Adding charts to display audit logs.

Measurable Project Impact

Key outcomes from the Federal Forensic Case Management Suit project.

โœ“ Legally Consistent Auditing

Enforces a clean transaction timeline for all evidence handovers, eliminating inconsistent database updates.

โœ“ Optimized Relational Queries

Utilizes database-level views to aggregate statistics, reducing case overview query loading times.

โœ“ Independent Security Logs

Records case and evidence state modifications automatically using triggers, ensuring auditing is independent of application routes.

Case Study Key Takeaways

  • โœ… Engineered relational case timelines and evidence directories
  • โœ… Programmed MySQL transactions and stored procedures
  • โœ… Structured automated triggers and auditing logs
  • โœ… Migrated components to Next.js with state parameter synchronization
  • โœ… Designed print-ready CSS briefing dossier layouts

Lighthouse Metrics

100 Performance
100 Accessibility
100 Best Practices
100 SEO