Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
410fcc0
Create model
delmarne Jul 10, 2024
d9bd2c7
variables added
delmarne Jul 10, 2024
f2d8f2b
more edits
delmarne Jul 10, 2024
61829e2
Create README.md
delmarne Jul 10, 2024
610622d
edits data
delmarne Jul 23, 2024
400ea2d
Merge remote-tracking branch 'origin/main'
delmarne Jul 23, 2024
16a393f
changed from bools
delmarne Jul 29, 2024
7d399ee
Added FastAPIDraft.py file
delmarne Jul 29, 2024
aea7e5a
new model edit
delmarne Jul 31, 2024
6e77d2f
loaded pickle into api draft
delmarne Aug 3, 2024
ce59447
broke down api functions
delmarne Aug 6, 2024
89f77c8
wrapped code in main function in model
delmarne Aug 6, 2024
e102b16
wrote skeleton for backend functions
delmarne Aug 14, 2024
1c8bc0c
removed extranous files
delmarne Aug 16, 2024
d30f1dd
created new API file, created a logic file, added to readme
delmarne Aug 18, 2024
ee9c8b9
created test file, finished business logic
delmarne Aug 22, 2024
1868513
working model with print statements
delmarne Aug 26, 2024
da0f893
removed extraneous commentary
delmarne Aug 27, 2024
47fa2f5
ran tests with mark, added dict for income, did ui test
delmarne Aug 27, 2024
1890d47
made folders, moved files
delmarne Aug 27, 2024
1948421
Add FastAPI
bonicim Aug 28, 2024
147e579
Reorganize based on module-functionality structure
bonicim Aug 28, 2024
d30cfd8
Minor fixes
bonicim Aug 28, 2024
5f4125a
Fix convert-text function; cleanup
bonicim Aug 29, 2024
795cbf7
Update requirements.txt
bonicim Aug 29, 2024
7de0613
Merge pull request #3 from CaseManagementAI/minor-fixes
delmarne Aug 29, 2024
ef2a2e9
Remove abbreviations
bonicim Sep 4, 2024
b2cf465
SPRINT1.md Upload
yanghansin Oct 21, 2024
ea5b052
SPRINT1.md Upload
yanghansin Oct 21, 2024
44e5c39
Add ConnectionManager.py
zoe-lry Nov 6, 2024
235add1
resolve merge conflict
yanghansin Nov 7, 2024
410245c
SPRINT2.md Uploaded, Read this to grade our SPRINT2
yanghansin Nov 7, 2024
11f4b3a
implement API
danielluo77777 Nov 7, 2024
600fcc5
Merge branch 'main' of https://github.com/yanghansin/CS5500CommonAsse…
danielluo77777 Nov 7, 2024
4c6e3ae
Adding Spring3
zoe-lry Nov 15, 2024
92ce6b7
Runnable version here
zoe-lry Nov 18, 2024
c0178b2
Update project summary
rachel0771 Nov 19, 2024
5670c05
Create User Guide.md
rachel0771 Nov 19, 2024
b5bd4bd
All Api endpoints implemented, new schema created for update clients …
yanghansin Nov 20, 2024
30fc987
Merge remote-tracking branch 'origin/main'
yanghansin Nov 20, 2024
029bfe7
SPRINT3.md updated
yanghansin Nov 20, 2024
5bb29c7
lab10: pipline, actions
yanghansin Nov 20, 2024
638b2be
lab10: pipline, actions, rename file
yanghansin Nov 20, 2024
b179984
lab10: hello world print test
yanghansin Nov 20, 2024
e3a188e
lab10: hello world print test
yanghansin Nov 20, 2024
db22900
lab10: hello world print test
yanghansin Nov 20, 2024
2dc22d2
lab10: hello world print test
yanghansin Nov 20, 2024
f6bf896
lab10: pull request pipline test
yanghansin Nov 20, 2024
4adf8cd
lab10: pull request pipline test
yanghansin Nov 20, 2024
9a69e83
lab10: pull request pipline test
yanghansin Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/learn-github-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: cs5500PIPLINE

defaults:
run:
shell: bash


on:
push:
branches:
- main

pull_request:
branches:
- main
jobs:
run-tests:
runs-on: macos-latest
steps:
- run: echo "🎉 Hello World!"
- run: echo "🐧"
- run: echo "🔎"

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.idea
__pycache__
.DS_Store
.env
env/
63 changes: 63 additions & 0 deletions SPRINT1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Project: Case Management API Development SPRINT1
## OCT. 9th - OCT. 23rd
## Contributors
- Han Yang, Hao Luo, Ruiyi Li, Ruimeng
## Overview
This project aims to create a RESTful API to manage and analyze client data in a case management service. The backend is developed using **FastAPI** and connected to a cloud-based **MySQL** database hosted on **AWS RDS**. The system facilitates CRUD operations and predictive analytics to assist in making informed decisions for clients’ employment outcomes.

