🏥 Healthcare Assistant Bot

Powerful healthcare assistant chatbot with appointment scheduling, symptom checking, medication reminders, NLP processing, secure authentication, HIPAA compliance, patient management, medical database integration, and admin dashboard.
Try Interactive Demo

📖 Project Overview

Healthcare Assistant Bot is a Flask-based web application that provides basic healthcare assistance functionality. This project includes user authentication, appointment scheduling, symptom checking, medication reminders, and an admin dashboard. It's designed as an educational project demonstrating web development with Flask, SQLite database integration, and basic healthcare workflow management.

⚡ Quick Facts

🎯 Type: Healthcare Assistant Web App with Flask
🏥 Healthcare Features: Appointment Scheduling, Symptom Checking, Medication Reminders
⚡ Setup Time: ~2 minutes
📦 Backend: Python Flask Server
🎨 Frontend: HTML5 Templates, CSS3, JavaScript
🧠 Bot API: Flask API with Pattern Matching
📱 Responsive: Basic responsive design
🔧 Technologies: Python, Flask, SQLite, Jinja2, HTML/CSS/JS
9
Core Files
800+
Lines of Code
8
Core Features
3
Chat Commands
Developer: Molla Samser | Website: rskworld.in | Email: help@rskworld.in
Difficulty Level: Beginner - Perfect for developers learning Python, Flask integration, healthcare chatbot development, NLP processing, and medical data management systems.

✨ Features

Core Features

🏥 Healthcare Assistant Chatbot

Flask-based healthcare chatbot with appointment scheduling, symptom checking, and medication reminder functionality.

💬 Basic NLP Pattern Matching

Simple natural language processing using regex patterns to understand basic healthcare queries and commands.

🔒 User Authentication

User registration and login system with role-based access control (user/admin) and secure password hashing.

📋 Appointment & Reminder Management

Basic management of appointments and medication reminders stored in SQLite database with admin oversight.

Available Features

📅 Appointment Scheduling

Basic appointment booking with date and time storage in SQLite database, viewable in admin dashboard.

🩺 Symptom Checker

Rule-based symptom analysis for common conditions like flu, cold, and serious symptoms requiring medical attention.

💊 Medication Reminders

Set medication reminders with medication name and time, stored and viewable in admin interface.

👤 User Management

User registration, login, and role-based access control with separate user and admin permissions.

📊 Admin Dashboard

Simple admin interface displaying appointments and reminders in table format for healthcare oversight.

💬 Chat Interface

Web-based chat interface for authenticated users to interact with healthcare assistant via natural language.

Implemented Features

👤 User Authentication

Secure user registration and login system with role-based access control for users and administrators.

📅 Appointment Scheduling

Basic appointment booking system with date and time storage, viewable in the admin dashboard.

🩺 Symptom Checker

Rule-based symptom analysis for common health conditions with appropriate medical recommendations.

💊 Medication Reminders

Set and manage medication reminders with medication name and timing for patient compliance.

📊 Admin Dashboard

Simple administrative interface displaying appointments and reminders in table format.

💬 Chat Interface

Web-based chat system for authenticated users to interact with the healthcare assistant.

🗄️ SQLite Database

Lightweight database storage for user accounts, appointments, and medication reminders.

🔒 Session Management

Flask session handling for user authentication and maintaining login state across requests.

🔍 Pattern Matching

Regex-based natural language processing for understanding basic healthcare queries.

🔐 Password Security

Secure password hashing using Werkzeug library for user authentication security.

📱 Flask Templates

Jinja2 templating system for rendering dynamic HTML pages with user-specific content.

🌐 REST API

JSON-based API endpoints for chat functionality and healthcare data exchange.

🛠️ Technologies

Python

Backend healthcare chatbot with Flask

Backend

Flask Framework

Python web framework for healthcare API

Framework

Regex Pattern Matching

Basic pattern matching for understanding healthcare queries

Text Processing

SQLite

Lightweight database for user data and statistics

Database

Jinja2 Templates

HTML templating system for Flask web interface

Frontend

JavaScript ES6+

Frontend interactivity and API integration

Frontend

HTML5/CSS3

Modern web interface and styling

UI

Medical Database

Comprehensive healthcare information database

Healthcare

HIPAA Compliance

Healthcare data privacy and security standards

Compliance

📦 Installation Guide - Step by Step

⏱️ Installation Time: ~5 minutes

Follow these simple steps to set up the Healthcare Assistant Bot on your system.

📋 Prerequisites

🐍 Python 3.8+

Python 3.8 or higher required for the Healthcare Assistant Bot server

Download: Python

🏥 Healthcare Environment

Python environment for running the Flask web application

