Skip to content

krishnab0841/Clinic_Flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clinic Flow - Healthcare Management System Backend

A comprehensive clinic management system backend API built with FastAPI, providing endpoints for patient management, doctor scheduling, appointment booking, and AI-powered prescription generation.

Features

  • Patient Management: Registration, login, appointment booking
  • Doctor Management: Profile management, schedule setting, appointment viewing
  • Nurse Management: Patient care coordination, appointment assistance
  • AI-Powered Prescriptions: Automated prescription generation using AI
  • Appointment System: Comprehensive booking and management system
  • Authentication: JWT-based secure authentication for all user types
  • Database: PostgreSQL with SQLAlchemy ORM and Alembic migrations

Technology Stack

  • Backend Framework: FastAPI
  • Database: PostgreSQL
  • ORM: SQLAlchemy
  • Migrations: Alembic
  • Authentication: JWT (JSON Web Tokens)
  • AI Integration: Groq and Google Gemini APIs
  • PDF Generation: ReportLab
  • File Processing: PyPDF2, python-docx

Installation & Setup

Prerequisites

  • Python 3.8+
  • PostgreSQL
  • Virtual Environment (recommended)

Setup Instructions

  1. Clone the repository
git clone <repository-url>
cd clinic_flow
  1. Create and activate virtual environment
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Database Setup
  • Create a PostgreSQL database named clinic_flow
  • Update database credentials in .env file
  • Run migrations:
alembic upgrade head
  1. Environment Variables Create a .env file with:
DATABASE_URL=postgresql://username:password@localhost:5432/clinic_flow
SECRET_KEY=your-secret-key-here
GROQ_API_KEY=your-groq-api-key
GEMINI_API_KEY=your-gemini-api-key
  1. Run the application
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000

API Documentation

Once the server is running, visit:

  • Interactive API Docs: http://localhost:8000/docs
  • ReDoc Documentation: http://localhost:8000/redoc

Project Structure

clinic_flow/
├── app/
│   ├── auth/           # Authentication modules
│   ├── core/           # Core security and configuration
│   ├── db/             # Database configuration and models
│   ├── routers/        # API route handlers
│   ├── schemas/        # Pydantic schemas
│   ├── utils/          # Utility functions
│   └── main.py         # FastAPI application entry point
├── alembic/            # Database migrations
├── requirements.txt    # Python dependencies
└── README.md          # This file

Available Endpoints

Authentication (6 endpoints)

  • POST /register/patient - Patient registration
  • POST /register/doctor - Doctor registration
  • POST /register/nurse - Nurse registration
  • POST /login/patient - Patient login
  • POST /login/doctor - Doctor login
  • POST /login/nurse - Nurse login

Patient APIs (5 endpoints)

  • GET /patient/doctors - List available doctors
  • GET /patient/available-slots/{doctor_name} - Get doctor's available slots
  • POST /patient/book-appointment - Book an appointment
  • GET /patient/appointments - View patient appointments
  • GET /patient/prescription/report/{prescription_id} - Download prescription PDF

Doctor APIs (8 endpoints)

  • GET /doctor/profile/{doctor_name} - Get doctor profile
  • PUT /doctor/profile/{name} - Update doctor profile
  • POST /doctor/schedule/{doctor_name} - Set doctor schedule
  • GET /doctor/schedule/{doctor_name} - View doctor schedule
  • GET /doctor/appointments/{doctor_name} - View doctor appointments
  • PUT /doctor/appointment/{appointment_id} - Update appointment
  • POST /doctor/generate-prescription/{doctor_name} - Generate prescription
  • POST /doctor/upload-medical-report/{doctor_name} - Upload medical reports

Nurse APIs (4 endpoints)

  • GET /nurse/profile/{nurse_name} - Get nurse profile
  • GET /nurse/appointments - View all appointments
  • GET /nurse/appointments/{appointment_id} - View specific appointment
  • PUT /nurse/appointments/reassign - Reassign appointments

AI Doctor APIs (4 endpoints)

  • POST /AI_doctor/prescribe - AI prescription generation
  • POST /AI_doctor/check-symptoms - Symptom analysis
  • POST /AI_doctor/generate-prescription - Enhanced prescription generation
  • POST /AI_doctor/upload-report - Process medical reports

Development

Running in Development Mode

uvicorn app.main:app --reload

Database Migrations

# Create new migration
alembic revision --autogenerate -m "Description"

# Apply migrations
alembic upgrade head

# Rollback migration
alembic downgrade -1

License

MIT License - see LICENSE file for details.

About

Clinic Flow is a backend healthcare management system built with FastAPI, designed to simplify and automate patient appointment booking, doctor scheduling, and nurse coordination — all under a secure, role-based access system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors