Skip to content

Commit 94c61dd

Browse files
committed
chore: clean up codebase and enhance documentation
1 parent f613d79 commit 94c61dd

32 files changed

+2340
-734
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ env/
2222
venv/
2323
*.egg-info/
2424
.cache/
25+
remove_comments_script.js
26+
remove_comments_script.cjs

README.md

Lines changed: 69 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,111 @@
1-
# EdCare · Hospital Management System
1+
# EdCare - Advanced Healthcare Management System
22

3-
**EdCare** is a production-grade, full-stack hospital management platform designed to bridge the gap between patients, doctors, and healthcare services. It integrates intelligent appointment scheduling, AI-powered disease diagnostics, a digital pharmacy, and comprehensive medical record management into a single, cohesive ecosystem.
3+
![EdCare Banner](https://img.shields.io/badge/EdCare-Healthcare_Reimagined-blue?style=for-the-badge)
4+
![React](https://img.shields.io/badge/React_19-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
5+
![Vite](https://img.shields.io/badge/Vite_6-646CFF?style=for-the-badge&logo=vite&logoColor=white)
6+
![TailwindCSS](https://img.shields.io/badge/Tailwind_4-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white)
7+
![Supabase](https://img.shields.io/badge/Supabase-3ECF8E?style=for-the-badge&logo=supabase&logoColor=white)
8+
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
49

5-
Built with performance, scalability, and user experience at its core, EdCare leverages modern web technologies to deliver a seamless healthcare experience.
10+
## Overview
11+
12+
**EdCare** is a state-of-the-art healthcare management platform designed to bridge the gap between patients and medical professionals. Built with performance, security, and user experience in mind, EdCare provides a seamless interface for appointment booking, prescription management, and real-time health monitoring.
613

714
---
815

916
## 🚀 Key Features
1017

11-
### 🏥 **Role-Based Portals**
12-
- **Patient Portal**: Dashboard for Appointment booking, Medical History, Prescriptions, and Lab Reports.
13-
- **Doctor Portal**: Dashboard for Patient Management, Prescription Writing (Rx), Schedule Management, and Digital Consultations.
14-
15-
### 🧠 **AI & Machine Learning**
16-
- **Breast Cancer Risk Assessment**: Integrated Machine Learning model (Gradient Boosting Classifier) trained on the WDBC dataset.
17-
- **Real-time Inference**: Python/Flask backend provides instant risk analysis based on 30 clinical features from FNA biopsies.
18-
19-
### 💊 **Digital Pharmacy**
20-
- **E-Commerce Experience**: Full-featured product catalog with categories (Medicines, Supplements, Devices).
21-
- **Cart Management**: Persistent shopping cart with real-time total calculation.
22-
- **Checkout Flow**: Multi-step checkout process (Shipping -> Payment -> Confirmation).
18+
### For Patients
19+
- **Smart Dashboard**: Comprehensive overview of health metrics and upcoming appointments.
20+
- **Instant Booking**: Real-time appointment scheduling with specialists.
21+
- **E-Prescriptions**: Access and manage prescriptions digitally.
22+
- **Secure Records**: Encrypted storage for all medical history and diagnostics.
2323

24-
### 📅 **Smart Scheduling**
25-
- **Interactive Calendar**: Visual appointment management for doctors.
26-
- **Booking Engine**: Easy slot selection and booking for patients.
27-
28-
### 🔐 **Security & Infrastructure**
29-
- **Authentication**: Secure role-based auth powered by **Supabase Auth**.
30-
- **Database**: Robust PostgreSQL Relational Database via **Supabase**.
31-
- **Edge Performance**: Optimized for speed with Vite and React Query.
24+
### For Doctors
25+
- **Practice Management**: Efficiently handle patient queues and schedules.
26+
- **Digital Prescribing**: Issue prescriptions instantly with built-in drug interaction checks.
27+
- **Patient Analytics**: Visual insights into patient health trends.
28+
- **Consultation Tools**: Integrated tools for better diagnosis and care delivery.
3229

3330
---
3431

3532
## 🛠️ Technology Stack
3633

37-
### **Frontend**
38-
- **Framework**: [React 18](https://react.dev/)
34+
This project is built using a modern, robust tech stack:
35+
36+
- **Frontend Framework**: [React 19](https://react.dev/)
3937
- **Build Tool**: [Vite](https://vitejs.dev/)
38+
- **Styling**: [TailwindCSS v4](https://tailwindcss.com/)
4039
- **Language**: [TypeScript](https://www.typescriptlang.org/)
41-
- **Styling**: [Tailwind CSS v4](https://tailwindcss.com/)
42-
- **State Management**: React Context + [TanStack Query](https://tanstack.com/query/latest)
43-
- **Forms**: [React Hook Form](https://react-hook-form.com/) + [Zod](https://zod.dev/)
44-
- **Icons**: [Lucide React](https://lucide.dev/)
45-
- **Charts**: [Recharts](https://recharts.org/)
46-
47-
### **Backend (AI Services)**
48-
- **Framework**: [Flask](https://flask.palletsprojects.com/) (Python)
49-
- **ML Library**: [Scikit-learn](https://scikit-learn.org/)
50-
- **CORS**: Flask-CORS for secure cross-origin requests.
51-
52-
### **Infrastructure**
53-
- **Database**: PostgreSQL (Supabase)
54-
- **Authentication**: Supabase Auth
55-
- **Storage**: Supabase Storage
40+
- **Backend / Database**: [Supabase](https://supabase.com/)
41+
- **State Management**: React Context & Hooks
42+
- **Icons**: Lucide React
43+
- **Validation**: Zod + React Hook Form
5644

5745
---
5846

5947
## 📂 Project Structure
6048

61-
```
62-
_EDCARE_/
49+
```bash
50+
_EDCARE_
6351
├── src/
64-
│ ├── components/ # Reusable UI components (Buttons, Cards, Sheets)
65-
│ ├── contexts/ # Global state (Auth, Cart)
66-
│ ├── lib/ # Utilities and Supabase client
67-
│ ├── pages/ # Route components
68-
│ │ ├── public/ # Landing, Login, Signup
69-
│ │ ├── patient/ # Patient dashboard pages
70-
│ │ ├── doctor/ # Doctor dashboard pages
71-
│ │ └── pharmacy/ # E-commerce pages
72-
│ ├── types/ # TypeScript definitions
73-
│ ├── App.tsx # Main Router configuration
74-
│ └── main.tsx # Entry point
75-
├── backend/ # Python Flask ML Service
76-
│ └── app.py # AI Inference API
77-
├── sql/ # Database Schema
78-
│ └── schema.sql # Supabase SQL definitions
79-
└── README.md # Documentation
52+
│ ├── components/ # Reusable UI components (Buttons, Modals, etc.)
53+
│ ├── contexts/ # Global state management contexts
54+
│ ├── lib/ # Utility functions and Supabase client
55+
│ ├── pages/ # Application routes (Doctor, Patient, Public)
56+
│ ├── types/ # TypeScript definitions
57+
│ ├── App.tsx # Main application component
58+
│ └── main.tsx # Entry point
59+
├── backend/ # Backend logic (Edge Functions)
60+
├── sql/ # Database schemas and migration scripts
61+
├── public/ # Static assets
62+
└── dist/ # Production build output
8063
```
8164

8265
---
8366

84-
## Getting Started
67+
## 🏁 Getting Started
8568

8669
### Prerequisites
87-
- Node.js (v18+)
88-
- Python (v3.9+)
70+
- Node.js (v18 or higher)
8971
- npm or yarn
9072

91-
### 1. Setup Frontend
92-
```bash
93-
# Install dependencies
94-
npm install
95-
96-
# Start Development Server
97-
npm run dev
98-
```
99-
The application will be available at `http://localhost:5173`.
73+
### Installation
10074

101-
### 2. Setup AI Backend
102-
```bash
103-
cd backend
75+
1. **Clone the repository**
76+
```bash
77+
git clone https://github.com/CypherXXXX/_edcare_.git
78+
cd _edcare_
79+
```
10480

105-
# Create virtual environment (optional but recommended)
106-
python -m venv venv
107-
# Windows
108-
venv\Scripts\activate
109-
# Mac/Linux
110-
source venv/bin/activate
81+
2. **Install dependencies**
82+
```bash
83+
npm install
84+
```
11185

112-
# Install dependencies
113-
pip install flask flask-cors scikit-learn numpy
86+
3. **Environment Setup**
87+
Create a `.env` file in the root directory and add your Supabase credentials:
88+
```env
89+
VITE_SUPABASE_URL=your_supabase_url
90+
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
91+
```
11492

115-
# Run Flask Server
116-
python app.py
117-
```
118-
The AI API will run on `http://127.0.0.1:5000`.
93+
4. **Database Setup**
94+
Run the SQL scripts located in the `sql/` folder or `supabase_setup.sql` in your Supabase SQL Editor to initialize the database schema.
11995

120-
### 3. Database Setup (Supabase)
121-
1. Go to your [Supabase Dashboard](https://supabase.com).
122-
2. Open the **SQL Editor**.
123-
3. Copy the contents of `sql/schema.sql`.
124-
4. Run the query to create tables, policies, and triggers.
96+
5. **Run the application**
97+
```bash
98+
npm run dev
99+
```
125100

126101
---
127102

128-
## 🛡️ License
103+
## 📄 License
129104

130105
This project is licensed under the MIT License.
131106

132107
---
133108

134-
© 2026 EdCare. Built for the future of healthcare.
109+
<p align="center">
110+
Built with ❤️ by the EdCare Team
111+
</p>

sql/02_enhanced_schema.sql

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
3+
4+
5+
CREATE TABLE IF NOT EXISTS public.doctor_schedules (
6+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
7+
doctor_id UUID NOT NULL REFERENCES public.doctors(id) ON DELETE CASCADE,
8+
date DATE NOT NULL,
9+
start_time TIME NOT NULL,
10+
end_time TIME NOT NULL,
11+
is_available BOOLEAN DEFAULT TRUE,
12+
created_at TIMESTAMPTZ DEFAULT NOW(),
13+
UNIQUE(doctor_id, date, start_time)
14+
);
15+
16+
17+
CREATE TABLE IF NOT EXISTS public.notifications (
18+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
19+
user_id UUID NOT NULL REFERENCES public.profiles(id) ON DELETE CASCADE,
20+
title TEXT NOT NULL,
21+
message TEXT NOT NULL,
22+
type TEXT CHECK (type IN ('info', 'warning', 'success', 'error')) DEFAULT 'info',
23+
is_read BOOLEAN DEFAULT FALSE,
24+
link TEXT,
25+
created_at TIMESTAMPTZ DEFAULT NOW()
26+
);
27+
28+
29+
CREATE TABLE IF NOT EXISTS public.reviews (
30+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
31+
doctor_id UUID NOT NULL REFERENCES public.doctors(id) ON DELETE CASCADE,
32+
patient_id UUID NOT NULL REFERENCES public.profiles(id) ON DELETE CASCADE,
33+
rating INTEGER CHECK (rating >= 1 AND rating <= 5),
34+
comment TEXT,
35+
created_at TIMESTAMPTZ DEFAULT NOW()
36+
);
37+
38+
39+
CREATE TABLE IF NOT EXISTS public.medical_records (
40+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
41+
patient_id UUID NOT NULL REFERENCES public.profiles(id) ON DELETE CASCADE,
42+
doctor_id UUID REFERENCES public.doctors(id) ON DELETE SET NULL,
43+
record_type TEXT CHECK (record_type IN ('diagnosis', 'allergy', 'surgery', 'immunization', 'history', 'lab_result', 'prescription')),
44+
title TEXT NOT NULL,
45+
description TEXT,
46+
date DATE DEFAULT CURRENT_DATE,
47+
attachments TEXT[],
48+
created_at TIMESTAMPTZ DEFAULT NOW()
49+
);
50+
51+
52+
CREATE TABLE IF NOT EXISTS public.payments (
53+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
54+
amount NUMERIC(10, 2) NOT NULL,
55+
status TEXT CHECK (status IN ('pending', 'completed', 'failed', 'refunded')) DEFAULT 'pending',
56+
provider TEXT NOT NULL,
57+
transaction_id TEXT,
58+
order_id BIGINT REFERENCES public.orders(id) ON DELETE SET NULL,
59+
appointment_id BIGINT REFERENCES public.appointments(id) ON DELETE SET NULL,
60+
created_at TIMESTAMPTZ DEFAULT NOW()
61+
);
62+
63+
64+
65+
66+
ALTER TABLE public.doctor_schedules ENABLE ROW LEVEL SECURITY;
67+
CREATE POLICY "Doctors can manage their own schedules" ON public.doctor_schedules FOR ALL USING (auth.uid() = doctor_id);
68+
CREATE POLICY "Everyone can view schedules" ON public.doctor_schedules FOR SELECT USING (true);
69+
70+
71+
ALTER TABLE public.notifications ENABLE ROW LEVEL SECURITY;
72+
CREATE POLICY "Users view their own notifications" ON public.notifications FOR SELECT USING (auth.uid() = user_id);
73+
74+
75+
ALTER TABLE public.reviews ENABLE ROW LEVEL SECURITY;
76+
CREATE POLICY "Reviews are public" ON public.reviews FOR SELECT USING (true);
77+
CREATE POLICY "Patients can create reviews" ON public.reviews FOR INSERT WITH CHECK (auth.uid() = patient_id);
78+
79+
80+
ALTER TABLE public.medical_records ENABLE ROW LEVEL SECURITY;
81+
CREATE POLICY "Patients view own records" ON public.medical_records FOR SELECT USING (auth.uid() = patient_id);
82+
CREATE POLICY "Doctors view assigned records" ON public.medical_records FOR SELECT USING (auth.uid() = doctor_id);
83+
84+
85+
ALTER TABLE public.payments ENABLE ROW LEVEL SECURITY;
86+
CREATE POLICY "Users view own payments" ON public.payments FOR SELECT USING (
87+
auth.uid() IN (
88+
SELECT user_id FROM public.orders WHERE id = payments.order_id
89+
UNION
90+
SELECT user_id FROM public.appointments WHERE id = payments.appointment_id
91+
)
92+
);

sql/03_refinements.sql

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
ALTER TABLE public.departments ENABLE ROW LEVEL SECURITY;
3+
4+
5+
CREATE POLICY "Publicly visible departments" ON public.departments FOR SELECT USING (true);
6+
7+
8+
9+
10+
11+
12+
CREATE TABLE IF NOT EXISTS public.messages (
13+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
14+
sender_id UUID NOT NULL REFERENCES public.profiles(id) ON DELETE CASCADE,
15+
recipient_id UUID NOT NULL REFERENCES public.profiles(id) ON DELETE CASCADE,
16+
content TEXT NOT NULL,
17+
is_read BOOLEAN DEFAULT FALSE,
18+
created_at TIMESTAMPTZ DEFAULT NOW()
19+
);
20+
21+
22+
ALTER TABLE public.messages ENABLE ROW LEVEL SECURITY;
23+
CREATE POLICY "Users can view their own messages" ON public.messages
24+
FOR SELECT USING (auth.uid() = sender_id OR auth.uid() = recipient_id);
25+
CREATE POLICY "Users can send messages" ON public.messages
26+
FOR INSERT WITH CHECK (auth.uid() = sender_id);
27+
28+
29+
30+
CREATE TABLE IF NOT EXISTS public.audit_logs (
31+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
32+
user_id UUID REFERENCES public.profiles(id) ON DELETE SET NULL,
33+
action TEXT NOT NULL,
34+
table_name TEXT NOT NULL,
35+
record_id TEXT,
36+
details JSONB,
37+
created_at TIMESTAMPTZ DEFAULT NOW()
38+
);
39+
40+
ALTER TABLE public.audit_logs ENABLE ROW LEVEL SECURITY;
41+
42+
43+
CREATE POLICY "Admins view audit logs" ON public.audit_logs FOR SELECT USING (false);

sql/04_fix_vitals.sql

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
3+
4+
5+
ALTER TABLE public.vitals
6+
ADD COLUMN IF NOT EXISTS height NUMERIC;
7+
8+
9+
ALTER TABLE public.vitals
10+
ADD COLUMN IF NOT EXISTS weight NUMERIC;
11+
12+
ALTER TABLE public.vitals
13+
ADD COLUMN IF NOT EXISTS temperature NUMERIC;
14+
15+
ALTER TABLE public.vitals
16+
ADD COLUMN IF NOT EXISTS oxygen_saturation INTEGER;
17+
18+
ALTER TABLE public.vitals
19+
ADD COLUMN IF NOT EXISTS heart_rate INTEGER;
20+
21+
ALTER TABLE public.vitals
22+
ADD COLUMN IF NOT EXISTS blood_pressure TEXT;
23+
24+
25+
ALTER TABLE public.vitals ENABLE ROW LEVEL SECURITY;
26+
27+
DO $$
28+
BEGIN
29+
IF NOT EXISTS (
30+
SELECT 1 FROM pg_policies WHERE tablename = 'vitals' AND policyname = 'Patients can manage their own vitals'
31+
) THEN
32+
CREATE POLICY "Patients can manage their own vitals" ON public.vitals
33+
USING (auth.uid() = patient_id)
34+
WITH CHECK (auth.uid() = patient_id);
35+
END IF;
36+
END $$;

0 commit comments

Comments
 (0)