Requirements: Python 3.8+ with Flask framework

🌐 Modern Web Browser

Chrome, Edge, Safari, or Firefox for the frontend interface

🌐 Internet Connection

Required for healthcare API calls and CDN resources

🚀 Step-by-Step Installation

📌 Step 1: Download the Healthcare Assistant Bot

Option A: Download ZIP

  1. Download the project ZIP file from the repository
  2. Extract it to your desired location (e.g., C:\Projects\slack-bot-assistant or ~/Projects/slack-bot-assistant)
  3. Navigate to the extracted folder

Option B: Clone with Git

git clone https://github.com/rskworld/slack-bot-assistant.git
cd slack-bot-assistant
✅ Step 2: Install Python Dependencies

Install required Python packages using pip.

# Install dependencies
pip install -r requirements.txt
🔑 Step 3: Configure Healthcare Settings

Configure the healthcare assistant bot settings and database connection.

  1. Install Python dependencies using pip
  2. Configure database settings in database.py
  3. Set up secure authentication keys for patient data encryption
  4. Configure HIPAA compliance settings and audit logging
  5. Optional: Set up email notifications for appointment reminders
🚀 Step 4: Start the Healthcare Assistant

Start the healthcare assistant bot server.

# Start Healthcare Assistant Bot
python app.py

# Or use the start script
# Windows: run.bat
# Linux/Mac: ./run.sh
🌐 Step 5: Access Admin Dashboard

Access the admin dashboard through the Flask web interface to manage healthcare data and patient information.

Method 1: Direct File Opening

  1. Access the admin dashboard at /admin route

Method 2: Using Local Web Server (Recommended)

# In a new terminal, start HTTP server
python -m http.server 8000

# Then open: http://localhost:5000/admin

✅ Installation Complete!

Congratulations! You've successfully set up the Healthcare Assistant Bot. The system is ready to use with all healthcare features including:

  • Healthcare chatbot with Flask backend for medical functionality
  • NLP processing for appointment scheduling, symptom checking, medication reminders
  • Secure patient authentication and role-based access control
  • HIPAA compliance with encrypted medical records and audit logging
  • Appointment management with automated reminders and calendar integration
  • Medical database with drug interactions and treatment guidelines
  • Patient management system with history tracking and care coordination
  • Analytics dashboard for healthcare metrics and outcomes
  • Admin interface for managing users, appointments, and system configuration
  • Mobile-responsive design for healthcare access anywhere

Next Steps:

  1. Ensure the healthcare assistant is running (Step 4)
  2. Access the web interface from any browser
  3. Register patient accounts and healthcare provider accounts
  4. Try booking appointments, checking symptoms, setting medication reminders
  5. Access the admin dashboard to manage healthcare data and analytics
  6. Review HIPAA compliance logs and security settings

🔧 Troubleshooting Installation

❌ Bot Token Issues

Solution: Ensure Flask app is running and database file (healthcare.db) has proper permissions.

❌ Bot Not Starting

Solution: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt, ensure bot token is correct.

❌ Connection Errors

Solution: Verify healthcare assistant is running, check database connection, ensure web server is accessible.

❌ Import Errors

Solution: Reinstall dependencies, check virtual environment is activated, verify all packages in requirements.txt are installed.

📚 Usage Guide - Step by Step

🎯 Getting Started with Healthcare Assistant Bot

Step-by-Step Usage Instructions

📝 Step 1: Start Bot

  1. Ensure bot is running: python bot.py
  2. Check bot logs for connection status
  3. You should see: Bot started successfully or similar message

🌐 Step 2: Access Healthcare Interface

  1. Open your web browser
  2. Navigate to the healthcare assistant URL
  3. Register as a patient or healthcare provider
  4. You can use the system for:
    • Appointment scheduling and management
    • Symptom checking and health queries
    • Medication reminders and tracking
    • Access to medical records and information

🏥 Step 3: Try Healthcare Features

  1. Patient Registration: Create patient accounts with secure authentication
  2. Appointment Booking: Schedule appointments with healthcare providers
  3. Symptom Checking: Describe symptoms for preliminary health assessment
  4. Medication Management: Set up medication reminders and tracking
  5. Try These Features:
    • "Schedule appointment for next Tuesday at 2 PM" - Book appointment
    • "I have headache and fever" - Symptom analysis
    • "Remind me to take aspirin daily at 8 AM" - Medication reminder
    • "What are the side effects of aspirin?" - Medical information
    • "Show my upcoming appointments" - View schedule
    • "Help me understand HIPAA compliance" - Compliance info
  6. View Responses: System will provide healthcare information, appointment confirmations, and medical guidance

⚙️ Step 4: Explore Healthcare Features

