HealthData
One health data point from Apple Health or Google Health Connect.
This is the data of every measurement collected by the HealthProbe. It is created from the health plugin's HealthDataPoint using HealthData.fromHealthDataPoint. All health data has the same JSON type, dk.cachet.carp.health (HealthSamplingPackage.HEALTH); the kind of data is given by healthDataType.
Key points:
- Inheritance
-
- Object
- Serializable
- Data
- HealthData
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
HealthData.fromHealthDataPoint
- HealthDataPoint healthDataPoint
Creates a HealthData from a health plugin HealthDataPoint.
HealthData.fromJson
HealthData
- required String uuid,
- required HealthValue value,
- required String unit,
- required String healthDataType,
- required DateTime dateFrom,
- required DateTime dateTo,
- required HealthPlatform platform,
- String? deviceId,
- String? sourceId,
- String? sourceName,
Creates a HealthData object. dateFrom and dateTo are converted to UTC.
Properties
dateFrom
Start time of this health data, in UTC.
dateTo
End time of this health data, in UTC.
deviceId
The id of the device the data point was fetched from.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
healthDataType
The name of the HealthDataType of this data point.
Note that the uppercase version is used, e.g. STEPS.
jsonType
The JSON type of all health data, dk.cachet.carp.health (HealthSamplingPackage.HEALTH), whatever the healthDataType.
platform
The platform this health data point came from.
recordId
Stable identifier of the source record, if available.
sourceId
The id of the source from which the data point was fetched.
sourceName
The name of the source from which the data point was fetched.
unit
Unit of health data.
Note that the uppercase version is used, e.g. COUNT in the case of step counts.
uuid
A unique UUID of this data point.
value
The value of the health data, for example a NumericHealthValue.
See HealthValue.
Methods
toJson
Return a JSON encoding of this object.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.