Skip to content

eaaslan/patient-monitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

System Architecture

The VITALIS project employs a robust microservices architecture designed to facilitate real-time health monitoring and data management. This architecture ensures efficient data collection, processing, and storage across multiple integrated components.

Architecture Diagram

+-------------------+       +-------------+       +-------------------+
| Wearable Devices  +------>+ MQTT Broker +------>+ Spring Boot Backend|
+-------------------+       +-------------+       +---------+---------+
                                                    |               |
                                                    v               v
                                      +---------+---------+    +---------+---------+                                                                              
                                      +       InfluxDB    |    |   MySQL Database  |
                                      +-------------------+    +---------+---------+ 
                                                                                                                              

Data Flow

  1. Wearable devices send health metrics to MQTT Broker
  2. MQTT Broker forwards messages to Spring Boot Backend
  3. Backend processes and validates incoming data
  4. Relational data stored in MySQL
  5. Time-series health metrics stored in InfluxDB
  6. Frontend can retrieve and display data via RESTful API

Prerequisites

To set up and run the VITALIS project, ensure you have the following software installed:

  • Java Development Kit (JDK) 17 or later
  • Maven 3.8+
  • Docker and Docker Compose
  • MQTT Broker (Mosquitto recommended)

Recommended Development Environment

  • Operating System: Linux, macOS, or Windows with WSL2
  • Minimum RAM: 16GB
  • Recommended IDE: IntelliJ IDEA or Visual Studio Code with Java extensions

Quick Start Guide

1. Repository Cloning

Clone the VITALIS project repository using Git:

git clone https://github.com/your-org/vitalis.git
cd vitalis

2. Environment Configuration

Prepare your environment configuration:

cp .env.example .env
# Edit .env file with your specific credentials

Key configurations to review:

  • Database connection strings
  • MQTT broker settings
  • JWT secret key
  • Service ports

3. Build and Deployment

Build the application and start services using Docker Compose:

mvn clean package
docker-compose up --build -d

This command will:

  • Compile the Java application
  • Build Docker images
  • Start all required services
  • Run database migrations
  • Initialize MQTT broker

4. Service Access Points

After successful deployment, you can access the following services:

  • Main API: http://localhost:8080
  • InfluxDB Web UI: http://localhost:8086
  • MySQL Database: localhost:3306/vitalis

API Documentation

Authentication Endpoints

Endpoint Method Description
/auth/login POST Obtain JWT authentication token
/auth/register POST Create a new user account

Patient Management Endpoints

Endpoint Method Description
/api/patients GET Retrieve list of all patients
/api/patients/{id} GET Get details for a specific patient
/api/patients POST Create a new patient record

Health Metrics Endpoints

Endpoint Method Description
/metrics/patient/{patientId} GET Retrieve historical health metrics
/metrics/realtime WebSocket Real-time health metric streaming

Usage Examples

Obtaining Access Token

Authenticate and receive a JWT token:

curl -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"staff1", "password":"securePass123"}'

Creating a New Patient

Add a patient to the system:

curl -X POST http://localhost:8080/api/patients \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "age": 42,
    "gender": "MALE",
    "admissionDate": "2024-02-15"
  }'

Troubleshooting

Common Issues and Solutions

  1. Database Connection Failures

    • Verify credentials in .env file
    • Check network connectivity
    • Ensure Docker networks are correctly configured
  2. MQTT Connection Timeouts

    • Confirm broker is running on port 1883
    • Check firewall settings
    • Validate broker credentials
  3. JWT Authentication Problems

    • Tokens expire after 24 hours by default
    • Regenerate token if expired
    • Verify token generation process

Accessing Logs

To view backend service logs:

docker-compose logs -f backend

This command provides real-time log streaming for diagnostic purposes.

Performance Monitoring

  • Monitor system resources using Docker stats
  • Use InfluxDB's built-in monitoring capabilities
  • Implement application-level logging for detailed insights

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published