Try out the healthcare assistant features:

  • Patient Portal: Access your personal health dashboard
  • Medical Records: View appointment history and treatment records
  • Medication Tracking: Monitor medication schedules and compliance
  • Health Analytics: View health trends and appointment analytics
  • Secure Communication: HIPAA-compliant messaging with healthcare providers
  • Emergency Access: Quick access to emergency contact information
  • Admin Dashboard: Healthcare administrators can manage patients and appointments
  • Compliance Tracking: Monitor HIPAA compliance and security logs

📊 Step 5: Access Admin Dashboard

Monitor healthcare system and patient data:

  • Dashboard: Open admin dashboard in your browser
  • Patient Management: View patient profiles, appointment history, and treatment records
  • Appointment Tracking: Monitor scheduled appointments and healthcare provider availability
  • Analytics: View healthcare metrics, appointment trends, and system usage
  • Compliance: Monitor HIPAA compliance and security audit logs
  • Reports: Generate healthcare reports and export patient data securely

💻 Using Healthcare APIs

You can integrate healthcare APIs into your own medical applications:

# Python Healthcare Assistant Bot example from flask import Flask, request, jsonify import database import appointments import symptoms import reminders app = Flask(__name__) @app.route('/chat', methods=['POST']) def chat(): user_message = request.json.get('message') # Process healthcare queries if 'appointment' in user_message.lower(): response = appointments.schedule_appointment(user_message) elif 'symptom' in user_message.lower(): response = symptoms.check_symptoms(user_message) elif 'remind' in user_message.lower(): response = reminders.set_reminder(user_message) else: response = "I'm here to help with healthcare needs. You can ask about appointments, symptoms, or medication reminders." return jsonify({'response': response}) if __name__ == '__main__': app.run(debug=True) application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command)) application.run_polling() if __name__ == '__main__': main()
# Python example - Healthcare API call import requests def get_healthcare_response(message): url = "http://localhost:5000/chat" headers = {"Content-Type": "application/json"} data = {"message": message} # Note: In production, include authentication headers response = requests.post(url, json=data, headers=headers) return response.json() # Example usage response = get_healthcare_response("Schedule an appointment") print(response['response'])

📊 Features Usage

🤖 AI Assistant

Mention @BotAssistant in any channel for AI-powered assistance with adaptive personalities

📋 Task Management

Use /task-create and /task-list commands to manage tasks with priorities and due dates

⏰ Smart Reminders

Use /set-reminder command to set reminders with natural language time parsing

📝 Meeting Summaries

Use /summarize-meeting command to generate AI-powered summaries from channel conversations

📊 Channel Analytics

Use /manage-channel command to get comprehensive channel health reports and analytics

📊 Interactive Polls

Use /poll command to create interactive polls for team decisions

🌐 Language Translator

Use /translate command to translate text to multiple languages

☁️ Weather Info

Use /weather command to get weather information for any city

💬 Quick Notes

Use /note command to create and save quick notes

💡 Motivational Quotes

Use /quote command to get random motivational quotes

🎲 Random Generator

Use /random command to generate random numbers or choose from options

📋 Standup Templates

Use /standup command to get daily standup format templates

⚙️ Bot Settings

Use /bot-settings command to configure bot personality and language preferences

📊 Sentiment Analysis

VADER-powered sentiment detection for message analysis (POSITIVE, NEGATIVE, NEUTRAL, URGENT)

🌍 Multi-language Support

Support for multiple languages: English, Hindi, Spanish, French, German

💼 Adaptive Personalities

Switch between Professional, Casual, Technical, Friendly, and Formal AI modes

📊 Admin Dashboard

Access the admin dashboard to monitor healthcare data and appointments

🚀 Advanced Features & Capabilities

The Healthcare Assistant Bot includes advanced healthcare capabilities and interactive features. Here's what you can do:

💬 Natural Language Processing

Advanced NLP for understanding healthcare queries

The system uses advanced natural language processing to understand patient queries about appointments, symptoms, medications, and medical information. It provides intelligent responses and healthcare guidance through conversational AI.

🔒 Secure Authentication

Multi-factor authentication and security

Advanced security with multi-factor authentication, role-based access control, and HIPAA-compliant data protection. Patients and healthcare providers can securely access the system with confidence.

👥 Patient Management

Complete patient care coordination

Comprehensive patient management system with profiles, appointment history, treatment records, and care coordination. Healthcare providers can efficiently manage patient care and track treatment progress.

🏥 Healthcare Features

Appointment scheduling, symptom checking, medication management

The system includes comprehensive healthcare features for appointment scheduling, AI-powered symptom checking, medication reminders, medical database access, secure patient records, and HIPAA compliance monitoring.

