{"id":48657034,"url":"https://github.com/gana36/flight-price-estimation","last_synced_at":"2026-04-10T09:19:03.195Z","repository":{"id":324824217,"uuid":"1098694602","full_name":"gana36/flight-price-estimation","owner":"gana36","description":"Production-ready flight price prediction using ensemble models (RF + XGBoost + LightGBM) with AWS ECS deployment","archived":false,"fork":false,"pushed_at":"2025-12-12T04:03:19.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-13T11:47:12.688Z","etag":null,"topics":["aws-ecs","docker","dvc","ensemble-learning","fastapi","grafana","mlflow","mlops","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gana36.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-18T02:54:07.000Z","updated_at":"2025-12-12T04:03:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gana36/flight-price-estimation","commit_stats":null,"previous_names":["gana36/flight-price-estimation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gana36/flight-price-estimation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gana36%2Fflight-price-estimation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gana36%2Fflight-price-estimation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gana36%2Fflight-price-estimation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gana36%2Fflight-price-estimation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gana36","download_url":"https://codeload.github.com/gana36/flight-price-estimation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gana36%2Fflight-price-estimation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31636266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ecs","docker","dvc","ensemble-learning","fastapi","grafana","mlflow","mlops","prometheus"],"created_at":"2026-04-10T09:19:01.872Z","updated_at":"2026-04-10T09:19:03.168Z","avatar_url":"https://github.com/gana36.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flight Price Prediction - MLOps Project\n\nProduction-ready MLOps pipeline for flight price prediction using ensemble models, with complete AWS cloud deployment capability.\n\n## Model Performance\n\n| Metric | Value |\n|--------|-------|\n| R² Score | **0.9838** |\n| MAE | 1,559 INR |\n| RMSE | 2,891 INR |\n| MAPE | 12.07% |\n\n## Tech Stack\n\n![Python](https://img.shields.io/badge/Python-3.11-3776AB?style=flat\u0026logo=python\u0026logoColor=white)\n![FastAPI](https://img.shields.io/badge/FastAPI-009688?style=flat\u0026logo=fastapi\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Docker-2496ED?style=flat\u0026logo=docker\u0026logoColor=white)\n![AWS](https://img.shields.io/badge/AWS-232F3E?style=flat\u0026logo=amazon-aws\u0026logoColor=white)\n![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1?style=flat\u0026logo=postgresql\u0026logoColor=white)\n![MLflow](https://img.shields.io/badge/MLflow-0194E2?style=flat\u0026logo=mlflow\u0026logoColor=white)\n![Grafana](https://img.shields.io/badge/Grafana-F46800?style=flat\u0026logo=grafana\u0026logoColor=white)\n![Prometheus](https://img.shields.io/badge/Prometheus-E6522C?style=flat\u0026logo=prometheus\u0026logoColor=white)\n![scikit-learn](https://img.shields.io/badge/scikit--learn-F7931E?style=flat\u0026logo=scikit-learn\u0026logoColor=white)\n\n- **ML**: Random Forest + XGBoost + LightGBM (Ensemble)\n- **Pipeline**: DVC for data versioning, MLflow for experiment tracking\n- **API**: FastAPI with Prometheus metrics\n- **Infrastructure**: Docker, AWS ECS Fargate, ECR\n- **Monitoring**: Grafana, Prometheus, PostgreSQL logging\n\n## Quick Start\n\n### 1. Setup Environment\n\n```bash\n# Clone and setup\ngit clone \u003cyour-repo-url\u003e\ncd FlightPricePrediction\n\n# Create virtual environment\npython -m venv venv\nvenv\\Scripts\\activate  # Windows\n# source venv/bin/activate  # Linux/Mac\n\n# Install dependencies\npip install -r requirements.txt\n\n# Configure environment\ncp .env.example .env\n```\n\n### 2. Start Local Services\n\n```bash\ncd infra\ndocker-compose up -d --build\n```\n\nThis starts:\n- **PostgreSQL**: localhost:5432\n- **MLflow**: http://localhost:5000\n- **Prometheus**: http://localhost:9090\n- **Grafana**: http://localhost:3000 (admin/admin)\n\n### 3. Train Model\n\n```bash\n# Using DVC pipeline (recommended)\ndvc repro\n\n# Or manually\npython -m src.ml.data      # Prepare data\npython -m src.ml.train     # Train model\npython -m src.ml.evaluate  # Evaluate\n```\n\n### 4. Promote to Production\n\n```bash\npython scripts/promote_model.py --version 1 --alias production\n```\n\n### 5. Test API\n\n```bash\n# Health check\ncurl http://localhost:8000/health\n\n# Make prediction\ncurl -X POST http://localhost:8000/predict \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"airline\": \"Vistara\",\n    \"flight\": \"UK-123\",\n    \"source_city\": \"Delhi\",\n    \"departure_time\": \"Morning\",\n    \"stops\": \"zero\",\n    \"arrival_time\": \"Afternoon\",\n    \"destination_city\": \"Mumbai\",\n    \"class\": \"Economy\",\n    \"duration\": 2.5,\n    \"days_left\": 15\n  }'\n```\n\n**API Documentation**: http://localhost:8000/docs\n\n## AWS Deployment\n\n### Prerequisites\n\n- AWS CLI configured (`aws configure`)\n- Docker installed\n\n### Deploy to ECS Fargate\n\n```bash\n# 1. Create AWS resources\naws ecr create-repository --repository-name flightprice-app --region us-east-1\naws ecs create-cluster --cluster-name flightprice-cluster --region us-east-1\naws s3 mb s3://flightprice-mlops-\u003caccount-id\u003e --region us-east-1\n\n# 2. Build and push Docker image\naws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin \u003caccount-id\u003e.dkr.ecr.us-east-1.amazonaws.com\n\ndocker build -t flightprice-app:latest -f docker/Dockerfile.app .\ndocker tag flightprice-app:latest \u003caccount-id\u003e.dkr.ecr.us-east-1.amazonaws.com/flightprice-app:latest\ndocker push \u003caccount-id\u003e.dkr.ecr.us-east-1.amazonaws.com/flightprice-app:latest\n\n# 3. Create IAM role for ECS\naws iam create-role --role-name ecsTaskExecutionRole --assume-role-policy-document '{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ecs-tasks.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}'\naws iam attach-role-policy --role-name ecsTaskExecutionRole --policy-arn arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy\n\n# 4. Register task definition and create service\naws ecs register-task-definition --cli-input-json file://infra/aws/ecs-task-definition-app-simple.json --region us-east-1\naws ecs create-service --cluster flightprice-cluster --service-name flightprice-app-service --task-definition flightprice-app-task --desired-count 1 --launch-type FARGATE --network-configuration \"awsvpcConfiguration={subnets=[\u003csubnet-id\u003e],securityGroups=[\u003csg-id\u003e],assignPublicIp=ENABLED}\" --region us-east-1\n```\n\n### Cleanup AWS Resources\n\n```bash\naws ecs update-service --cluster flightprice-cluster --service flightprice-app-service --desired-count 0 --region us-east-1\naws ecs delete-service --cluster flightprice-cluster --service flightprice-app-service --region us-east-1\naws ecs delete-cluster --cluster flightprice-cluster --region us-east-1\naws ecr delete-repository --repository-name flightprice-app --force --region us-east-1\n```\n\n## Project Structure\n\n```\nFlightPricePrediction/\n├── configs/                    # YAML configurations\n│   ├── base.yaml              # Data \u0026 evaluation settings\n│   └── training.yaml          # Model hyperparameters\n├── docker/                    # Dockerfiles\n├── infra/                     # Infrastructure\n│   ├── docker-compose.yaml    # Local development\n│   └── aws/                   # ECS task definitions\n├── src/\n│   ├── app/api.py            # FastAPI endpoints\n│   ├── ml/\n│   │   ├── data.py           # Data preprocessing\n│   │   ├── models.py         # EnsembleModel class\n│   │   ├── train.py          # Training pipeline\n│   │   └── evaluate.py       # Model evaluation\n│   ├── database/models.py    # SQLAlchemy ORM\n│   └── monitoring/           # Drift detection\n├── scripts/                   # Deployment scripts\n├── tests/                     # Pytest suite\n├── dvc.yaml                   # DVC pipeline\n└── requirements.txt\n```\n\n## API Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/health` | GET | Health check |\n| `/predict` | POST | Make prediction |\n| `/model_info` | GET | Current model info |\n| `/reload` | POST | Hot-reload model |\n| `/metrics` | GET | Prometheus metrics |\n| `/docs` | GET | Swagger UI |\n\n## Configuration\n\n### Model Weights (configs/training.yaml)\n\n```yaml\nensemble:\n  weights:\n    random_forest: 0.35\n    xgboost: 0.40\n    lightgbm: 0.25\n```\n\n### Evaluation Thresholds (configs/base.yaml)\n\n```yaml\nevaluation:\n  thresholds:\n    min_r2: 0.75\n    max_rmse: 5000\n    max_mape: 0.15\n```\n\n## Monitoring\n\n### Prometheus Metrics\n\n- `app_request_count` - Request counter by endpoint\n- `app_prediction_count` - Total predictions\n- `app_prediction_value` - Price distribution\n- `app_prediction_latency_ms` - Inference latency\n\n### Data Drift Detection\n\n```bash\npython -m src.monitoring.drift_detection --hours 24\n```\n\nGenerates HTML reports in `reports/` directory.\n\n## Testing\n\n```bash\n# Run all tests\npytest -v\n\n# With coverage\npytest --cov=src --cov-report=html\n```\n\n## CI/CD\n\nGitHub Actions workflow (`.github/workflows/ci-cd.yaml`):\n1. **Test** - Run pytest suite\n2. **Lint** - Code quality (black, ruff)\n3. **Build** - Docker image to ECR\n4. **Deploy** - Update ECS service\n\n\n## Troubleshooting\n\n**Model not loading**: Check MLflow is running at http://localhost:5000\n\n**Database errors**: Verify PostgreSQL container is healthy with `docker ps`\n\n**API errors**: Check logs with `docker logs flightprice-app`\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgana36%2Fflight-price-estimation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgana36%2Fflight-price-estimation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgana36%2Fflight-price-estimation/lists"}