HealthChat Pro is an AI-powered medical assistant application that uses large language models to answer health-related questions. The application features a responsive chat interface built with Flask and leverages LangChain for document retrieval and RAG (Retrieval Augmented Generation) capabilities.
- Medical Knowledge Base: Access to comprehensive medical information
- Contextual Responses: AI responses based on medical literature
- Clean, Responsive UI: Modern dark-themed interface
- Session Management: Persistent chat sessions
- Source Citations: References to medical sources
- Vector Database Integration: Efficient document retrieval using Pinecone
.
├── data/ # Medical PDF documents
│ └── Medical_book.pdf # Sample medical document
├── src/ # Source code
│ ├── __init__.py
│ ├── helper.py # Utility functions for document processing
│ └── prompt.py # System prompts for the AI assistant
├── static/ # Static assets
│ ├── bot-avatar.svg
│ ├── favicon.svg
│ ├── logo.svg
│ ├── style.css # CSS styling
│ └── user-avatar.svg
├── templates/ # HTML templates
│ └── chat.html # Main chat interface
├── .env # Environment variables (API keys)
├── .github/ # GitHub configuration
│ └── workflows/ # GitHub Actions workflows
│ └── deploy.yml # AWS deployment workflow
├── .gitignore # Git ignore file
├── app.py # Main Flask application
├── Dockerfile # Docker configuration for containerization
├── LICENSE # Apache License 2.0
├── README.md # Project documentation
├── requirements.txt # Python dependencies
├── research/ # Research and development notebooks
│ └── trials.ipynb # Experimental notebook
├── setup.py # Package setup file
├── store_index.py # Script to create and store embeddings
└── template.sh # Shell script for project setup
- Python 3.10+
- Conda (recommended for environment management)
- Pinecone account
- OpenAI API key
- Clone the repository
git clone https://github.com/Kaleemullah-Younas/HealthChat-Pro
cd HealthChat-Pro- Create a conda environment
conda create -n healthbot python=3.10 -y
conda activate healthbot- Install dependencies
pip install -r requirements.txt- Create a
.envfile in the root directory with your API keys (see.env.examplefor reference)
PINECONE_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
OPENAI_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"- Store embeddings in Pinecone
python store_index.py- Run the application
python app.py- Open your browser and navigate to
http://localhost:8080
python store_index.py- Start the Flask server
python app.py- Open your browser and navigate to:
http://localhost:8080
- Start chatting with the HealthChat Pro AI assistant
- AWS Account
- GitHub Account
- Docker installed locally (for testing)
-
Create IAM User for Deployment
Create a new IAM user with the following policies:
- AmazonEC2ContainerRegistryFullAccess
- AmazonEC2FullAccess
-
Create ECR Repository
Create an Elastic Container Registry repository to store your Docker image.
-
Launch EC2 Instance
Launch an Ubuntu EC2 instance with appropriate security groups (allow HTTP/HTTPS/SSH).
-
Install Docker on EC2
Connect to your EC2 instance and run:
sudo apt-get update -y sudo apt-get upgrade -y curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker ubuntu newgrp docker
-
Configure GitHub Actions
- Go to your GitHub repository
- Navigate to Settings > Actions > Runners
- Click "New self-hosted runner"
- Select Linux as the operating system
- Follow the instructions to set up the runner on your EC2 instance
-
Set Up GitHub Secrets
Add the following secrets to your GitHub repository:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
- ECR_REPO
- PINECONE_API_KEY
- OPENAI_API_KEY
- OPENAI_API_BASE
-
Create GitHub Actions Workflow
Create a
.github/workflows/deploy.ymlfile in your repository with appropriate CI/CD configuration.
- Push changes to your GitHub repository
- GitHub Actions will:
- Build a Docker image
- Push the image to ECR
- Pull and run the image on your EC2 instance