💡 Healthcare Features: All features are designed for healthcare environments with HIPAA compliance. The system supports secure patient-provider communication, appointment management, and comprehensive medical record keeping.

💻 Code Examples

Basic Healthcare Assistant Bot Integration

# Flask Healthcare Assistant Bot - app.py from flask import Flask, render_template, request, jsonify, redirect, url_for, session, flash from database import init_db, add_user, get_user_by_username from appointments import schedule_appointment from symptoms import check_symptoms from reminders import set_reminder from werkzeug.security import generate_password_hash, check_password_hash app = Flask(__name__) app.secret_key = 'your_secret_key' # Change this to a strong secret key # Initialize the database init_db() @app.route('/') def index(): if 'username' not in session: return redirect(url_for('login')) return render_template('index.html', username=session['username']) @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] user = get_user_by_username(username) if user and check_password_hash(user[3], password): session['username'] = user[1] session['role'] = user[4] flash('Login successful!', 'success') return redirect(url_for('index')) else: flash('Login failed. Please check your username and password.', 'danger') return render_template('login.html') @app.route('/chat', methods=['POST']) def chat(): if 'username' not in session: return jsonify({'response': 'Please login to use the chat.'}), 401 user_message = request.json.get('message') # NLP and intent recognition if 'schedule an appointment' in user_message.lower(): response = schedule_appointment('2024-01-15', '10:00', 'General Checkup') elif 'symptoms of' in user_message.lower(): symptoms = user_message.split("symptoms of")[1].strip() response = check_symptoms(symptoms) elif 'remind me to take' in user_message.lower(): response = set_reminder('Medicine', '08:00') else: response = "I am a healthcare assistant bot. You can ask me to schedule an appointment, check your symptoms, or set a medication reminder." return jsonify({'response': response}) if __name__ == '__main__': app.run(debug=True)

Healthcare Module Example

# Python example - Appointments Module from database import add_appointment def schedule_appointment(date, time, description=""): """ Schedules a new appointment. """ add_appointment(date, time, description) return f"Your appointment for {description} is scheduled on {date} at {time}." # Usage in Flask route @app.route('/schedule', methods=['POST']) def schedule(): if 'username' not in session: return jsonify({'error': 'Please login first'}), 401 data = request.json date = data.get('date') time = data.get('time') description = data.get('description', 'General Checkup') result = schedule_appointment(date, time, description) return jsonify({'message': result})

Complete Healthcare Assistant App Example

# Complete Flask Healthcare Assistant Application from flask import Flask, render_template, request, jsonify, session, redirect, url_for, flash from database import init_db, add_user, get_user_by_username, get_all_appointments, get_all_reminders from appointments import schedule_appointment from symptoms import check_symptoms from reminders import set_reminder from werkzeug.security import generate_password_hash, check_password_hash from functools import wraps app = Flask(__name__) app.secret_key = 'your_secret_key_here' # Change to strong secret key # Initialize database init_db() # Admin decorator def admin_required(f): @wraps(f) def decorated_function(*args, **kwargs): if 'username' not in session: flash('Please login to access this page.', 'warning') return redirect(url_for('login')) user = get_user_by_username(session['username']) if user and user[4] != 'admin': flash('You do not have administrative privileges.', 'danger') return redirect(url_for('index')) return f(*args, **kwargs) return decorated_function @app.route('/') def index(): if 'username' not in session: return redirect(url_for('login')) return render_template('index.html', username=session['username']) @app.route('/admin') @admin_required def admin_dashboard(): appointments = get_all_appointments() reminders = get_all_reminders() return render_template('admin.html', appointments=appointments, reminders=reminders) @app.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': username = request.form['username'] email = request.form['email'] password = request.form['password'] hashed_password = generate_password_hash(password, method='pbkdf2:sha256') try: add_user(username, email, hashed_password) flash('Registration successful! Please login.', 'success') return redirect(url_for('login')) except Exception as e: flash(f'Registration failed: {e}', 'danger') return render_template('register.html') @app.route('/chat', methods=['POST']) def chat(): if 'username' not in session: return jsonify({'response': 'Please login to use the chat.'}), 401 user_message = request.json.get('message') # Healthcare query processing if 'schedule an appointment' in user_message.lower(): response = schedule_appointment('2024-01-15', '10:00', 'General Checkup') elif 'symptoms of' in user_message.lower(): symptoms = user_message.split("symptoms of")[1].strip() response = check_symptoms(symptoms) elif 'remind me to take' in user_message.lower(): response = set_reminder('Medicine', '08:00') else: response = "I am a healthcare assistant. You can ask me to schedule an appointment, check your symptoms, or set a medication reminder." return jsonify({'response': response}) if __name__ == '__main__': app.run(debug=True)

