Skip to content

Instantly share code, notes, and snippets.

View duonghuuphuc's full-sized avatar

Duong Huu Phuc duonghuuphuc

View GitHub Profile
@duonghuuphuc
duonghuuphuc / cs504070-homework-10.md
Created May 18, 2025 06:04
CS504070 - Homework 10: Delivery Function in E-commerce System using FastAPI

CS504070 - Homework 10: Delivery Function in E-commerce System using FastAPI

Introduction

You are tasked with implementing the Delivery Service for an e-commerce platform. This service is responsible for handling all aspects related to shipping customer orders, such as scheduling, updating, tracking, and managing delivery status.

This service will be a standalone microservice communicating with other services (like Order, User, and Inventory) via HTTP APIs or message queues (mocked/stubbed in this exercise). You will use FastAPI for building the microservice and JWT to secure endpoints that require user authentication.


@duonghuuphuc
duonghuuphuc / cs502052-casestudy-21.md
Created April 9, 2025 07:56
Case Study: Leveraging AI Agents in Supply Chain Management Amidst a Trade War

Case Study: Leveraging AI Agents in Supply Chain Management Amidst a Trade War

Background: Global Electronics Inc. (GEI), a multinational electronics manufacturer, sources critical components globally, heavily dependent on manufacturers located in Country A. Recently, Country B, GEI's home base, imposed a punitive tariff of 104% on electronic components imported from Country A amid escalating trade tensions.

Faced with immediate financial strain, significant disruption, and operational uncertainty, GEI adopted an advanced AI Agent (LLM-based Agent) to dynamically manage its supply chain.

AI Agent Implementation: The AI Agent is tasked with continuous monitoring of global market conditions, supplier capabilities, logistics routes, tariff updates, and geopolitical risks. Leveraging large language model capabilities, the AI provides:

  • Real-time tariff and trade regulation updates.
@duonghuuphuc
duonghuuphuc / cs502052-casestudy-20.md
Created April 5, 2025 07:01
Case Study: AI Trends in Enterprise Systems Across Diverse Domains

Case Study: AI Trends in Enterprise Systems Across Diverse Domains

Overview

Artificial Intelligence (AI) is increasingly becoming an integral part of enterprise systems, reshaping operational strategies, customer engagement, and decision-making processes across multiple sectors. This case study explores prevalent AI trends in enterprises and their impacts in diverse application domains, including finance, healthcare, retail, manufacturing, and customer service.

AI Trends and Applications

1. Finance

In finance, AI is revolutionizing risk management, fraud detection, and algorithmic trading. Financial institutions leverage AI-driven predictive analytics to identify potential market risks and investment opportunities, enhancing portfolio management accuracy. For instance, JPMorgan employs AI to optimize trading strategies, manage risks, and streamline compliance processes.

@duonghuuphuc
duonghuuphuc / cs504070-homework-9.md
Created March 27, 2025 07:37
CS504070 - Homework 9: Advanced Models

CS504070 - Homework 9


Exercise 1: UUID and Datetime Fields

Create a FastAPI endpoint that receives and returns data containing both UUID and datetime fields.

Requirements:

  • Create a Pydantic model Event containing the following fields:
  • id: UUID (auto-generated if not provided).
@duonghuuphuc
duonghuuphuc / cs504070-homework-8.md
Created March 14, 2025 07:32
CS504070 - Homework 8: Request Body - List Fields and Nested Models

CS504070 - Homework 8


Exercise 1: Basic Request Body with List Field

Task:

  1. Create a FastAPI application.
  2. Define a Pydantic model called Item with two fields: name (string) and price (float).
  3. Define another model Cart, which includes a list of Item instances.
@duonghuuphuc
duonghuuphuc / cs504070-homework-7.md
Created March 6, 2025 14:44
CS504070 - Homework 7: Multiple Parameter Types with Validation

CS504070 - Homework 7


Exercise 1: API with Multiple Parameter Types

Task

  1. Create a FastAPI application with an endpoint /items/{item_id} that:
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-14.md
Created March 2, 2025 13:08
Case Study: Microservice Architecture in a University Application

Case Study: Microservice Architecture in a University Application

Introduction

Modern universities require robust digital applications to manage student information, course enrollments, grading, and administration. A monolithic system often struggles with scalability, flexibility, and maintenance. To address these issues, a university implements a Microservice Architecture (MSA) for its academic portal. However, careful attention must be paid to different types of coupling that can impact the system's efficiency. This case study explores four types of coupling in the context of a university application: Domain Coupling, Pass-through Coupling, Common Coupling, and Content Coupling.


System Overview

The university application consists of the following microservices:

  1. Student Service – Manages student records, including personal information and academic history.
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-13.md
Created March 2, 2025 12:51
Case Study: Determining Microservice Boundaries in a Hospital Management System

Case Study: Determining Microservice Boundaries in a Hospital Management System

Background

CityCare Hospital operates with a legacy monolithic Hospital Management System (HMS) that handles various healthcare operations. The hospital administration has decided to migrate to a microservices architecture to improve scalability, maintainability, and performance. Your task is to analyze the monolithic system and propose a microservices-based architecture by identifying service boundaries.

Existing Monolithic System

The HMS is a single large application that includes the following functionalities:

  1. Patient Management: Registers patients, updates their information, and maintains medical history.
  2. Appointment Scheduling: Manages doctor appointments, availability, and patient scheduling.
  3. Doctor and Staff Management: Stores doctor and staff information, including credentials, schedules, and payroll.
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-12.md
Created February 16, 2025 05:00
Case Study: Implementing Domain-Driven Design (DDD) in Microservices – The Transformation of FinBank

Case Study: Implementing Domain-Driven Design (DDD) in Microservices – The Transformation of FinBank

Background

FinBank is a mid-sized financial institution that provides banking services such as account management, loan processing, credit card services, and fraud detection. Initially, the system was developed using a monolithic architecture, where all features were integrated into a single codebase.

Challenges in the Monolithic System

As the customer base grew, the monolithic system faced several challenges:

  1. Complex Codebase – Banking logic was scattered across different modules, making updates risky.
  2. Scalability Issues – High traffic on one feature (e.g., loan processing) impacted the entire system.
  3. Deployment Bottlenecks – A small bug fix in the credit card module required redeploying the entire application.
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-11.md
Last active March 2, 2025 13:10
Case Study: Ensuring Loose Coupling and High Cohesion in Microservices - The Journey of FoodExpress

Case Study: Ensuring Loose Coupling and High Cohesion in Microservices - The Journey of FoodExpress

Background

FoodExpress is an online food delivery platform that connects customers with restaurants. Initially, it was developed using a monolithic architecture, where all functionalities—such as user authentication, restaurant management, order processing, payments, delivery tracking, and customer reviews—were combined in a single application.

As FoodExpress expanded to new cities, it faced serious challenges:

  1. Scaling Issues - A surge in orders during peak meal times slowed down the entire application.
  2. Deployment Bottlenecks - A minor change in the restaurant menu system required redeploying the entire application.
  3. Team Dependencies - Different teams working on unrelated functionalities had to coordinate their code changes.
  4. Performance Degradation - Certain features (like reviews and recommendations) were overwhelming the database, impacting critical services like