How viral3899/food_delivery_time_prediction works
Main Components
• User Interface & Web Service:
• Components: “app.py”, “templates” (form.html, result.html, retrain.html), and “static” (CSS, images)
• Purpose: Provides the front-end for user interactions such as input forms, showing results, and triggering retraining.
• ML Pipeline:
• Located under the “food_delivery” directory:
▸ Pipeline orchestration: “food_delivery/pipeline/pipeline.py”
▸ Individual pipeline steps:
• Data ingestion (“data_ingestion.py”)
• Data transformation (“data_transformation.py”)
• Data validation (“data_validation.py”)
• Model training (“model_trainer.py”)
• Model evaluation (“model_evaluation.py”)
• Model deployment/pusher (“model_pusher.py”)
• Also includes “entity” modules for artifacts, configurations, and predictions (e.g., delivery_time_predictor, artifact_entity).
• Configuration & Constants:
• Centralized in “config” (with YAML files such as “config.yaml”, “model.yaml”, “schema.yaml”) and “food_delivery/config/configuration.py”.
• “food_delivery/constant” provides global constants.
• Logging & Exception Handling:
• “food_delivery/logger” and “food_delivery/exception” support robust logging and error management.
• Deployment & DevOps Infrastructure:
• Dockerization: “Dockerfile”, “docker-compose.yml”, “.dockerignore”
• CI/CD and workflows: Under “.github/workflows/main.yaml”
• AWS Deployment: README instructions mention creating IAM users, ECR repo, and deploying on EC2. Also, guidelines for self-hosted GitHub runners and GitHub secrets are provided.
• Supporting Files:
• “demo.py” for demonstration purposes.
• “notebook” containing an exploratory data analysis (EDA) notebook.
• “saved_models” directory for storing trained models.
• “setup.py”, “requirements.txt” for dependency management.
Relationships & Data Flow
• User Interaction Flow:
• Users interact via the web UI (served by app.py using templates & static files).
• Inputs from the UI trigger endpoints that invoke the ML pipeline (either for scoring/prediction or retraining).
• Pipeline Execution Flow:
• The ML pipeline orchestrator (“pipeline.py”) sequentially calls each modular component (ingestion → transformation → validation → training → evaluation → pusher).
• Data flows from one component to the next, with each step processing and passing artifacts (structured using entity classes).
• The “food_delivery/entity/delivery_time_predictor.py” indicates that predictions are computed here.
• Configuration & Logging:
• Before execution, configuration data is loaded from YAML files (or via “configuration.py”), ensuring that parameters for each stage are consistent.
• Throughout, logging and exception modules capture activity and errors.
• Model Management:
• Trained and validated models are saved in the “saved_models” directory.
• Containerization and Deployment:
• The Dockerfile and docker-compose definitions encapsulate the application.
• CI/CD via GitHub Actions builds the docker image, pushes it to an AWS ECR repository, and subsequently deploys to EC2.
• Deployment instructions include setting up the EC2 environment (installing Docker, self-hosted runners, etc.).
Architectural Patterns & Design Principles
• Separation of Concerns:
• Different layers for UI, ML processing, configuration, and deployment.
• Distinct directories for pipeline stages, making the system modular.
• Pipeline Design:
• The structure follows a sequential pipeline pattern (ETL → model training → evaluation).
• Containerization & Cloud Deployment:
• The design leverages Docker for consistency and AWS services for scalable deployment.