Configuration Example

# Bot config - config.py import os class Config: SLACK_BOT_TOKEN = os.getenv('SLACK_BOT_TOKEN') ADMIN_ID = int(os.getenv('ADMIN_ID', 0)) DATABASE_PATH = 'bot.db' OPENAI_API_KEY = os.getenv('OPENAI_API_KEY', '') # Optional WEATHER_API_KEY = os.getenv('WEATHER_API_KEY', '') # Optional # Bot settings MAX_MESSAGE_LENGTH = 4096 COMMAND_PREFIX = '/' ENABLE_LOGGING = True
# .env file example SLACK_BOT_TOKEN=your_bot_token_here ADMIN_ID=123456789 OPENAI_API_KEY=sk-your-key-here # Optional WEATHER_API_KEY=your_weather_key # Optional

🔗 Healthcare Assistant Bot API Integration

Healthcare Assistant Bot API Integration

The application provides healthcare API integration through Flask. The backend uses Python with Flask framework to handle healthcare queries and patient management, while the frontend uses Jinja2 templates for the web interface.

Available APIs & Technologies

API/Technology Type Description
Flask API Web Framework Python framework for healthcare web applications
NLP Processing AI/ML Natural language processing for healthcare queries
SQLite Database Lightweight database for user data and statistics
Medical Database Healthcare Comprehensive medical information and drug database
HIPAA Compliance Security Healthcare data privacy and security standards

Bot Command Handlers

# Python Healthcare Assistant - Flask Routes from flask import Flask, render_template, request, jsonify, session app = Flask(__name__) @app.route('/') def home(): """Handle home page""" if 'username' not in session: return render_template('login.html') return render_template('index.html', username=session['username']) @app.route('/help') def help_page(): """Handle help page""" features = """ Available features: - Appointment scheduling - Symptom checking - Medication reminders - Admin dashboard - User authentication """ return render_template('help.html', features=features) @app.route('/api/healthcare', methods=['POST']) def healthcare_api(): """Handle healthcare API requests""" data = request.json message = data.get('message', '') if 'appointment' in message.lower(): response = {'status': 'success', 'message': 'Appointment scheduled'} elif 'symptom' in message.lower(): response = {'status': 'success', 'advice': 'Please consult a healthcare professional'} elif 'remind' in message.lower(): response = {'status': 'success', 'message': 'Medication reminder set'} else: response = {'status': 'info', 'message': 'I can help with appointments, symptoms, and reminders'} return jsonify(response)
# Python example - Flask Route for Healthcare Actions from flask import Flask, render_template, request, jsonify app = Flask(__name__) @app.route('/healthcare-actions') def healthcare_actions(): actions = [ {'name': 'Schedule Appointment', 'url': '/schedule'}, {'name': 'Check Symptoms', 'url': '/symptoms'}, {'name': 'Set Reminder', 'url': '/reminders'} ] return render_template('actions.html', actions=actions) @app.route('/api/healthcare/', methods=['POST']) def handle_action(action): if action == 'schedule': # Handle appointment scheduling return jsonify({'status': 'success', 'message': 'Appointment scheduled'}) elif action == 'symptoms': # Handle symptom checking return jsonify({'status': 'success', 'advice': 'Please consult a doctor'}) elif action == 'reminders': # Handle medication reminders return jsonify({'status': 'success', 'message': 'Reminder set'}) else: return jsonify({'status': 'error', 'message': 'Unknown action'})

Flask Application Setup

# Check Flask Application Setup from flask import Flask import os import sqlite3 def check_flask_setup(): app = Flask(__name__) app.secret_key = os.getenv('SECRET_KEY', 'default_secret_key') # Check if database exists and has tables try: conn = sqlite3.connect('healthcare.db') c = conn.cursor() c.execute("SELECT name FROM sqlite_master WHERE type='table'") tables = c.fetchall() conn.close() if len(tables) >= 3: # users, appointments, reminders print("Database setup complete with all tables") return True else: print(f"Database found but only {len(tables)} tables. Run app.py to initialize.") return False except Exception as e: print(f"Database error: {e}") return False # Recommended setup: # - Backend: Python 3.8+ with Flask Framework # - Database: SQLite for healthcare data # - Frontend: Jinja2 templates for Flask web interface # - Security: Werkzeug for password hashing

⚙️ Configuration

Configuration in this application is handled through environment variables and settings files:

Environment Variables

Create a .env file in the project root (copy from env.example):

