{"id":19682496,"url":"https://github.com/rayyan9477/house-price-prediction-model","last_synced_at":"2026-05-05T01:38:16.686Z","repository":{"id":252834974,"uuid":"841602466","full_name":"Rayyan9477/House-Price-Prediction-Model","owner":"Rayyan9477","description":"This project aims to predict house prices using a machine learning model. The project involves data cleaning, feature engineering, model selection, training, and evaluation. The dataset is uploaded by the user, and the model is trained to predict house prices based on various features.","archived":false,"fork":false,"pushed_at":"2024-08-12T19:51:49.000Z","size":4499,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T06:07:27.274Z","etag":null,"topics":["data-science","data-visualization","gridsearchcv","machine-learning","machine-learning-algorithms","notebook","python","random-forest"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rayyan9477.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-08-12T18:28:02.000Z","updated_at":"2024-08-12T19:51:52.000Z","dependencies_parsed_at":"2024-08-12T21:54:50.230Z","dependency_job_id":null,"html_url":"https://github.com/Rayyan9477/House-Price-Prediction-Model","commit_stats":null,"previous_names":["rayyan9477/house-price-prediction-model"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayyan9477%2FHouse-Price-Prediction-Model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayyan9477%2FHouse-Price-Prediction-Model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayyan9477%2FHouse-Price-Prediction-Model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayyan9477%2FHouse-Price-Prediction-Model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rayyan9477","download_url":"https://codeload.github.com/Rayyan9477/House-Price-Prediction-Model/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240990956,"owners_count":19889983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["data-science","data-visualization","gridsearchcv","machine-learning","machine-learning-algorithms","notebook","python","random-forest"],"created_at":"2024-11-11T18:11:03.232Z","updated_at":"2026-05-05T01:38:16.676Z","avatar_url":"https://github.com/Rayyan9477.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# House Price Prediction CI/CD Pipeline\n\n[![Code Quality](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/code-quality.yml/badge.svg)](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/code-quality.yml)\n[![Testing](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/testing.yml/badge.svg)](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/testing.yml)\n[![Deploy](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/deploy.yml/badge.svg)](https://github.com/Rayyan9477/House-Price-Prediction-Model/actions/workflows/deploy.yml)\n\n## Table of Contents\n- [Introduction](#introduction)\n- [CI/CD Pipeline Overview](#cicd-pipeline-overview)\n- [Branch Strategy](#branch-strategy)\n- [Workflows](#workflows)\n- [API Documentation](#api-documentation)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Docker Deployment](#docker-deployment)\n- [Dependencies](#dependencies)\n- [Contributing](#contributing)\n- [Contact](#contact)\n\n## Introduction\nThis project is a machine learning-powered web application that predicts house prices using a RandomForest regression model. The project implements a comprehensive CI/CD pipeline using GitHub Actions, ensuring code quality, automated testing, and seamless deployment to Docker Hub.\n\n## CI/CD Pipeline Overview\n\n### Pipeline Architecture\nThe CI/CD pipeline follows a three-branch strategy with automated workflows:\n\n```\n┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐\n│     dev     │───▶│    test     │───▶│   master    │───▶│ Docker Hub  │\n│             │    │             │    │             │    │             │\n│ Code Quality│    │ Unit Testing│    │ Deployment  │    │ Container   │\n│ Check       │    │ Coverage    │    │ Email Alert │    │ Registry    │\n└─────────────┘    └─────────────┘    └─────────────┘    └─────────────┘\n```\n\n## Branch Strategy\n\n### 1. Development Branch (`dev`)\n- **Purpose**: Feature development and initial code validation\n- **Triggers**: \n  - Code quality checks with flake8\n  - Security scanning with bandit\n  - PEP 8 compliance verification\n- **Protection**: Requires admin approval for merges\n\n### 2. Test Branch (`test`)\n- **Purpose**: Comprehensive testing and validation\n- **Triggers**:\n  - Automated unit tests\n  - Integration tests\n  - Code coverage analysis\n- **Protection**: Requires successful test completion\n\n### 3. Master Branch (`master`/`main`)\n- **Purpose**: Production-ready code\n- **Triggers**:\n  - Docker image build and push to Docker Hub\n  - Email notifications to administrators\n  - Security scanning of container images\n\n## Workflows\n\n### 1. Code Quality Workflow (`.github/workflows/code-quality.yml`)\n**Trigger**: Push to `dev` branch or PR to `dev`\n\n**Features**:\n- Python syntax validation\n- flake8 linting with PEP 8 compliance\n- Security vulnerability scanning with bandit\n- Code complexity analysis\n\n### 2. Testing Workflow (`.github/workflows/testing.yml`)\n**Trigger**: Push to `test` branch or PR to `test`\n\n**Features**:\n- Comprehensive unit test execution\n- Code coverage reporting\n- API endpoint validation\n- Flask application startup testing\n\n### 3. Deployment Workflow (`.github/workflows/deploy.yml`)\n**Trigger**: Push to `master` branch or merged PR to `master`\n\n**Features**:\n- Docker image building and optimization\n- Multi-tag versioning (latest, branch, SHA)\n- Push to Docker Hub registry\n- Container security scanning\n- Email notifications to administrators\n\n## API Documentation\n\nThe Flask application provides the following REST API endpoints:\n\n### Base URL: `http://localhost:5000`\n\n#### 1. Health Check\n- **Endpoint**: `GET /health`\n- **Description**: Check API status and model availability\n- **Response**:\n```json\n{\n  \"status\": \"healthy\",\n  \"model_loaded\": true\n}\n```\n\n#### 2. Model Information\n- **Endpoint**: `GET /model/info`\n- **Description**: Get trained model details\n- **Response**:\n```json\n{\n  \"model_type\": \"RandomForestRegressor\",\n  \"features_count\": 12,\n  \"status\": \"trained\"\n}\n```\n\n#### 3. Feature Information\n- **Endpoint**: `GET /features`\n- **Description**: Get list of required input features\n- **Response**:\n```json\n{\n  \"features\": [\"area\", \"bedrooms\", \"bathrooms\", ...],\n  \"numerical\": [\"area\", \"bedrooms\", \"bathrooms\", ...],\n  \"categorical\": [\"mainroad\", \"guestroom\", ...],\n  \"total_features\": 12\n}\n```\n\n#### 4. Price Prediction\n- **Endpoint**: `POST /predict`\n- **Description**: Predict house price based on features\n- **Request Body**:\n```json\n{\n  \"features\": {\n    \"area\": 1500,\n    \"bedrooms\": 3,\n    \"bathrooms\": 2,\n    \"stories\": 2,\n    \"mainroad\": \"yes\",\n    \"guestroom\": \"no\",\n    \"basement\": \"no\",\n    \"hotwaterheating\": \"no\",\n    \"airconditioning\": \"yes\",\n    \"parking\": 2,\n    \"prefarea\": \"yes\",\n    \"furnishingstatus\": \"furnished\"\n  }\n}\n```\n- **Response**:\n```json\n{\n  \"prediction\": 4500000.0,\n  \"status\": \"success\"\n}\n```\n\n#### 5. Model Retraining\n- **Endpoint**: `POST /retrain`\n- **Description**: Retrain the model with current dataset\n- **Response**:\n```json\n{\n  \"status\": \"Model retrained successfully\",\n  \"metrics\": {\n    \"mae\": 123.45,\n    \"mse\": 456.78,\n    \"r2\": 0.89,\n    \"r2_percentage\": 89.0\n  }\n}\n```\n\n## Installation\n\n### Local Development Setup\n\n1. **Clone the repository**:\n   ```bash\n   git clone https://github.com/Rayyan9477/House-Price-Prediction-Model.git\n   cd House-Price-Prediction-Model\n   ```\n\n2. **Switch to development branch**:\n   ```bash\n   git checkout dev\n   ```\n\n3. **Create virtual environment**:\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   ```\n\n4. **Install dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n5. **Run the application**:\n   ```bash\n   python app.py\n   ```\n\n### Testing Setup\n\n1. **Run unit tests**:\n   ```bash\n   pytest tests/ -v\n   ```\n\n2. **Run tests with coverage**:\n   ```bash\n   pytest tests/ --cov=app --cov-report=html\n   ```\n\n## Docker Deployment\n\n### Building Docker Image\n\n```bash\ndocker build -t house-price-prediction .\n```\n\n### Running Container\n\n```bash\ndocker run -p 5000:5000 house-price-prediction\n```\n\n### Using Docker Compose (Optional)\n\nCreate `docker-compose.yml`:\n```yaml\nversion: '3.8'\nservices:\n  app:\n    build: .\n    ports:\n      - \"5000:5000\"\n    environment:\n      - FLASK_ENV=production\n```\n\nRun with:\n```bash\ndocker-compose up\n```\n\n## Dependencies\n\n### Core Dependencies\n- **Flask 2.3.3**: Web framework for API development\n- **pandas 2.0.3**: Data manipulation and analysis\n- **numpy 1.24.3**: Numerical computing\n- **scikit-learn 1.3.0**: Machine learning algorithms\n- **matplotlib 3.7.2**: Data visualization\n- **seaborn 0.12.2**: Statistical data visualization\n\n### Development Dependencies\n- **pytest 7.4.0**: Testing framework\n- **flake8 6.0.0**: Code linting and style checking\n- **pytest-cov**: Code coverage reporting\n\n## Contributing\n\n### Development Workflow\n\n1. **Fork the repository**\n2. **Create feature branch from `dev`**:\n   ```bash\n   git checkout dev\n   git checkout -b feature/your-feature-name\n   ```\n\n3. **Make changes and commit**:\n   ```bash\n   git add .\n   git commit -m \"feat: add your feature description\"\n   ```\n\n4. **Push changes**:\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n\n5. **Create Pull Request to `dev` branch**\n\n### Pull Request Process\n\n1. **dev → test**: Feature completion, triggers testing workflow\n2. **test → master**: Testing success, triggers deployment workflow\n3. **Admin approval required** for all merges\n\n### Code Standards\n\n- Follow PEP 8 style guidelines\n- Maintain code coverage above 80%\n- Add unit tests for new features\n- Update documentation for API changes\n\n## Required GitHub Secrets\n\nConfigure the following secrets in your GitHub repository:\n\n| Secret Name | Description | Example |\n|-------------|-------------|---------|\n| `DOCKER_HUB_USERNAME` | Docker Hub username | `rayyan9477` |\n| `DOCKER_HUB_ACCESS_TOKEN` | Docker Hub access token | `dckr_pat_...` |\n| `EMAIL_USERNAME` | SMTP email username | `your-email@gmail.com` |\n| `EMAIL_PASSWORD` | SMTP email app password | `app-specific-password` |\n\n## Project Structure\n\n```\nHouse-Price-Prediction-Model/\n├── .github/\n│   └── workflows/\n│       ├── code-quality.yml\n│       ├── testing.yml\n│       └── deploy.yml\n├── tests/\n│   ├── __init__.py\n│   └── test_app.py\n├── app.py                 # Flask application\n├── House_dataset.csv      # Training dataset\n├── requirements.txt       # Python dependencies\n├── Dockerfile            # Container configuration\n├── .dockerignore         # Docker ignore rules\n├── Readme.md            # Project documentation\n└── LICENSE              # License file\n```\n\n## Video Demonstration\n\nWatch the video demonstration of the project:\n\n![House Price Prediction Demo](https://github.com/Rayyan9477/House-Price-Prediction-Model/blob/main/video.mp4)\n\nClick the link to watch demo.\n\n## Contact\n\n- **Email**: i222489@nu.edu.pk\n- **GitHub**: [Rayyan9477](https://github.com/Rayyan9477)\n- **LinkedIn**: [Rayyan Ahmed](https://www.linkedin.com/in/rayyan-ahmed9477/)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayyan9477%2Fhouse-price-prediction-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayyan9477%2Fhouse-price-prediction-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayyan9477%2Fhouse-price-prediction-model/lists"}