Skip to content

iOS Wellness Framework

Edza-Baumanis edited this page Sep 16, 2025 · 1 revision

Wellness-iOS Framework

The Wellness-iOS framework provides tools to integrate health scanning, vital signs monitoring, and measurement storage into your iOS applications. The main interaction happens through the singleton WellnessHealth.shared, which exposes methods, delegates, and database access.


Overview

Wellness-iOS enables developers to:

  • Launch a scanner screen with a camera feed to capture and analyze vital signs.

  • Receive updates through delegate protocols for vital signs, measurements, and images.

  • Manage and retrieve stored measurements using an integrated database.


Setup

Before starting any measurements make sure your ConnectedCar tenant settings have configured WellnessLicenseKey. If it is not configured, please contact Scope Support. On mobile app it can be received using SDApiManager call:

SDApiManager.getMobileSettings { settings in
    let wellnessLicenseKey = settings.wellnessLicenseKey
}

Once you have the KEY you can create a session:

WellnessHealth.shared.createSession(with: wellnessLicenseKey)

Accessing the Singleton

To interact with the framework:

  • Use the shared instance:

    let wellness = WellnessHealth.shared

Main Features

Scanner Screen

The scanner screen provides a camera feed and measurement logic.

  • Start scanning:

    WellnessHealth.shared.startMeasurement()
  • Stop scanning:

    WellnessHealth.shared.stopMeasurement()
  • Clear session when exiting the scan:

    WellnessHealth.shared.clearSession()

Delegates

The framework communicates updates via delegate protocols. You must set these delegates to receive data and events.

WellnessHealthDelegate

public protocol WellnessHealthDelegate {
    func vitalSignsChanged(vitalSigns: WellnessVitalSign)
    func measurementTimerDidUpdate(to currentDuration: Int, from maximumDuration: Int)
    func measurementDidChange(measurement: WellnessMeasurement)
    func stateDidChange(to state: HealthSessionState)
    func errorDidChange(to error: String)
    func warningDidChange(to warning: String)
}

Delegate Responsibilities:

  • vitalSignsChanged(vitalSigns:) – Called when new vital signs are detected.

  • measurementTimerDidUpdate(to:from:) – Provides the elapsed measurement time.

  • measurementDidChange(measurement:) – Called when the current measurement changes.

  • stateDidChange(to:) – Updates the health session state.

  • errorDidChange(to:) – Reports any errors.

  • warningDidChange(to:) – Reports warnings (e.g., user feedback).


WellnessImageDelegate

public protocol WellnessImageDelegate {
    func onImageChange(image: ImageData)
}

This delegate streams camera frames with metadata.

ImageData Structure

public struct ImageData {
    public let image: UIImage
    public let roi: CGRect
    public let imageValidity: ImageValidity
}
  • image – Captured frame.

  • roi – Region of interest in the image.

  • imageValidity – Indicates whether the image is valid for measurement.


Database Access

The framework stores all measurements internally.

  • Retrieve all stored measurements:

    let allMeasurements = WellnessHealth.shared.getStoredMeasurements()
  • Results are returned in reverse chronological order (latest first).

Measurement Fields

Each WellnessMeasurement contains:

public var bloodPressureDiastolic: Int16
public var bloodPressureSystolic: Int16
public var hemoglobin: Double
public var hemoglobinA1C: Double
public var lfhf: Double
public var oxygenSaturation: Int16
public var pnsIndex: Double
public var pnsZone: Int16 // Recovery Ability
public var prq: Double
public var prqConfidence: Int16
public var pulseRate: Int16
public var pulseRateConfidence: Int16
public var respirationsPerMinute: Int16
public var rmssd: Int16
public var sd1: Int16
public var sd2: Int16
public var sdnn: Int16
public var sdnnConfidence: Int16
public var snsIndex: Double
public var snsZone: Int16 // Stress Response
public var stressIndex: Int16
public var stressLevel: Int16
public var timestamp: Date?
public var wellnessIndex: Int16
public var wellnessLevel: Int16
public var highBloodPressureRisk: Int16
public var highHemoglobinA1cRisk: Int16
public var meanRri: Int16
public var highFastingGlucoseRisk: Int16
public var highTotalCholesterolRisk: Int16
public var lowHemoglobinRisk: Int16
public var ascvdRisk: Double
public var heartAge: Int16

Displaying Measurements

Measurements can be wrapped with:

MeasurementWrapper<Any>

This helper class provides:

  • getMax() – Maximum boundary for the measurement.

  • getMin() – Minimum boundary for the measurement.

  • level – Indicates the range level for the current value.


Typical Integration Flow

  • Get a valid license key from ConnectedCar tenant settings:

    SDApiManager.getMobileSettings { settings in
        let wellnessLicenseKey = settings.wellnessLicenseKey
    }
  • Create a session:

    WellnessHealth.shared.createSession(with: wellnessLicenseKey)
  • Initialize and configure delegates:

    WellnessHealth.shared.delegate = self
    WellnessHealth.shared.imageDelegate = self
  • Start a scan when ready:

    WellnessHealth.shared.startMeasurement()
  • Handle delegate updates to show vital signs and images.

  • Stop and clear the session when leaving the scanning screen:

    WellnessHealth.shared.stopMeasurement()
    WellnessHealth.shared.clearSession()
  • Retrieve stored measurements (if needed).


Clone this wiki locally