Kevin Crandall

Software Developer • Enterprise Applications • AI Solutions

CS 499 Capstone Enhancement

Algorithms and Data Structures

Completed

This enhancement revisits the Travlr Getaways full-stack travel management application originally developed in CS 465: Full Stack Development I. The application includes a customer-facing Express and Handlebars website, an Angular administrative single-page application, a RESTful Express API, and a MongoDB database.

The original application retrieved complete collections of trip records before allowing the client applications to search, sort, or organize the information. While this approach worked with a limited dataset, it created unnecessary data transfers and required each interface to perform additional processing.

This enhancement redesigned the data-retrieval process by moving searching, filtering, sorting, and pagination to the server. The REST API now processes query parameters and returns only the subset of trip records requested by the user, improving scalability, consistency, and overall application performance.

Enhancement Objectives

Improve Data Retrieval

Replace full-collection retrieval with server-side query processing that returns only records matching the user's requested criteria.

Reduce Data Transfer

Limit unnecessary network traffic by introducing pagination and restricting the number of trip records returned during each API request.

Support Flexible Queries

Allow users to search, filter, and sort travel packages using REST API query parameters and multiple trip attributes.

Maintain Interface Consistency

Centralize query logic within the REST API so the Angular administrative application and customer-facing website provide consistent results.

Major Improvements

Server-Side Search

  • Added REST API query parameter support
  • Searches across multiple trip attributes
  • Processes search requests on the server
  • Returns only matching trip records
  • Reduces duplicated client-side logic

Price and Duration Filtering

  • Added minimum-price filtering
  • Added maximum-price filtering
  • Added trip-duration filtering
  • Supports combined filtering criteria
  • Builds MongoDB queries dynamically

Flexible Sorting

  • Sorting by trip name
  • Sorting by resort
  • Sorting by price
  • Sorting by duration
  • Support for ascending and descending order

Pagination

  • Introduced page-based data retrieval
  • Added configurable page-size handling
  • Reduced records returned per request
  • Improved scalability for larger datasets
  • Reduced unnecessary client processing

Legacy Data Handling

  • Identified text-based price values
  • Identified text-based duration values
  • Added MongoDB aggregation conversions
  • Enabled accurate numeric sorting
  • Preserved compatibility with the existing schema

Validation and Reliability

  • Validated incoming query parameters
  • Restricted supported sort fields
  • Handled invalid pagination values
  • Preserved authenticated API interactions
  • Maintained consistent API behavior

Angular Administrative Interface

  • Added trip search controls
  • Added filtering options
  • Added selectable sorting
  • Added pagination controls
  • Connected controls to server-side query processing

Customer-Facing Website

  • Integrated the enhanced REST API
  • Added consistent search behavior
  • Added filtering and sorting support
  • Added paginated trip results
  • Shared centralized business logic with the SPA

Algorithmic Process

1. Receive and Validate the Request

The REST API receives search, filtering, sorting, and pagination values through query parameters. The application validates these values before using them to construct the database request.

2. Build the Query

A query object is created dynamically based on the supplied criteria. Only filters included in the request are added, allowing users to combine search terms, price ranges, and duration requirements.

3. Process Numeric Values

When price or duration sorting is requested, MongoDB aggregation operations convert legacy text values into numeric values so the records can be ordered accurately.

4. Sort and Paginate the Results

Matching records are sorted using the selected field and direction. Pagination calculations determine which records should be skipped and how many should be returned.

5. Return the Requested Subset

The API returns only the matching page of records rather than the entire trip collection. Both application interfaces then display the same consistently processed results.

Technical Skills Demonstrated

Algorithm Design Data Processing Server-Side Search Dynamic Filtering Sorting Pagination REST API Queries MongoDB Aggregation Query Validation Performance Optimization Angular Express.js Scalable Architecture Technical Documentation

Course Outcomes Demonstrated

Algorithmic Design and Evaluation

Designed and evaluated a server-side data-retrieval solution that applies searching, filtering, sorting, aggregation, and pagination while considering efficiency, scalability, and design trade-offs.

Innovative Computing Practices

Used REST API query processing and MongoDB aggregation techniques to improve application performance and deliver useful functionality across multiple user interfaces.

Software Engineering

Centralized business logic within the REST API, reduced duplication across the Angular and Express interfaces, and maintained compatibility with the existing application architecture.

Professional Communication

Documented the enhanced query functionality, implementation decisions, technical trade-offs, and application behavior through the repository README and capstone narrative.

Security Mindset

Validated query parameters, restricted accepted sorting and pagination values, and preserved secure interactions with the application's existing authenticated API.

Design Trade-Offs

A significant challenge involved the representation of price and duration values in the original database. These values were stored as text, which prevented standard numeric sorting from producing accurate results. Permanently changing the data types would have required a database migration and broader schema redesign.

Because the database redesign belongs to the next enhancement, I implemented MongoDB aggregation-based conversions as an interim solution. This allowed the application to perform accurate numeric sorting while preserving compatibility with the existing records and interfaces.

This decision balanced immediate performance and functionality requirements against the long-term goal of improving the underlying database schema. It also prevented unnecessary scope expansion during the Algorithms and Data Structures enhancement.

Reflection

This enhancement reinforced that algorithmic thinking in modern software engineering extends beyond implementing traditional textbook algorithms. In a full-stack application, it also involves designing efficient methods for retrieving, filtering, organizing, and transferring data.

Moving search, filtering, sorting, and pagination from the clients to the server improved scalability and reduced duplicated logic. It also created a more consistent experience because both the Angular administrative application and the customer-facing website now rely on the same centralized query-processing logic.

The enhancement also demonstrated how strongly data representation affects algorithmic efficiency. Discovering that prices and durations were stored as text required evaluating several possible solutions and selecting one that addressed the immediate need without disrupting the existing architecture.

Overall, this work strengthened my understanding of scalable data processing, API design, algorithmic trade-offs, and the importance of aligning technical decisions with the current phase of the software development lifecycle.

Project Repositories

The original repository contains the Travlr Getaways application as developed during CS 465. The Algorithms and Data Structures branch contains the completed server-side searching, filtering, sorting, pagination, validation, interface, and data-processing enhancements.