{"id":30285942,"url":"https://github.com/kgelli/medical-condition-predictor-bert-flask","last_synced_at":"2026-05-06T01:34:13.983Z","repository":{"id":302613873,"uuid":"1013015933","full_name":"kgelli/Medical-Condition-Predictor-BERT-Flask","owner":"kgelli","description":"AI-powered medical condition predictor using BERT and TF-IDF models with drug recommendations - Master's Capstone Project","archived":false,"fork":false,"pushed_at":"2025-07-15T06:34:10.000Z","size":113103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-16T20:51:25.497Z","etag":null,"topics":["artificial-intelligence","bert","drug-recommendation","flask","healthcare","machine-learning","medical-ai","medical-prediction","natural-language-processing","pytorch","transformers","web-application"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/kgelli.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}},"created_at":"2025-07-03T08:27:04.000Z","updated_at":"2025-07-15T06:34:14.000Z","dependencies_parsed_at":"2025-07-03T10:37:50.535Z","dependency_job_id":null,"html_url":"https://github.com/kgelli/Medical-Condition-Predictor-BERT-Flask","commit_stats":null,"previous_names":["kgelli/medical-condition-predictor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kgelli/Medical-Condition-Predictor-BERT-Flask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgelli%2FMedical-Condition-Predictor-BERT-Flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgelli%2FMedical-Condition-Predictor-BERT-Flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgelli%2FMedical-Condition-Predictor-BERT-Flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgelli%2FMedical-Condition-Predictor-BERT-Flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgelli","download_url":"https://codeload.github.com/kgelli/Medical-Condition-Predictor-BERT-Flask/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgelli%2FMedical-Condition-Predictor-BERT-Flask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32675036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["artificial-intelligence","bert","drug-recommendation","flask","healthcare","machine-learning","medical-ai","medical-prediction","natural-language-processing","pytorch","transformers","web-application"],"created_at":"2025-08-16T20:44:59.332Z","updated_at":"2026-05-06T01:34:13.977Z","avatar_url":"https://github.com/kgelli.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Medical Condition Predictor \u0026 Drug Recommendation System\n\n## Master's Capstone Project\n**Student:** Kusal Venkata Sai Shravanth Gelli  \n**Project Advisor:** Dr. Anu Bourgeois  \n**Institution:** Georgia State University  \n\n## Project Overview\nAn AI-powered web application that predicts medical conditions from patient-described symptoms and provides drug recommendations based on real patient reviews and ratings. The system utilizes advanced Natural Language Processing with BERT (Bidirectional Encoder Representations from Transformers) for high-accuracy medical condition classification.\n\n## Key Features\n- **BERT-Powered Predictions** using DistilBERT for sequence classification with 60-95% confidence scores\n- **Fallback TF-IDF Model** ensures reliability when BERT is unavailable\n- **Real Patient Reviews** with interactive modal interface showing actual patient experiences\n- **Smart Drug Recommendations** based on 161K+ medical records with ratings and usefulness scores\n- **Modern Responsive UI** with Bootstrap 5 and professional medical styling\n- **Comprehensive Medical Disclaimers** for user safety and legal compliance\n\n## Technical Architecture\n\n### Machine Learning Models\n- **Primary Model:** DistilBERT (distilbert-base-uncased)\n  - Fine-tuned on medical drug review dataset\n  - Achieves 60-95% confidence scores\n  - Superior contextual understanding of medical descriptions\n- **Fallback Model:** TF-IDF + Passive Aggressive Classification\n  - Ensures system reliability\n  - Fast processing for backup scenarios\n\n### Technology Stack\n- **Backend:** Flask (Python web framework)\n- **Machine Learning:** PyTorch, Transformers, scikit-learn\n- **Natural Language Processing:** NLTK, BeautifulSoup\n- **Data Processing:** pandas, NumPy\n- **Frontend:** Bootstrap 5, HTML5, CSS3, JavaScript\n- **Database:** CSV-based patient review dataset\n\n### Dataset\n- **Source:** Drugs.com patient reviews\n- **Size:** 161,297 patient reviews\n- **Medical Conditions:** 4 primary conditions\n  - High Blood Pressure\n  - Depression\n  - Diabetes Type 2\n  - Birth Control\n- **Data Features:** Patient reviews, drug ratings, usefulness scores, timestamps\n\n## System Performance\n- **Model Accuracy:** High accuracy with BERT's advanced NLP capabilities\n- **Confidence Scores:** 60-95% for BERT predictions\n- **Processing Time:** ~1-3 seconds per prediction (including drug recommendations)\n- **Scalability:** Handles concurrent users with session management\n\n## Installation \u0026 Setup\n\n### Prerequisites\n- Python 3.8+\n- pip package manager\n- 4GB+ RAM (for BERT model)\n- Git LFS (for large model files)\n\n### Installation Steps\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git\n   cd YOUR_REPO_NAME\n   ```\n\n2. **Install Git LFS (if not already installed):**\n   ```bash\n   git lfs install\n   ```\n\n3. **Pull LFS files:**\n   ```bash\n   git lfs pull\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\n6. **Access the application:**\n   Open your browser and navigate to `http://localhost:8080`\n\n### Model Files (Included via Git LFS)\n- `model/distilbert-drug-review-model/` - Fine-tuned BERT model (256MB)\n- `model/distilbert-drug-review-tokenizer/` - BERT tokenizer\n- `model/label_encoder.pkl` - Label encoder for condition mapping\n- `model/passmodel.pkl` - Fallback TF-IDF model\n- `model/tfidfvectorizer.pkl` - TF-IDF vectorizer\n- `data/drugsComTrain.csv` - Training dataset (80MB+)\n\n## User Interface Features\n- **Professional Medical Styling** with healthcare-appropriate color schemes\n- **Interactive Drug Cards** with click-to-view patient reviews\n- **Confidence Visualization** with progress bars and metrics\n- **Mobile-Responsive Design** for accessibility across devices\n- **Real-time Processing Indicators** showing prediction progress\n\n## Academic Contributions\nThis Master's Capstone Project demonstrates:\n- **Advanced NLP Implementation** with state-of-the-art BERT architecture\n- **Healthcare AI Applications** with real-world medical data\n- **Full-Stack Development** from data processing to web deployment\n- **User Experience Design** for medical applications\n- **Professional Software Engineering** practices and documentation\n\n## Safety \u0026 Legal Compliance\n- **Medical Disclaimers** prominently displayed throughout the application\n- **Educational Purpose** clearly stated for academic research\n- **Professional Consultation** recommended for all medical decisions\n- **Data Privacy** considerations for patient review information\n\n## Future Enhancements\n- **Additional Medical Conditions** expansion of supported conditions\n- **Enhanced Drug Information** including side effects and contraindications\n- **User Accounts** for prediction history and personalized recommendations\n- **API Integration** for external medical databases\n- **Multi-language Support** for broader accessibility\n\n## Repository Structure\n```\n├── app.py                          # Main Flask application\n├── bert_diagnostic.py              # BERT model diagnostic utilities\n├── bert_handler.py                 # BERT model handling logic\n├── recreate_label_encoder.py       # Label encoder recreation script\n├── requirements.txt                # Python dependencies\n├── model/                          # Machine learning models (Git LFS)\n│   ├── distilbert-drug-review-model/\n│   ├── distilbert-drug-review-tokenizer/\n│   └── *.pkl                       # Serialized models\n├── data/                           # Training datasets (Git LFS)\n│   └── drugsComTrain.csv\n├── templates/                      # HTML templates\n│   ├── home.html\n│   ├── login.html\n│   └── predict.html\n└── logs/                           # Application logs\n```\n\n## Git LFS Usage\nThis repository uses Git LFS (Large File Storage) to handle large model files and datasets. The following file types are tracked with LFS:\n- `*.bin` - PyTorch model binaries\n- `*.safetensors` - Model tensors\n- `*.pkl` - Serialized Python objects\n- `*.csv` - Large datasets\n- `*.tsv` - Tab-separated data files\n\n## License\nAcademic project for educational purposes only. Not intended for commercial medical use.\n\n## Acknowledgments\nSpecial thanks to Dr. Anu Bourgeois for invaluable guidance and support throughout this Master's Capstone Project. This work represents the culmination of advanced study in Machine Learning and Natural Language Processing applied to healthcare informatics.\n\n---\n\n**Note:** This system is designed for educational and research purposes. Always consult with qualified healthcare professionals for medical advice and treatment decisions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgelli%2Fmedical-condition-predictor-bert-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgelli%2Fmedical-condition-predictor-bert-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgelli%2Fmedical-condition-predictor-bert-flask/lists"}