Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Health Monitoring System

An IoT-based Android application for real-time baby health monitoring that integrates embedded sensors, Bluetooth Low Energy (BLE) communication, and cloud services to provide comprehensive health tracking for infants.

πŸ“± Overview

The Health Monitoring System is a complete IoT solution designed to help parents and healthcare professionals monitor infant health in real-time. The system tracks temperature and movement data through embedded sensors, transmits it wirelessly via BLE to an Android application, and stores it securely in the cloud for remote access and analysis.

✨ Features

Core Functionality

  • Real-time Monitoring: Continuous tracking of baby's temperature and acceleration data
  • Bluetooth Low Energy (BLE) Integration: Wireless communication with embedded sensor board
  • Cloud Synchronization: Automatic data upload to Firebase Firestore with configurable intervals
  • Smart Alerts: Automatic notifications for fever detection (β‰₯38Β°C) and fall detection
  • Data Visualization: Interactive line charts for temperature trends over time
  • Automated Data Management: Configurable upload periods and automatic cleanup of old records

User Management

  • Multi-role System: Support for Parents, Doctors, and Admin users
  • Role-based Access Control: Different permissions and interfaces for each user type
  • Secure Authentication: Firebase Authentication with email verification
  • Doctor Approval System: Admin-controlled doctor registration with identity verification

Medical Records

  • Doctor Notes: Healthcare professionals can add, edit, and share medical notes
  • Search Functionality: Doctors can search patients by name, email, or phone number
  • Medical History: Comprehensive tracking of temperature readings and medical notes
  • Parent-Doctor Communication: Seamless sharing of health data and medical records

πŸ› οΈ Technology Stack

Mobile Application

  • Language: Java
  • Platform: Android (minSdk 24, targetSdk 33)
  • Build System: Gradle (Kotlin DSL)
  • Architecture: Service-based architecture with background data processing

Cloud Services

  • Firebase Authentication: User authentication and email verification
  • Firebase Firestore: NoSQL database for real-time data storage
  • Firebase UI: Pre-built UI components for Firestore integration

Communication

  • Bluetooth Low Energy (BLE): Wireless sensor data transmission
  • Embedded Hardware: EFR32BG22 Thunderboard with:
    • Si7021 relative humidity and temperature sensor
    • ICM-20648 6-axis inertial measurement unit (IMU)

Libraries & Dependencies

  • com.github.PhilJay:MPAndroidChart - Data visualization charts
  • com.opencsv:opencsv - CSV data export
  • com.firebaseui:firebase-ui-firestore - Firebase UI components
  • com.sun.mail:android-mail - Email functionality

πŸ—οΈ Architecture

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Embedded Board β”‚  BLE    β”‚  Android App     β”‚  HTTP    β”‚   Firebase   β”‚
β”‚  (EFR32BG22)    │◄───────►│  (Java/Android) │◄────────►│   Firestore  β”‚
β”‚                 β”‚         β”‚                  β”‚          β”‚              β”‚
β”‚  - Temperature  β”‚         β”‚  - BLE Service   β”‚          β”‚  - Users     β”‚
β”‚  - IMU Sensor   β”‚         β”‚  - Data Process β”‚          β”‚  - Babies    β”‚
β”‚                 β”‚         β”‚  - UI Activities β”‚          β”‚  - Temps     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚  - Notes     β”‚
                                                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Services

  1. BLEDataService: Handles BLE communication with embedded sensors

    • GATT service discovery and characteristic management
    • Real-time data reception via notifications/indications
    • Data parsing and broadcasting to other components
  2. DataProcessService: Processes and manages sensor data

    • Temperature aggregation and mean calculation
    • Fall detection algorithm (acceleration magnitude analysis)
    • Automated cloud upload with configurable intervals
    • Data retention policy enforcement
  3. Firebase Integration: Cloud backend services

    • User authentication and authorization
    • Real-time database synchronization
    • Role-based data access control

Database Schema

Firestore
β”œβ”€β”€ users/
β”‚   └── {userId}/
β”‚       β”œβ”€β”€ email
β”‚       β”œβ”€β”€ userType (Admin/Doctor/Parent)
β”‚       └── approvalStatus
β”‚
β”œβ”€β”€ babies/
β”‚   └── {babyId}/
β”‚       β”œβ”€β”€ name
β”‚       β”œβ”€β”€ dateOfBirth
β”‚       β”œβ”€β”€ familyInfo
β”‚       β”œβ”€β”€ temps/ (subcollection)
β”‚       β”‚   └── {timestamp}/
β”‚       β”‚       β”œβ”€β”€ current_temp
β”‚       β”‚       β”œβ”€β”€ mean_temp
β”‚       β”‚       └── timestamp
β”‚       └── notes/ (subcollection)
β”‚           └── {noteId}/
β”‚               β”œβ”€β”€ content
β”‚               β”œβ”€β”€ doctorId
β”‚               └── timestamp

πŸš€ Getting Started

Prerequisites

  • Android Studio (latest version recommended)
  • Android SDK (API level 24 or higher)
  • Firebase project with Firestore and Authentication enabled
  • EFR32BG22 Thunderboard or compatible BLE device
  • Physical Android device with BLE support (for testing)