# .env file SLACK_BOT_TOKEN=your_bot_token_here ADMIN_ID=123456789 OPENAI_API_KEY=sk-your-key-here # Optional for /ai command WEATHER_API_KEY=your_weather_key # Optional for /weather command

Note: The Flask application uses a secret key for session management. For production deployment, set a strong secret key in the app.secret_key variable.

Python Configuration (config.py)

The config.py file contains configuration settings:

# config.py import os class Config: SLACK_BOT_TOKEN = os.getenv('SLACK_BOT_TOKEN') ADMIN_ID = int(os.getenv('ADMIN_ID', 0)) DATABASE_PATH = 'bot.db' OPENAI_API_KEY = os.getenv('OPENAI_API_KEY', '') # Optional WEATHER_API_KEY = os.getenv('WEATHER_API_KEY', '') # Optional # Bot settings MAX_MESSAGE_LENGTH = 4096 COMMAND_PREFIX = '/' ENABLE_LOGGING = True

Database Configuration

The bot uses SQLite database for user data:

# database.py import sqlite3 class Database: def __init__(self, db_path='bot.db'): self.conn = sqlite3.connect(db_path) self.create_tables() def create_tables(self): cursor = self.conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS users ( user_id INTEGER PRIMARY KEY, username TEXT, first_name TEXT, xp INTEGER DEFAULT 0, level INTEGER DEFAULT 1 ) ''') self.conn.commit()

Runtime Configuration

Configure bot settings through environment variables or config file:

  • Flask Secret Key: Required - Set strong secret key for session security
  • Database: SQLite database created automatically on first run
  • OpenAI API Key: Optional - For /ai command functionality
  • Weather API Key: Optional - For /weather command functionality
  • Database Path: SQLite database file path (default: bot.db)
  • Logging: Enable/disable bot logging

All settings are configured through environment variables or config.py file.

📁 Project Structure

healthcare-assistant-bot
healthcare-assistant-bot/
├── app.py              # Main Flask application with routes and chat logic
├── appointments.py     # Appointment scheduling functionality
├── database.py         # SQLite database operations and table creation
├── reminders.py        # Medication reminder management
├── symptoms.py         # Symptom checking with rule-based analysis
├── requirements.txt    # Python dependencies (Flask, Werkzeug)
├── Dockerfile          # Docker container configuration
├── README.md           # Project documentation and setup guide
├── RELEASE_NOTES.md    # Release notes and version history
├── LICENSE             # MIT License file
├── image_prompts.txt   # Image generation prompts (if used)
├── static/             # Static assets (CSS, JS)
│   ├── css/
│   │   └── style.css   # Application styling
│   └── js/
│       └── script.js   # Frontend JavaScript functionality
└── templates/          # Jinja2 HTML templates
    ├── index.html      # Main chat interface
    ├── login.html      # User login page
    ├── register.html   # User registration page
    └── admin.html      # Admin dashboard for viewing data

Note: The Flask application uses a secret key for session management. For production deployment, set a strong secret key in the app.secret_key variable.

📄 Detailed File Descriptions

🌐 app.py

Purpose: Main Flask application file containing all routes, authentication logic, and chat processing.

Key Features:

  • Flask application initialization
  • User authentication routes (login/register)
  • Chat endpoint with healthcare query processing
  • Admin route protection with role-based access
  • Session management for user state
  • Natural language processing with regex patterns

📅 appointments.py

Purpose: Handles appointment scheduling functionality for the healthcare assistant.

Key Features:

  • Appointment creation with date and time
  • Description field for appointment details
  • Database integration for persistent storage
  • Simple scheduling logic
  • Appointment confirmation responses

💊 reminders.py

Purpose: Manages medication reminders and scheduling functionality.

Key Features:

  • Medication reminder creation
  • Time-based scheduling
  • Database storage for reminders
  • User-specific reminder management
  • Automated reminder responses

🩺 symptoms.py

Purpose: Provides rule-based symptom analysis for basic healthcare guidance.

Key Features:

  • Pattern matching for common symptoms
  • Rule-based health recommendations
  • Emergency condition detection
  • Non-diagnostic disclaimer messages
  • Healthcare professional referral suggestions

💾 database.py

Purpose: SQLite database management for all application data storage and retrieval.

Key Features:

  • Database table creation (users, appointments, reminders)
  • User account management functions
  • Appointment data operations
  • Reminder data operations
  • Admin data retrieval functions

📱 templates/index.html

Purpose: Main chat interface template rendered by Flask for user interactions.

Key Features:

  • Real-time chat interface
  • User message input form
  • Message history display
  • Responsive web design
  • Javascript for dynamic interactions

📱 templates/admin.html

Purpose: Admin dashboard template for viewing appointments and reminders data.

