How timdgn/kidney_stones_classification works
Project Type and Purpose
• This is a full-stack, containerized ML web application for kidney-stone classification.
• Frontend: Streamlit UI for user input.
• Backend: FastAPI service serving prediction requests against an XGBoost model.
• CI/CD & MLOps: AWS CodePipeline → CodeBuild → ECR → CodeDeploy → ECS Fargate → Load Balancer.
File Structure
• Top-level:
• Streamlit_Frontend/ – Streamlit app, Dockerfile, requirements.
• FastAPI_Backend/ – FastAPI app, model artifact, data, EDA scripts, Dockerfile, requirements.
• docker-compose.yml & docker-compose-prod.yml – local vs. prod orchestration.
• buildspec.yml – AWS CodeBuild instructions.
• Tests: tests/test_xgb_predict.py.
• Infra as code & config present in root manifests and compose files.
Extract Architecture Insights from README
• Two Docker images (frontend & backend).
• AWS pipeline triggers on GitHub push.
• CodeBuild builds images and pushes to ECR.
• CodeDeploy deploys to ECS Fargate.
• Application Load Balancer fronts the services, with an Elastic IP.
a. Main Components
• User’s Browser / Client
• Streamlit Frontend Service
• FastAPI Backend Service
• ML Model artifact (XGBoost .pkl)
• Docker Registry (AWS ECR)
• CI/CD Pipeline (AWS CodePipeline / CodeBuild / CodeDeploy)
• Container Cluster (AWS ECS Fargate)
• Application Load Balancer & Elastic IP
• (Optional) Data store for training data (S3 bucket or local CSV)
b. Relationships & Interactions
• Client → HTTP → Streamlit Container
• Streamlit → HTTP (REST) → FastAPI Container
• FastAPI loads ML model from local volume (or S3) and serves predictions
• GitHub → CodePipeline triggers
• CodePipeline → CodeBuild builds Docker images → pushes to ECR
• CodePipeline → CodeDeploy instructs ECS to pull new images
• ALB routes external traffic to Streamlit &/or FastAPI tasks behind ECS
c. Architectural Patterns & Principles
• Micro-service separation (frontend vs backend)
• Container-based deployment with immutable images
• CI/CD pipeline implementing GitOps
• Load-balanced, auto-scaled container tasks (Fargate)
d. Key Technologies & Frameworks
• Python, FastAPI, Streamlit, XGBoost
• Docker, docker-compose
• AWS ECR, ECS Fargate, CodePipeline, CodeBuild, CodeDeploy, ALB, Elastic IP