Skip to content

shaypower/CareTether-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CareTether API

Django REST API for monitoring dementia patients with wearable devices.

Features

  • Health Monitoring: Track heart rate, SpO2, body temperature, steps, and sleep quality
  • Device Management: Register devices and assign them to patients
  • Alert System: Real-time alerts with SMS notifications
  • Patient Management: Store patient profiles and medical information
  • Firebase Authentication: Secure user authentication
  • Admin Interface: Django admin with filtering and management tools

Heart Rate Calibration

Heart rate calibration is supported via the HEART_BEAT_OFFSET setting:

# Set environment variable for heart rate offset
export HEART_BEAT_OFFSET=-10

Example:

  • Device sends: 90 BPM
  • Offset: -10
  • Stored in DB: 80 BPM

This helps calibrate heart rate readings from devices with systematic measurement errors.

SpO2 Calibration

SpO2 calibration is supported via the SPO2_OFFSET setting:

# Set environment variable for SpO2 offset
export SPO2_OFFSET=-2

Example:

  • Device sends: 98%
  • Offset: -2
  • Stored in DB: 96%

This helps calibrate SpO2 readings from devices with systematic measurement errors.

API Response

Health metric endpoints include both the stored value and the original device value:

Heart Rate:

{
  "id": "uuid",
  "value": 80,
  "original_device_value": 90,
  "patient": "patient-uuid",
  "device": "device-uuid",
  "timestamp": "2024-01-01T12:00:00Z",
  "metadata": {}
}

SpO2:

{
  "id": "uuid",
  "value": 96,
  "original_device_value": 98,
  "patient": "patient-uuid",
  "device": "device-uuid",
  "timestamp": "2024-01-01T12:00:00Z",
  "metadata": {}
}

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Set environment variables:

    export DJANGO_SECRET_KEY="your-secret-key"
    export HEART_BEAT_OFFSET=0  # Adjust as needed
    export SPO2_OFFSET=0        # Adjust as needed
    export FIREBASE_CREDENTIALS_PATH="path/to/firebase_auth.json"
  3. Set up Firebase credentials:

    • Copy firebase_auth.json.template to firebase_auth.json
    • Fill in your Firebase service account credentials
  4. Run migrations:

    python manage.py migrate --settings=api.settings_local
  5. Create superuser:

    python manage.py createsuperuser --settings=api.settings_local
  6. Run the server:

    python manage.py runserver --settings=api.settings_local

API Endpoints

  • GET/POST /api/v1/heart-rate/ - Heart rate data
  • GET/POST /api/v1/spo2/ - SpO2 data
  • GET/POST /api/v1/steps/ - Steps data
  • GET/POST /api/v1/body-temperature/ - Body temperature data
  • GET/POST /api/v1/sleep-quality/ - Sleep quality data
  • GET/POST /api/v1/alerts/ - Alerts
  • GET/POST /api/v1/patients/ - Patient management
  • GET/POST /api/v1/devices/ - Device management

Admin Interface

Access the admin interface at /admin/ with features including:

  • Filtering and searching
  • Bulk actions for alerts and reminders
  • Status indicators for health metrics
  • Data management tools

About

the API for now retired project known as CareTether

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published