source: README.md@ 48d2bed

Last change on this file since 48d2bed was 48d2bed, checked in by MBK <marija.karapandzova@…>, 4 days ago

Remote database setup, fixed models and application properties

  • Property mode set to 100644
File size: 8.4 KB
RevLine 
[99ab276]1# Medora - Medical Records Management System
2
3Medora is a comprehensive healthcare management platform designed to streamline patient medical records, appointments, laboratory tests, prescriptions, and billing operations.
4
5## Features
6
7- **Patient Management** - Create and manage patient profiles with EMBG (personal identification number)
8- **Medical Records** - Access comprehensive patient medical histories including diagnoses, symptoms, allergies, and prescriptions
9- **Appointments** - Schedule and manage doctor-patient appointments
10- **Lab Tests** - Request and track laboratory test results
11- **Prescriptions** - Manage medication prescriptions for patients
12- **Doctor Management** - Manage doctor profiles and specializations
13- **Billing** - Generate and track billing records for medical services
14- **User Authentication** - Secure JWT-based authentication with role-based access control (Admin, Doctor, Patient, Lab Technician, Billing Admin)
15
16## Tech Stack
17
18### Backend
19- **Framework:** Spring Boot (Java)
20- **Database:** PostgreSQL
21- **ORM:** Hibernate/JPA
22- **Security:** Spring Security + JWT
23- **Build Tool:** Maven
24
25### Frontend
26- **Library:** React 18+
27- **Routing:** React Router
28- **HTTP Client:** Axios
29- **Styling:** TailwindCSS
30- **Build Tool:** npm/Create React App
31
[48d2bed]32## Prerequisites
[99ab276]33
34Before you start, make sure you have installed:
35
36- **Java JDK 21+** - [Download](https://www.oracle.com/java/technologies/downloads/)
37- **Maven 3.8+** - [Download](https://maven.apache.org/download.cgi)
38- **Node.js 22+** - [Download](https://nodejs.org/)
[48d2bed]39- **PostgreSQL 14+** (if using local database) - [Download](https://www.postgresql.org/download/)
40- **SSH Client** (for remote database access) - Built-in on Windows 10+, Mac, Linux
[99ab276]41
[48d2bed]42## Configuration for Remote Database
43
44### Step 1: Setup `.env.properties` File
45
46Create a `.env.properties` file in the project root directory with your remote database credentials:
47
48```properties
49# Remote Database Credentials (provided by your professor or administrator)
50DB_REMOTE_NAME=your_database_name
51DB_REMOTE_USERNAME=your_database_username
52DB_REMOTE_PASSWORD=your_database_password
[99ab276]53
[48d2bed]54# JWT Secret for authentication
55JWT_SECRET=your_jwt_secret_key_min_32_characters
[99ab276]56
[48d2bed]57# Local database password (for local profile, default is 'postgres')
58DB_PASSWORD=postgres
59```
60
61**Important Security Notes:**
62- ⚠️ This file is in `.gitignore` and must NEVER be committed to Git
63- ⚠️ Keep your credentials secure and do not share them
64- ⚠️ Never upload this file to any public repository
65
66### Step 2: SSH Tunnel Setup (for Remote Database)
67
68Before starting the application, you must establish an SSH tunnel to access the remote database:
[99ab276]69
70```bash
[48d2bed]71# Windows (Command Prompt or PowerShell)
72ssh -L 9999:localhost:5432 your_ssh_username@remote_server_address
73
74# Example:
75ssh -L 9999:localhost:5432 t_medora@194.149.135.130
[99ab276]76```
77
[48d2bed]78**Important:** Keep this terminal window open while running the application. The tunnel will close if you close the terminal.
79
80**Expected Output:**
81```
82Enter password: [enter your SSH password]
83Access granted. Press Return to begin session.
84Local port 9999 forwarding to localhost:5432
85```
86
87---
88
89## Quick Start
90
91### Prerequisites Checklist
92
93Before starting the application, ensure you have:
94
95- Created `.env.properties` file with your database credentials
96- SSH tunnel is running and connected (see Configuration section above)
97- Terminal window with SSH tunnel remains open
98
99---
[99ab276]100
[48d2bed]101### Step 1: Start Backend (Terminal 1)
[99ab276]102
[48d2bed]103Navigate to the project root and run:
[99ab276]104
105```bash
106cd backend
107./mvnw.cmd spring-boot:run
108```
109
[48d2bed]110**Expected Output:**
111```
112Started MedoraApplication in X seconds
113```
114
115**Port:** `http://localhost:8081`
[99ab276]116
[48d2bed]117---
[99ab276]118
[48d2bed]119### Step 2: Start Frontend (Terminal 2)
[99ab276]120
[48d2bed]121In a new terminal, navigate to frontend directory and run:
[99ab276]122
123```bash
124cd frontend
125npm install
126npm start
127```
128
[48d2bed]129**Expected Output:**
130```
131Compiled successfully!
132You can now view medora-frontend in the browser.
133Local: http://localhost:3001
134```
135
136**Port:** `http://localhost:3001`
137
138---
139
140### Step 3: Access the Application
141
142Open your browser and navigate to: **http://localhost:3001**
143
144You should see the Medora login screen.
145
146---
147
148### ⚠️ Important: Keep These Terminals Open
149
150- **Terminal 0:** SSH Tunnel (must remain open)
151- **Terminal 1:** Backend (Spring Boot)
152- **Terminal 2:** Frontend (React)
153
154Close any of these and the application will stop working.
[99ab276]155
156## Default Credentials & User Roles
157
158### Admin User
159- **Username:** `admin`
160- **Password:** `admin123`
161- **Role:** ADMIN
162- **Permissions:** Full system access, user management, system configuration
163
164### Doctor Users
165- **Username:** Doctor's email address (from the database)
166- **Password:** `doctor123`
167- **Role:** DOCTOR
168- **Permissions:** View/manage patient medical records, create prescriptions, manage appointments, request lab tests
169
170**Example:**
171```
172Username: ivan.stojanov@medora.com
173Password: doctor123
174```
175
176### Patient Users
177- **Username:** Patient's EMBG (personal identification number)
178- **Password:** `password123`
179- **Role:** PATIENT
180- **Permissions:** View own medical records, view appointments, view prescriptions
181
182**Example:**
183```
184Username: 1505993123477
185Password: password123
186```
187
188### Lab Technician Users
189- **Username:** Lab technician's email address (from the database)
190- **Password:** `lab123`
191- **Role:** LAB_TECHNICIAN
192- **Permissions:** Create and update lab test results, view assigned lab tests
193
194**Example:**
195```
196Username: lab_marina
197Password: lab123
198```
199
200### Billing Admin Users
201- **Username:** Billing admin's email address (from the database)
202- **Password:** `adminmedora123`
203- **Role:** BILLING_ADMIN
204- **Permissions:** View billing records, generate billing reports, manage billing operations
205
206**Example:**
207```
208Username: admin_ilija
209Password: adminmedora123
210```
211
212
213## Configuration
214
215### Backend Configuration
216
[48d2bed]217The backend is configured to use a **remote PostgreSQL database** via SSH tunnel.
218
219**Main Configuration File:** `backend/src/main/resources/application.properties`
[99ab276]220
221```properties
[48d2bed]222# Application Setup
223spring.application.name=medora
224server.port=8081
225spring.profiles.active=remote
[99ab276]226
[48d2bed]227# Load environment variables from .env.properties
228spring.config.import=optional:file:.env.properties
229
230# JWT Authentication
231jwt.secret=${JWT_SECRET}
[99ab276]232jwt.expiration=86400000
233
[48d2bed]234# Hibernate/JPA Settings
235spring.jpa.hibernate.ddl-auto=none
236spring.jpa.open-in-view=true
237spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
238```
239
240**Remote Database Configuration:** `backend/src/main/resources/application-remote.properties`
241
242```properties
243# Remote PostgreSQL Database (via SSH tunnel on port 9999)
244spring.datasource.url=jdbc:postgresql://localhost:9999/${DB_REMOTE_NAME}
245spring.datasource.username=${DB_REMOTE_USERNAME}
246spring.datasource.password=${DB_REMOTE_PASSWORD}
247spring.datasource.driver-class-name=org.postgresql.Driver
[99ab276]248```
249
250
251## Role-Based Features
252
253### ADMIN
254- ✅ Manage all users (create, update, delete)
255- ✅ Create and manage patients
256- ✅ Create and manage doctors
257- ✅ View all medical records
258- ✅ System configuration
259- ✅ View all appointments
260- ✅ Access backfill operations
261
262### DOCTOR
263- ✅ View patient list
264- ✅ View patient medical records (diagnoses, symptoms, allergies)
265- ✅ Create prescriptions
266- ✅ Request laboratory tests
267- ✅ Manage appointments
268- ✅ Create medical reports
269- ❌ Cannot create new patients (admin only)
270- ❌ Cannot access billing information
271
272### PATIENT
273- ✅ View own medical records
274- ✅ View own appointments
275- ✅ View own prescriptions
276- ✅ View own lab test results
277- ❌ Cannot view other patients' data
278- ❌ Cannot modify medical records
279
280### LAB_TECHNICIAN
281- ✅ View assigned lab tests
282- ✅ Create and update lab test results
283- ✅ View patient information for assigned tests
284- ❌ Cannot create new lab tests (doctor only)
285- ❌ Cannot access medical records
286- ❌ Cannot access billing
287
288### BILLING_ADMIN
289- ✅ View all billing records
290- ✅ Generate billing reports
291- ✅ Track revenue and payments
292- ✅ View patient information for billing purposes
293- ❌ Cannot access medical records
294- ❌ Cannot manage appointments
295- ❌ Cannot create prescriptions
296
297---
298
299## Security Features
300
301- JWT-based authentication
302- Role-based access control (RBAC)
303- Password hashing with BCrypt
304- CORS configuration for frontend-backend communication
305- SQL injection protection via parameterized queries
306- Request validation and error handling
307
308## Database Migrations
309
310Database migrations are located in `backend/src/main/resources/db/migration/` and are automatically applied by Flyway on startup.
Note: See TracBrowser for help on using the repository browser.