## Team Collaboration

### 1. Database Service Selection
As a team, we discussed and evaluated several options for hosting the database. After considering various factors like scalability, security, and ease of use, we decided to use **Amazon RDS (AWS Relational Database Service)** for hosting our **MySQL** database. This choice was driven by the need for an online, centralized database solution that would allow all team members to connect remotely and collaborate effectively.

### 2. REST API Knowledge Sharing
To ensure that all team members were on the same page, we conducted a series of discussions and knowledge-sharing sessions about REST API concepts. This was crucial in helping everyone understand the following:
- How to structure API endpoints for CRUD operations.
- Best practices for data validation using **Pydantic** models.
- Implementation of asynchronous processing with **FastAPI**.

These sessions enabled team members to independently develop API functions, ensuring consistency in design and implementation across the project.

### 3. Development Plan
To manage the project effectively, we outlined a comprehensive development plan that included the following stages:

#### Phase 1: Setup & Initialization
- Create a virtual environment and install dependencies from `requirements.txt`.
- Initialize the FastAPI project structure and set up the database schema using **MySQL Workbench**.

#### Phase 2: Database Configuration
- Register for AWS services and create an RDS instance with MySQL.
- Set up security groups and VPC configuration to allow external access to the database.
- Establish the connection between FastAPI and the AWS-hosted MySQL database.

#### Phase 3: API Development
- Develop core API endpoints for CRUD operations on client data:
- **POST /clients/predictions**: Accepts client data and returns prediction results.
- **GET /clients/{id}**: Retrieves client information by ID.
- **PUT /clients/{id}**: Updates client information by ID.
- **DELETE /clients/{id}**: Deletes client data by ID.
- Implement data validation using Pydantic models.
- Write unit tests for each endpoint to ensure functionality and reliability.

#### Phase 4: Testing & Documentation
- Conduct end-to-end testing using **Postman** and manual verification of database changes.
- Document API endpoints using FastAPI’s interactive Swagger documentation.
- Create user guides and detailed instructions for API usage, including connection setup and deployment.

#### Phase 5: Final Review & Deployment
- Perform final testing to ensure all components work together seamlessly.
- Deploy the API on a cloud server, ensuring continuous integration and delivery.

### 4. AWS Registration & Database Connection
We successfully registered for AWS, created an RDS instance, and configured it for public access. This involved:
- Setting up inbound rules in the security group to allow access to port **3306** from our IP addresses.
- Modifying VPC settings to enable public accessibility.
- Establishing the connection between MySQL Workbench and the RDS instance, allowing us to manage the database and import CSV data.

With the database setup complete, the backend is now fully functional, providing efficient API access to case management data.

## Future Work
- Enhance predictive analytics by integrating additional ML models.
- Implement OAuth2 for user authentication.
- Add logging and monitoring for improved error handling and performance tracking.

66 changes: 66 additions & 0 deletions SPRINT2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPRINT 2: Project Progress Summary

## Overview
Following the completion of SPRINT 1, we focused on enhancing the core functionality of our Case Management API project. This involved connecting team members to the centralized database, building a robust connection manager, adjusting the database schema, and developing comprehensive REST API endpoints.

## Accomplishments

### 1. Establishing Database Connectivity for All Team Members
- Successfully configured and connected all team members to the **AWS RDS MySQL database**.
- Ensured that each member could access the database through **PyCharm** and other SQL clients by setting up appropriate security group rules and connection details.

### 2. Developing a Connection Manager
- Implemented a `ConnectionManager` class to streamline database connections for the project:
```python
import mysql.connector
import os
from mysql.connector import pooling
from dotenv import load_dotenv

class ConnectionManager:
def __init__(self):
self.db_config = {
"host": os.getenv("DB_HOST"),
"port": int(os.getenv("DB_PORT")),
"user": os.getenv("DB_USER"),
"password": os.getenv("DB_PASSWORD"),
"database": os.getenv("DB_NAME")
}

# Create a connection pool
self.pool = pooling.MySQLConnectionPool(
pool_name="mypool",
pool_size=5,
**self.db_config
)

# Get a connection
def get_connection(self):
return self.pool.get_connection()

# Close the connection
def close_connection(self, connection):
if connection.is_connected():
connection.close()

This manager ensures efficient connection handling using a pool to maintain stability and optimize performance.
### 3. Adjusting the Database Schema
- Updated the clients table schema to match the PredictionInput model. This involved creating a schema that accurately reflects the data structure needed for client information.
- Sample schema adjustment included:
- Modifying column data types to align with the PredictionInput requirements.
- Adding or updating fields to store client-specific data effectively.
### 4. Developing REST API Endpoints
- Implemented the core REST API functionalities for client data management:
- GET endpoint to retrieve client information.
- POST endpoint to add new client data.
- DELETE endpoint to remove client data.
- PUT endpoint to update existing client information.

## Next Steps
Moving forward, we will:

- Perform thorough testing and validation of the new REST API endpoints.
- Implement security measures, such as user authentication and data encryption.
- Integrate advanced data processing or analytics features to enhance API capabilities.
## Conclusion
SPRINT 2 has solidified the core infrastructure of our project by ensuring database connectivity for all team members, creating a connection manager for efficient data handling, adjusting the database schema for proper client data storage, and developing essential REST API functionalities. This progress lays a strong foundation for further development and upcoming sprints.
78 changes: 78 additions & 0 deletions SPRINT3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPRINT 3: Project Progress Summary

## Overview
In Sprint 3, we focused on testing, enhancing, and documenting the core functionality of our database service project for frontend engineers. The sprint objectives included ensuring seamless database connectivity, improving user experience by handling edge cases, adding robust tests, and creating a user guide tailored to our target audience.

## Accomplishments

### 1. Testing Database Connectivity
We validated the connection between the application and the MySQL database to ensure reliability:
- Confirmed that the application could create, update, retrieve, and delete data from the database without errors.
- Addressed initial connection challenges by refining configurations for the connection pool.
### 2. All CRUD API EndPoints Implemented
We implemented all api endpoints:
- GET: clients/ --> get all clients
- GET: clients/{id} --> get client by id
- POST: clients/ --> Insert a new client with proper body
- UPDATE: clients/{id} --> Update Client information with partial body
- DELETE: clients/{id} --> Delete Record by id from the database
### 3. Adjusting Database Design
We restructured the database to improve efficiency and support future scalability:
- Adjusted database field types to better align with data requirements, optimizing storage and query performance.
- Defined a new **primary tree** structure to enhance data organization and retrieval. This adjustment allows for a more logical and hierarchical representation of related entities in the database.
- Updated documentation to reflect the new database design, ensuring compatibility with frontend engineers’ needs.

### 4. Running the Project for Database Operations
Documented the steps to set up the project and interact with the database, ensuring smooth onboarding for developers:
- Verified that all endpoints worked correctly for editing and retrieving database content.
- Ensured developers could replicate the process in their local environments.

**Example of Running the Project:**

# Set up virtual environment and install dependencies
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

# Start the server
uvicorn app.main:app --reload

### 4. Adding Edge Cases
We expanded functionality to handle uncommon user scenarios and improve overall robustness:
- Implemented input validation to manage invalid or missing data.
- Enhanced error handling with detailed, user-friendly error messages.
- In Sprint 3, we made our database service more reliable and easier to use. The API now handles problems like missing or incomplete client data by showing clear error messages instead of crashing. For example, if the age field is missing in a request, the API will respond with a message explaining the issue. We also tested all the endpoints thoroughly to make sure they work well. Additionally, we created a user guide to help frontend engineers set up and use the service easily. These improvements prepare us well for the next steps in the project.

### 5. Writing and Running Tests
We developed and executed tests to ensure the reliability of the database operations:
Created unit and integration tests for the following API endpoints:
- POST to add new client data.
- GET to retrieve client information by ID.
- PUT to update existing client records.
- DELETE to remove client records.
Verified edge case handling through additional test cases.
Ensured the tests passed successfully, confirming system stability.
**Example Test Structure:**
def test_get_client():
response = client.get("/clients/1")
assert response.status_code == 200
assert response.json()["id"] == 1

### 6. Writing a User Guide
We created a user guide tailored to frontend engineers, outlining:
- Steps to set up the project environment.
- Instructions for using the API endpoints.
- Guidance on handling common errors and testing the endpoints.
- Ensured the guide is clear and easy to follow for our target market.

## Next Steps
- Increase Test Coverage
Add more test cases for the same endpoint to validate handling of different scenarios, ensuring robustness and consistency.
- Update Edge Case Handling
Implement logic to handle consecutive identical POST requests gracefully, avoiding redundant entries or unexpected errors.
Add functionality to provide a clear and informative response when a user attempts to delete a non-existent account.
- Refactor and Optimize Code Structure
Adjust the project environment by transferring part of the codebase into router.py to improve modularity and maintainability.

## Conclusion
Sprint 3 has strengthened the foundation of our project by ensuring database connectivity, addressing edge cases, adding comprehensive tests, and documenting the process for frontend engineers. This progress positions us well for further enhancements in upcoming sprints.
Loading