How mlops-talksick/supplychainoptimization works
Project Identification
• Project Type/Purpose: A supply chain optimization system built to simulate realistic demand data using synthetic data generation, process that data through a robust pipeline (including cleaning, validation, versioning, and feature engineering), and ultimately produce forecast models.
• Use Cases: Demand forecasting, anomaly detection, model monitoring and prediction, and MLOps best practices in data versioning and pipeline orchestration.
File Structure for Components
• Data Generation: The “Data_Generation” folder contains scripts (dataGenerator.py, transactionGenerator.py, dataMess.py) that simulate realistic market and transaction conditions.
• Data Pipeline: The “Data_Pipeline” directory holds the core processing code. It includes a Dockerfile, various scripts for validation, preprocessing, logging, DVC versioning, and testing modules – all likely orchestrated by Airflow (with DAGs in the “dags” folder).
• Infrastructure & Deployment: The “infrastructure” and “terraform” directories indicate cloud configuration (e.g., instance groups, load balancers) and deployment automation. This is complemented by various shell scripts in “scripts” for building and deploying Docker images and Airflow servers.
• Cloud Integration: The README and various configuration files (like .env and docker-compose.yaml) stress Google Cloud integration, including storage and GCP-specific DAGs.
• Experiment Tracking: The “mlruns” folder suggests that ML experiment tracking is built into the system.
Main Components and Their Interactions
a. Data Generation Layer:
• Components: Synthetic data generators for demand data, transaction logs, and controlled data quality issues.
• Purpose: Generate input data sets simulating commodity trends and store-customer product interactions.
• Flow: Outputs data that gets fed into the data pipeline.
b. Data Pipeline Layer:
• Components: Airflow DAGs (located in the “dags” directory), pre- and post-validation scripts, preprocessing routines, and DVC-based version control.
• Purpose: Ingest raw data (via manual upload or simulated GCP bucket), clean and validate the data, version control with DVC, and then output cleaned and feature-engineered datasets.
• Interaction: Receives data from the Data Generation module and processes it to be consumed by the ML module.
c. ML Models Layer:
• Components: Containerized ML solutions (Dockerfiles, docker-compose, experiments scripts like deepar, lstm, sarima), model prediction and monitoring scripts.
• Purpose: Train forecast models, monitor their performance, and produce predictions.
• Interaction: Consumes processed data from the Data Pipeline. It outputs trained models and predictions, with artifacts tracked in “mlruns.”
d. Infrastructure & Deployment:
• Components: Terraform scripts, additional shell scripts, and container orchestration configurations.
• Purpose: Provision cloud resources (GCP), manage service deployment (e.g., Airflow, ML services), and set up networking with load balancers and instance groups.
• Interaction: Underpins both the Data Pipeline and ML Modules by ensuring the system’s scalable, cloud-ready deployment.
e. Storage & Integration:
• Components: Local file storage, DVC-managed storage, Google Cloud Storage.
• Purpose: Store raw and processed data, version datasets, and hold model artifacts.
• Interaction: Acts as the central hub where data flows between generation, processing, and modeling.
Architectural Patterns and Design Principles
• Emphasis on modularity – each main functionality (data generation, pipeline, ML modeling) is maintained in separate directories with its own Docker configurations.
• Use of containerization for consistency (Dockerfiles and docker-compose.yaml for both the ML models and the data pipeline).
• Adoption of MLOps practices: data versioning (via DVC), experiment tracking (mlruns directory), and pipeline orchestration (Airflow DAGs).
• Infrastructure-as-Code with Terraform for reproducible cloud deployments.
• Continuous integration and testing: GitHub workflows, tests in the Data_Pipeline/tests directory, and multiple scripts for validation.
• At the top, designate the “Input Layer” representing data generation and manual or simulated data ingestion (with reference to GCP bucket uploads).
• Next, connect to the “Modeling Layer” which covers ML model training, prediction, and monitoring (including integration with the experiment tracking system).
• Finally, a surrounding “Infrastructure Layer” should encapsulate cloud services, container orchestration (Docker, Kubernetes if applicable), networking, and load balancing as set up by Terraform.
• Don’t neglect to illustrate monitoring & alerting functionalities (email alerts, logs) as part of operational feedback.