Installation

  1. Clone the repository

    git clone https://github.com/priyavrat7/Health-Monitoring-System.git
    cd Health-Monitoring-System
  2. Set up Firebase

    • Create a new Firebase project at Firebase Console
    • Enable Firestore Database and Authentication (Email/Password)
    • Download google-services.json and place it in app/ directory
    • Configure Firestore security rules for your use case
  3. Configure the Project

    • Open the project in Android Studio
    • Sync Gradle files
    • Update applicationId in app/build.gradle.kts if needed
  4. Build and Run

    ./gradlew assembleDebug

    Or use Android Studio's Run button to install on a connected device

Firebase Setup

  1. Authentication Rules: Configure email/password authentication
  2. Firestore Rules: Set up appropriate security rules:
    rules_version = '2';
    service cloud.firestore {
      match /databases/{database}/documents {
        // Add your security rules here
      }
    }

πŸ“– Usage

For Parents

  1. Registration: Create an account with email and password
  2. Baby Profile: Add your baby's information (name, DOB, contact info)
  3. Connect Device: Scan and connect to the BLE sensor board
  4. Configure Settings: Set upload interval and data retention period
  5. Monitor: View real-time temperature and acceleration data
  6. View Charts: Check temperature trends over time
  7. Receive Alerts: Get notified for fever or fall detection

For Doctors

  1. Registration: Sign up with professional credentials
  2. Admin Approval: Wait for admin to approve your account
  3. Search Patients: Find babies by name, email, or phone
  4. View Data: Access temperature charts and historical data
  5. Add Notes: Create, edit, and share medical notes with parents

For Admins

  1. Approve Doctors: Review and approve doctor registration requests
  2. Manage Users: Oversee user accounts and access

πŸ”§ Configuration

Data Upload Settings

  • Upload Period: Configure how often temperature data is uploaded to cloud (default: 1 second)
  • Data Retention: Set how long to keep temperature records (default: 30 seconds)
  • These can be adjusted in the app's settings interface

Alert Thresholds

  • Fever Threshold: 38Β°C (configurable in DataProcessService.java)
  • Fall Detection: Acceleration magnitude threshold (default: 70, configurable)

πŸ“ Project Structure

ChildHealthCareProject/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ build.gradle.kts          # App-level build configuration
β”‚   β”œβ”€β”€ google-services.json      # Firebase configuration
β”‚   └── src/main/
β”‚       β”œβ”€β”€ AndroidManifest.xml
β”‚       β”œβ”€β”€ java/com/example/childhealthcareproject/
β”‚       β”‚   β”œβ”€β”€ BLEDataService.java          # BLE communication service
β”‚       β”‚   β”œβ”€β”€ DataProcessService.java      # Data processing & cloud sync
β”‚       β”‚   β”œβ”€β”€ ParentActivity.java          # Parent user interface
β”‚       β”‚   β”œβ”€β”€ DoctorActivity.java          # Doctor user interface
β”‚       β”‚   β”œβ”€β”€ LoginActivity.java           # Authentication
β”‚       β”‚   β”œβ”€β”€ RegisterActivity.java        # User registration
β”‚       β”‚   └── [Other activity classes]
β”‚       └── res/                             # Resources (layouts, drawables, etc.)
β”œβ”€β”€ build.gradle.kts              # Project-level build configuration
β”œβ”€β”€ settings.gradle.kts           # Project settings
└── gradle/                        # Gradle wrapper files

πŸ” Security Considerations

  • All user authentication is handled through Firebase Authentication
  • Firestore security rules should be configured to enforce role-based access
  • BLE communication uses standard GATT security
  • Sensitive data is stored securely in Firebase Firestore

πŸ§ͺ Testing

The project includes basic test structure:

  • Unit tests: app/src/test/java/
  • Instrumented tests: app/src/androidTest/java/

To run tests:

./gradlew test              # Unit tests
./gradlew connectedAndroidTest  # Instrumented tests

πŸ“ Key Algorithms

Fall Detection

float totalMag = Math.sqrt(acc[0]Β² + acc[1]Β² + acc[2]Β²);
if (totalMag >= threshold) {
    // Trigger fall notification
}

Temperature Aggregation

  • Collects temperature readings over a configurable period
  • Calculates mean temperature for the period
  • Uploads aggregated data to reduce cloud storage usage

Data Retention

  • Automatically queries and deletes records older than retention period
  • Uses Firestore batch operations for efficient deletion

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

πŸ“„ License

This project is part of academic coursework. Please refer to the license file for details.

πŸ‘₯ Authors

  • Priyavrat Dev Sharma - Initial work - GitHub
  • Han Cat Nguyen - Co-developer

πŸ™ Acknowledgments

  • McGill University, Department of Electrical and Computer Engineering
  • Firebase team for excellent documentation and services
  • Silicon Labs for EFR32BG22 development board support

πŸ“š Related Documentation

πŸ”— Links


Note: This application is designed for educational and research purposes. For medical use, ensure compliance with healthcare regulations and consult with healthcare professionals.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages