Databases

This artifact demonstrates database expertise through a secure and robust MongoDB CRUD layer that supports a data-driven dashboard.

Artifact Overview

Artifact: CS 340 Dashboard + MongoDB CRUD Module (Python)
Originally Created: CS 340 (Advanced Programming Concepts)
Category: Databases

This project uses MongoDB as the primary data store for animal shelter records. The dashboard reads documents from the database and presents them in a table, map, and chart view. The database interactions are encapsulated in a dedicated CRUD module (AnimalShelter class), which performs create, read, update, and delete operations against the animals collection. For this enhancement, I focused on improving database access design, reliability, and secure handling of sensitive data.

Why This Artifact Belongs in My ePortfolio

I chose this artifact for the databases category because it reflects a realistic database-backed application pattern used in industry: separating database access into a reusable data-access layer, validating operations, and handling database failures gracefully. Since my career interests include full-stack and backend development, demonstrating strong database skills is essential. This artifact shows how I can design database integration that is reliable, maintainable, and aligned with secure practices.

Original Limitations

The original database layer successfully connected to MongoDB and supported CRUD operations, but it exposed some limitations: (1) Credential handling could be improved to reduce the risk of hard-coded values, (2) returned MongoDB documents included internal fields such as _id, (3) error handling and diagnostics could be more robust, and (4) validation could be strengthened to reduce the chance of invalid queries or updates.

Enhancements Implemented

For the database enhancement, I improved the CRUD module by: (1) supporting environment variable overrides for credentials to reduce exposure of sensitive information, (2) adding a helper method to clean MongoDB results by removing internal fields like _id, (3) strengthening validation for inputs to CRUD methods, and (4) reinforcing error handling and logging so database issues can be detected, diagnosed, and handled consistently.

Impact of Changes

These changes improved the database layer’s security and reliability. Credential handling is more secure, results are returned in a cleaner application-friendly format, and defensive programming reduces risk from invalid inputs. The CRUD module is now better structured as a reusable database access component that can be integrated into other applications beyond this dashboard.

Course Outcomes Demonstrated

This artifact supports CS 499 outcomes by demonstrating professional database integration and security-aware design:

  • Outcome 4 (Tools & Practices): I used MongoDB and PyMongo in a structured CRUD layer, demonstrating well-founded database practices and a maintainable DAO-style design.
  • Outcome 5 (Security Mindset): I reduced credential exposure with environment variables, validated database operation inputs, and limited leakage of database internals (like _id).
  • Outcome 2 (Communication): I documented behaviors and failure modes so that database operations are easier to understand and review.

Database Design Notes

A key design decision in this enhancement was to keep database logic encapsulated in one module rather than mixing database code directly into the dashboard UI. This separation of concerns improves maintainability and supports reuse. Cleaning results to remove MongoDB internal fields helps keep the rest of the application database-agnostic. Additionally, supporting environment variables is a practical approach for safer configuration management in real deployments. These improvements demonstrate database design thinking beyond basic CRUD functionality.

Original vs Enhanced Files

The following links provide direct access to the database-related files before and after enhancements.

Key file for this category: CRUD_Python_Module.py (AnimalShelter class for MongoDB access). Supporting file: ProjectTwoDashboard.ipynb (uses the CRUD layer to load and display data).

Reflection

This enhancement strengthened my understanding of database integration as more than simply connecting and running queries. I learned that a professional database layer should validate inputs, handle failures predictably, reduce exposure of sensitive configuration, and return results in a form that supports the rest of the application. One challenge was ensuring changes to database handling did not break the dashboard’s expectations for returned data. By iteratively testing the dashboard and refining the CRUD layer, I improved both reliability and security while maintaining the application’s functionality.