Skip to content

A Go project that collects and stores health metrics from wearable devices using InfluxDB and MQTT. It facilitates real-time tracking of vital statistics, such as heart rate and oxygen levels, enabling users to monitor their health effectively.

Notifications You must be signed in to change notification settings

0xTan1319/health-data-tracker-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Health Data Tracker

A Go-based application designed to integrate wearable device data using MQTT and InfluxDB. This project allows for real-time collection and storage of health-related metrics such as heart rate and oxygen levels.

Features

  1. Real-time Data Processing: Collects health data from wearable devices via MQTT.
  2. InfluxDB Integration: Saves processed data into InfluxDB for efficient time-series data storage and analysis.
  3. Graceful Shutdown: Handles system signals for graceful application termination.

Tech Stack

Go MQTT (Eclipse Paho) InfluxDB

Installation

Prerequisites:

Go (version 1.16 or higher)

InfluxDB

MQTT Broker (e.g., Mosquitto)

Set up environment variables

Create a .env file in the root directory and add your InfluxDB token:

INFLUXDB_TOKEN=your_influxdb_token

Install Go dependencies:

go run main.go

Run the MQTT broker (if you haven't done so already):

If using Mosquitto, you can install it via Homebrew (on macOS) or download it from Mosquitto's official website

Run the application:

go run main.go

Usage

The application listens for MQTT messages published to the wearable/data topic.

Data format (JSON) expected in the payload:

{
    "device_id": "device_199",
    "heart_rate": 175,
    "oxygen_level": 75
}

The application processes the incoming data and saves it to InfluxDB.

Testing

To test the MQTT integration, you can publish test messages using an MQTT client or command-line tool. For example, using mosquitto_pub:

mosquitto_pub -h localhost -t wearable/data -m '{"device_id": "device_199", "heart_rate": 175, "oxygen_level": 75}'

About

A Go project that collects and stores health metrics from wearable devices using InfluxDB and MQTT. It facilitates real-time tracking of vital statistics, such as heart rate and oxygen levels, enabling users to monitor their health effectively.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages