{"id":35214452,"url":"https://github.com/shailesh-1011/oilandgaschatbot","last_synced_at":"2026-04-10T11:01:16.517Z","repository":{"id":330544935,"uuid":"1123105031","full_name":"shailesh-1011/OilandGasChatbot","owner":"shailesh-1011","description":"🛢️Oil \u0026 Gas news chatbot with semantic search, NLP classification, and automated scraping from 12+ industry sources. Built with Flask, Sentence Transformers, and spaCy.","archived":false,"fork":false,"pushed_at":"2025-12-26T08:03:10.000Z","size":6905,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-27T19:10:33.719Z","etag":null,"topics":["automation","chatbot","flask","machine-learning","nlp","oil-and-gas","python","semantic-search","spacy","web-scraping"],"latest_commit_sha":null,"homepage":"http://202.61.254.26","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shailesh-1011.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-26T07:34:13.000Z","updated_at":"2025-12-26T08:03:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shailesh-1011/OilandGasChatbot","commit_stats":null,"previous_names":["shailesh-1011/oilandgaschatbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/shailesh-1011/OilandGasChatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shailesh-1011%2FOilandGasChatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shailesh-1011%2FOilandGasChatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shailesh-1011%2FOilandGasChatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shailesh-1011%2FOilandGasChatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shailesh-1011","download_url":"https://codeload.github.com/shailesh-1011/OilandGasChatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shailesh-1011%2FOilandGasChatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31639524,"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":["automation","chatbot","flask","machine-learning","nlp","oil-and-gas","python","semantic-search","spacy","web-scraping"],"created_at":"2025-12-29T21:19:13.333Z","updated_at":"2026-04-10T11:01:16.510Z","avatar_url":"https://github.com/shailesh-1011.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛢️ Oil \u0026 Gas News Chatbot\n\nAn AI-powered chatbot that scrapes, analyzes, and provides intelligent search over oil \u0026 gas industry news from 12+ global sources.\n\n[![Live Demo](https://img.shields.io/badge/Live_Demo-202.61.254.26-brightgreen.svg)](http://202.61.254.26)\n![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)\n![Flask](https://img.shields.io/badge/Flask-3.0-green.svg)\n![ML](https://img.shields.io/badge/ML-Sentence_Transformers-orange.svg)\n![License](https://img.shields.io/badge/License-MIT-yellow.svg)\n\n## 🌟 Features\n\n- **🔍 Semantic Search**: Uses sentence-transformers for intelligent article matching\n- **📰 Multi-Source Scraping**: Collects news from 12+ industry sources\n- **🤖 NLP Classification**: Automatically categorizes articles by topic\n- **📊 Named Entity Recognition**: Extracts companies, locations, and key entities\n- **🎯 Direct Answers**: Provides concise answers to queries from article content\n- **⏰ Automated Updates**: Daily scraping with cron job support\n- **🌐 Clean Web UI**: Google-like search interface\n\n## 📸 Demo\n\n```\n┌──────────────────────────────────────────────────────────────┐\n│  🛢️ Oil \u0026 Gas News Chatbot                                   │\n├──────────────────────────────────────────────────────────────┤\n│                                                              │\n│                    Oil\u0026Gas Search                            │\n│                                                              │\n│   ┌──────────────────────────────────────────────────────┐   │\n│   │ What is the latest OPEC decision?               🔍   │   │\n│   └──────────────────────────────────────────────────────┘   │\n│                                                              │\n│   📌 Topic: REGULATION (85%)                                 │\n│                                                              │\n│   ┌──────────────────────────────────────────────────────┐   │\n│   │ 📄 OPEC+ Maintains Production Cuts                   │   │\n│   │ Reuters • December 25, 2025 • 92% match              │   │\n│   │                                                      │   │\n│   │ 💡 DIRECT ANSWER                                     │   │\n│   │ OPEC+ agreed to extend production cuts through Q1    │   │\n│   │ 2026, keeping output reduced by 2.2 million bpd.     │   │\n│   │                                                      │   │\n│   │ 📋 Key Facts:                                        │   │\n│   │ • Production cuts extended through Q1 2026           │   │\n│   │ • 2.2 million barrels per day reduction maintained   │   │\n│   │ • Saudi Arabia leads voluntary cuts                  │   │\n│   └──────────────────────────────────────────────────────┘   │\n│                                                              │\n└──────────────────────────────────────────────────────────────┘\n```\n\n## 🏗️ Architecture\n\n```\noilandgasChatBot/\n├── main.py                 # Main orchestrator - runs scrapers \u0026 training\n├── scheduler.py            # Automated scheduling (10 AM \u0026 5 PM daily)\n├── setup_vps.sh           # One-command VPS deployment script\n│\n├── scrapers/              # News scrapers (12 sources)\n│   ├── rigzone.py\n│   ├── reuters.py\n│   ├── oilprice.py\n│   ├── worldoil.py\n│   ├── offshore_energy.py\n│   ├── energynow.py\n│   ├── boereport.py\n│   ├── ogj.py\n│   ├── indianoilandgas.py\n│   ├── energy_economictimes_indiatimes.py\n│   ├── news_oilandgaswatch.py\n│   ├── reuters_climate.py\n│   ├── utils.py           # Shared utilities\n│   └── articles.csv       # Scraped articles database\n│\n├── ml/                    # Machine Learning models\n│   ├── chatbot.py         # Main chatbot class with search\n│   ├── semantic_embeddings.py  # Sentence-transformer embeddings\n│   ├── text_classifier.py # Topic classification\n│   ├── topic_clustering.py # Unsupervised clustering\n│   ├── ner_extraction.py  # Named Entity Recognition\n│   ├── train_all.py       # Training pipeline\n│   ├── evaluate.py        # Model evaluation\n│   └── *.pkl / *.json     # Trained model files\n│\n└── web/                   # Flask web application\n    ├── app.py             # Flask routes \u0026 API\n    └── templates/\n        └── index.html     # Search UI\n```\n\n## 🚀 Quick Start\n\n### Local Development\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/shailesh-1011/OilandGasChatbot.git\ncd OilandGasChatbot\n\n# 2. Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # Linux/Mac\n# or: venv\\Scripts\\activate  # Windows\n\n# 3. Install dependencies\npip install -r requirements.txt\npython -m spacy download en_core_web_sm\n\n# 4. Run everything (scrape + train + web server)\npython main.py --run\n```\n\nThen open **http://localhost:5000** in your browser.\n\n### Command Line Options\n\n```bash\npython main.py              # Run scrapers only\npython main.py --train      # Scrape + train ML models\npython main.py --run        # Scrape + train + start web server\npython main.py --web        # Start web server only (uses existing models)\n```\n\n## 🖥️ VPS Deployment\n\n### One-Command Setup\n\n```bash\n# On your VPS (Ubuntu 22.04)\nbash setup_vps.sh\n```\n\nThis script automatically:\n- ✅ Updates system packages\n- ✅ Installs Python, Nginx\n- ✅ Creates virtual environment\n- ✅ Installs all dependencies\n- ✅ Sets up systemd service (auto-start)\n- ✅ Configures Nginx reverse proxy\n- ✅ Sets up daily cron job (6 AM)\n\n### Manual Deployment\n\n```bash\n# 1. Install dependencies\napt update \u0026\u0026 apt install -y python3 python3-pip python3-venv nginx\n\n# 2. Setup project\ncd /root/oilandgasChatBot\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\npython -m spacy download en_core_web_sm\n\n# 3. Initial scrape \u0026 train\npython main.py --train\n\n# 4. Start with Gunicorn\ngunicorn -w 2 -b 0.0.0.0:5000 --timeout 120 web.app:app\n```\n\n### Service Management\n\n```bash\n# Check status\nsystemctl status oilgas-api\n\n# View logs\njournalctl -u oilgas-api -f\n\n# Restart service\nsystemctl restart oilgas-api\n\n# Manual scrape\ncd /root/oilandgasChatBot \u0026\u0026 source venv/bin/activate \u0026\u0026 python scheduler.py --once\n```\n\n## 🔌 API Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/` (root) | GET | Web search interface |\n| `/search` | POST | Search (form data) |\n| `/api/search` | POST | Search (JSON API) |\n| `/api/stats` | GET | Article statistics |\n| `/api/health` | GET | Health check |\n\n### API Examples\n\n**Search Request:**\n```bash\ncurl -X POST http://your-server/api/search \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"oil price forecast\"}'\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"query\": \"oil price forecast\",\n  \"topic\": \"price_market\",\n  \"topic_confidence\": \"85%\",\n  \"results\": [\n    {\n      \"title\": \"Brent Crude Falls Amid Market Uncertainty\",\n      \"source\": \"Reuters\",\n      \"date\": \"2025-12-25\",\n      \"relevance\": \"92.5%\",\n      \"direct_answer\": \"Oil prices are expected to...\",\n      \"key_facts\": [\"Brent at $73.50\", \"WTI at $69.80\"]\n    }\n  ]\n}\n```\n\n## 📰 News Sources\n\n| Source | Type | Coverage |\n|--------|------|----------|\n| [Rigzone](https://www.rigzone.com) | Industry News | Global |\n| [Reuters Energy](https://www.reuters.com/business/energy/) | Wire Service | Global |\n| [OilPrice.com](https://oilprice.com) | Market Analysis | Global |\n| [World Oil](https://www.worldoil.com) | Industry Magazine | Global |\n| [Offshore Energy](https://www.offshore-energy.biz) | Offshore Focus | Global |\n| [Energy Now](https://energynow.com) | North America | US/Canada |\n| [BOE Report](https://boereport.com) | Canada Focus | Canada |\n| [OGJ](https://www.ogj.com) | Industry Journal | Global |\n| [Indian Oil \u0026 Gas](https://www.indianoilandgas.com) | India Focus | India |\n| [ET Energy](https://energy.economictimes.indiatimes.com) | India News | India |\n| [Oil \u0026 Gas Watch](https://news.oilandgaswatch.org) | Environmental | US |\n| [Reuters Climate](https://www.reuters.com/sustainability/) | Climate/ESG | Global |\n\n## 🧠 ML Pipeline\n\n### 1. Semantic Embeddings\n- **Model**: `all-mpnet-base-v2` (Sentence Transformers)\n- **Purpose**: Convert articles to 768-dim vectors for similarity search\n\n### 2. Text Classification\n- **Model**: Logistic Regression on embeddings\n- **Categories**: \n  - `price_market` - Oil prices, trading, forecasts\n  - `production` - Drilling, output, reserves\n  - `pipeline_lng` - Infrastructure, LNG, transport\n  - `corporate` - M\u0026A, earnings, company news\n  - `geopolitics` - OPEC, sanctions, conflicts\n  - `regulation` - Policies, laws, permits\n  - `exploration` - Discoveries, surveys\n  - `other` - Miscellaneous\n\n### 3. Topic Clustering\n- **Model**: K-Means (10 clusters)\n- **Purpose**: Unsupervised article grouping\n\n### 4. Named Entity Recognition\n- **Model**: spaCy `en_core_web_sm`\n- **Entities**: Organizations, Locations, Monetary values\n\n## 📋 Requirements\n\n```\nflask==3.0.0\nflask-cors==4.0.0\ngunicorn==21.2.0\nrequests\u003e=2.31.0\nbeautifulsoup4\u003e=4.12.0\nlxml\u003e=4.9.0\npandas\u003e=2.0.0\nnumpy\u003e=1.24.0\nsentence-transformers\u003e=2.2.0\nscikit-learn\u003e=1.3.0\nspacy\u003e=3.7.0\nschedule\u003e=1.2.0\n```\n\n## 🔧 Configuration\n\n### Environment Variables (Optional)\n\n```bash\nexport FLASK_ENV=production\nexport FLASK_DEBUG=0\nexport PORT=5000\n```\n\n### Nginx Configuration\n\n```nginx\nserver {\n    listen 80;\n    server_name your-domain.com;\n\n    location / {\n        proxy_pass http://127.0.0.1:5000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_read_timeout 120s;\n    }\n}\n```\n\n## 📊 Performance\n\n- **Scraping**: ~80 seconds for all 12 sources\n- **Training**: ~5-10 minutes (depends on article count)\n- **Search**: \u003c500ms response time\n- **Memory**: ~2GB with loaded models\n\n## 🛣️ Roadmap\n\n- [ ] Add more news sources\n- [ ] Implement article summarization\n- [ ] Add sentiment analysis\n- [ ] Create mobile-responsive UI\n- [ ] Add user query history\n- [ ] Implement caching layer\n- [ ] Add Docker support\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit changes (`git commit -m 'Add amazing feature'`)\n4. Push to branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👨‍💻 Author\n\n**Shailesh**\n- GitHub: [@shailesh-1011](https://github.com/shailesh-1011)\n- 🌐 Live Demo: [http://202.61.254.26](http://202.61.254.26)\n\n## 🙏 Acknowledgments\n\n- [Sentence Transformers](https://www.sbert.net/) for semantic embeddings\n- [spaCy](https://spacy.io/) for NLP\n- [Flask](https://flask.palletsprojects.com/) for web framework\n- All the news sources for their valuable content\n\n---\n\n⭐ **Star this repo if you find it useful!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshailesh-1011%2Foilandgaschatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshailesh-1011%2Foilandgaschatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshailesh-1011%2Foilandgaschatbot/lists"}