Key Features:

  • Appointment data table display
  • Medication reminders table
  • Admin-only access control
  • Simple data visualization
  • Logout functionality

🔐 templates/login.html

Purpose: User authentication login page template.

Key Features:

  • Username/password input fields
  • Form validation
  • Session-based authentication
  • Registration page link
  • Flash message display

📝 templates/register.html

Purpose: User registration page template for creating new accounts.

Key Features:

  • Username, email, password fields
  • Form validation
  • Password security requirements
  • Login page link
  • Success/error message display

🎨 static/css/style.css

Purpose: CSS stylesheet for the Flask web application interface.

Key Features:

  • Modern responsive design
  • Chat interface styling
  • Form and button styles
  • Table and layout styling
  • Mobile-friendly design

⚙️ static/js/script.js

Purpose: JavaScript file for dynamic frontend functionality.

Key Features:

  • Chat message handling
  • AJAX requests to Flask backend
  • Form submission handling
  • Dynamic UI updates
  • Real-time chat functionality

🐳 Dockerfile

Purpose: Docker container configuration for easy deployment.

Key Features:

  • Python environment setup
  • Flask application deployment
  • Dependency installation
  • Port configuration
  • Container optimization

📊 File Statistics

18
Total Files
5
Python Core Files
4
HTML Templates
800+
Lines of Code
8
Core Features
3
Chat Commands

📌 File Organization

Core Application: app.py (main Flask application)

Healthcare Modules: appointments.py, reminders.py, symptoms.py (business logic)

Data Layer: database.py (SQLite database operations)

Web Templates: templates/index.html, templates/login.html, templates/register.html, templates/admin.html

Static Assets: static/css/style.css, static/js/script.js

Configuration: requirements.txt, Dockerfile, LICENSE, README.md, RELEASE_NOTES.md

Full-Stack: Python Flask Web Application + SQLite Database + Jinja2 Templates

🚀 Implemented Features Details

1. User Authentication System

Secure registration and login system

Complete user authentication system with registration, login, and logout functionality. Supports role-based access control with separate user and admin roles. Passwords are securely hashed using Werkzeug security library for Flask applications.

2. Appointment Scheduling

Schedule and manage healthcare appointments

Simple appointment scheduling system that allows users to book appointments with date and time. Appointments are stored in SQLite database and can be viewed in the admin dashboard. Supports natural language date/time parsing in the chat interface.

3. Symptom Checker

Basic symptom analysis and health guidance

Rule-based symptom checker that provides preliminary health guidance for common symptoms. Analyzes combinations like "headache and fever" or "cough and sore throat" to provide appropriate recommendations. Always advises consulting healthcare professionals for proper diagnosis.

4. Medication Reminders

Set medication reminders and schedules

Medication reminder system that allows users to set reminders for specific medications at designated times. Reminders are stored in the database and can be viewed by administrators for patient care coordination and medication adherence monitoring.

5. Admin Dashboard

Administrative interface for healthcare management

Admin dashboard that displays all appointments and medication reminders in simple tabular format. Allows healthcare administrators to monitor patient schedules and medication compliance. Requires admin role authentication for access.

6. Chat Interface

Interactive chat interface with healthcare assistant

Web-based chat interface that allows authenticated users to interact with the healthcare assistant. Supports natural language queries for appointment scheduling, symptom checking, and medication reminders through pattern matching.

7. SQLite Database

Lightweight database for healthcare data storage

SQLite database that stores user accounts, appointments, and medication reminders. Provides reliable data persistence for the healthcare assistant bot with proper table relationships and data integrity constraints.

8. Flask Web Framework

Python web framework for healthcare applications

Flask micro-framework provides the web interface and API endpoints for the healthcare assistant. Handles routing, templates, user sessions, and JSON responses for both web interface and chat functionality.

💡 Current Implementation: This healthcare assistant bot provides core functionality for patient appointment scheduling, basic symptom checking, medication reminders, and administrative oversight. The system uses simple NLP pattern matching and rule-based responses for healthcare assistance. It's designed as a foundation that can be extended with advanced AI/ML features, comprehensive medical databases, HIPAA compliance, and additional healthcare integrations.

🔧 Troubleshooting

Bot Token Issues

  • Ensure your .env file contains a valid SLACK_BOT_TOKEN
  • Configure Flask secret key in app.py for session security
  • Check that the bot token is correctly formatted and not expired
  • Make sure the .env file is in the project root directory
  • Restart the bot after updating the token

Bot Not Starting Issues

  • Bot not starting: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt
  • Import errors: Ensure virtual environment is activated, reinstall dependencies
  • Connection errors: Check if Flask app is running and accessible on correct port
  • Token errors: Verify bot token is valid and bot is not blocked
  • Database errors: Check SQLite database permissions and file path

Command Issues

  • Commands not working: Ensure handlers are properly registered in bot.py
  • Command not found: Check command spelling and ensure it's registered
  • Permission errors: Verify admin commands are restricted to admin users
  • API errors: Check optional API keys (OpenAI, Weather) if using /ai or /weather commands

Common Issues

  • Bot token not found: Create .env file from env.example and add your bot token
  • Module not found: Install dependencies with pip install -r requirements.txt
  • Database errors: Check SQLite database file permissions and path
  • File handling errors: Check file size limits and supported formats
  • Dashboard not loading: Verify Flask app is running and admin route is accessible

📋 Requirements

Core Requirements: - Python 3.8 or higher - Flask web framework - SQLite database (built-in with Python) - Werkzeug security library (included with Flask) - Modern web browser (Chrome, Edge, Safari, Firefox) Project Dependencies (see requirements.txt): - Flask==2.3.3 - Werkzeug==2.3.7 Optional Dependencies: None required - all functionality uses built-in Python features System Requirements: - Operating System: Windows, macOS, or Linux - RAM: 256MB minimum - Storage: 10MB for application and database - Network: Local access (no internet required for core functionality)

Browser Compatibility: Chrome, Edge, Safari, or Firefox for admin dashboard.

Python Version: Python 3.8 or higher required for bot server.

Web Browser: Modern browser required for accessing the Flask web interface.

🎯 Use Cases

💻 Code Assistance

Get help with coding, debugging, and programming questions

📚 Education & Learning

Learn new concepts, get explanations, and study assistance

📊 Content Analysis

Analyze documents, summarize text, and extract key information

🧮 Problem Solving

Solve complex problems, math equations, and reasoning tasks

✍️ Content Creation

Writing assistance, creative content, and text generation

💬 Customer Support

Build intelligent customer support chatbots and assistants

📎 Document Analysis

Upload and analyze images, PDFs, and documents

🌐 Web Integration

Integrate Flask healthcare application into existing medical systems

💬 Support

For support, questions, or more projects:

📄 License

This project is provided as-is for educational and development purposes.

MIT License - See LICENSE file for details.

📂 Demo Folder Structure

The demo/ folder contains demonstration and documentation files for this project.

demo/ ├── index.html # This comprehensive documentation page ├── demo.html # Interactive demo interface for testing Healthcare Assistant Bot ├── style.css # CSS styling for documentation and demo └── script.js # JavaScript for scroll, navigation, and interactions
Try Interactive Demo

📄 Demo Files Description

📄 index.html

Purpose: Comprehensive project documentation and information page. This HTML file contains all details about the Healthcare Assistant Bot project.

Contents:

  • Complete project overview
  • All features documentation
  • Installation instructions
  • Usage examples
  • Code examples
  • Flask web application and healthcare API reference
  • Configuration details
  • Detailed file and folder descriptions
  • Project structure
  • Troubleshooting guide
  • Support information

Features:

  • Self-contained HTML with external CSS
  • Responsive design
  • Modern, beautiful UI
  • Well-organized sections
  • Easy navigation with smooth scrolling

🎨 style.css

Purpose: CSS stylesheet file with modern styling for the documentation page.

Features:

  • Modern gradient backgrounds
  • Responsive design
  • Beautiful typography
  • Smooth animations
  • Sticky navigation
  • Scroll progress bar

📜 script.js

Purpose: JavaScript file with interactive features for the documentation page.

Features:

  • Scroll progress bar
  • Back to top button
  • Smooth scrolling navigation
  • Active navigation highlighting
  • Copy to clipboard functionality

🎮 demo.html

Purpose: Interactive demo interface showcasing Healthcare Assistant Bot features.

Features:

  • Interactive chat interface
  • Sample Healthcare Assistant Bot responses
  • Quick action buttons
  • Feature showcase panel
  • Statistics tracking
  • Beautiful, responsive UI
  • Demo message types (code, explain, creative, math, etc.)

Usage: Open demo.html in your browser to try the interactive demo!

💡 About the Demo Folder

The demo/ folder contains demonstration and documentation files for the Healthcare Assistant Bot project:

  • Documentation: index.html - Comprehensive HTML documentation page explaining the entire project
  • Interactive Demo: demo.html - Live interactive demo showcasing Healthcare Assistant Bot features
  • Styling: style.css - CSS stylesheet with modern design
  • Scripts: script.js - JavaScript for scroll, navigation, and interactive features

Note: To view the documentation, open demo/index.html in your browser. To try the interactive demo, open demo.html. Both pages are self-contained and work independently.