export

package
v0.0.0-...-aee8074 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package export provided parsing and analysis methods for Apple Health Exports Data.

Index

Examples

Constants

View Source
const (
	// Elliptical Workout
	Elliptical = "HKWorkoutActivityTypeElliptical"
	// Hiking Workout
	Hiking = "HKWorkoutActivityTypeHiking"
	// Other	Workout
	Other = "HKWorkoutActivityTypeOther"
	// Walking Workout
	Walking = "HKWorkoutActivityTypeWalking"
)

Variables

RecordKnownSourcesTypes currently known "type=" emitted by a "sourceName" in a Record

RecordMetadataKeysKnown so far in data set

RecordSourcesKnown these "sourceName" in Records are seen in data

RecordTypesKnown so far in data. As you see more types add them here.

View Source
var WorkOutActivityTypesKnown = WorkOutActivityTypes{Elliptical, Hiking, Other, Walking}

WorkOutActivityTypesKnown analyzed so far

WorkoutMetadataKeysKnown list of data seen in keys until now

Functions

func HKDateTime

func HKDateTime(hkt string) (time.Time, error)

HKDateTime converts a HK date string '2006-01-02 15:04:05 -0700' to Golang date

func ValidateRecordFlag

func ValidateRecordFlag(_ string) bool

ValidateRecordFlag checks if flag is one os known types

Types

type ActivitySummary

type ActivitySummary struct {
	XMLName xml.Name `xml:"ActivitySummary" json:"-"`
	// Attributes
	YYYYMMDD         string `xml:"dateComponents,attr,omitempty" json:"yyyymmdd,omitempty"`
	EnergyBurned     string `xml:"activeEnergyBurned,attr,omitempty" json:"energy_burned,omitempty"`
	EnergyBurnedGoal string `xml:"activeEnergyBurnedGoal,attr,omitempty" json:"energy_burned_goal,omitempty"`
	EnergyBurnedUnit string `xml:"activeEnergyBurnedUnit,attr,omitempty" json:"energy_burned_unit,omitempty"`
	MoveTime         string `xml:"appleMoveTime,attr,omitempty" json:"move_time,omitempty"`
	MoveTimeGoal     string `xml:"appleMoveTimeGoal,attr,omitempty" json:"move_time_goal,omitempty"`
	ExerciseTime     string `xml:"appleExerciseTime,attr,omitempty" json:"exercise_time,omitempty"`
	ExerciseTimeGoal string `xml:"appleExerciseTimeGoal,attr,omitempty" json:"exercise_time_goal,omitempty"`
	StandHours       string `xml:"appleStandHours,attr,omitempty" json:"stand_hours,omitempty"`
	StandHoursGoal   string `xml:"appleStandHoursGoal,attr,omitempty" json:"stand_hours_goal,omitempty"`
}

ActivitySummary daily work summary.

Example

ActivitySummary String provides description of Activity Summary

file := "../public/sampleexport.xml"
d, err := Parse(file)
if err != nil {
	return
}
for _, a := range d.ActivitiesSummary {
	fmt.Printf("%s\n", a)
}
Output:

ActivitySummary:2020-11-20 (Energy: 487.231/300 Cal, Move: 0/0, Exercise: 74/30 Minutes, Stand: 16/11 Hours)
ActivitySummary:2020-11-21 (Energy: 551.951/300 Cal, Move: 0/0, Exercise: 79/30 Minutes, Stand: 16/11 Hours)
ActivitySummary:2020-11-22 (Energy: 534.026/300 Cal, Move: 0/0, Exercise: 80/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-11-23 (Energy: 585.547/300 Cal, Move: 0/0, Exercise: 83/30 Minutes, Stand: 17/11 Hours)
ActivitySummary:2020-11-24 (Energy: 604.823/300 Cal, Move: 0/0, Exercise: 83/30 Minutes, Stand: 19/11 Hours)
ActivitySummary:2020-11-25 (Energy: 606.726/300 Cal, Move: 0/0, Exercise: 85/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-11-26 (Energy: 599.972/300 Cal, Move: 0/0, Exercise: 88/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-11-27 (Energy: 648.394/300 Cal, Move: 0/0, Exercise: 100/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-11-28 (Energy: 758.974/300 Cal, Move: 0/0, Exercise: 141/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-11-29 (Energy: 585.901/300 Cal, Move: 0/0, Exercise: 102/30 Minutes, Stand: 19/11 Hours)
ActivitySummary:2020-11-30 (Energy: 695.816/300 Cal, Move: 0/0, Exercise: 109/30 Minutes, Stand: 19/11 Hours)
ActivitySummary:2020-12-01 (Energy: 655.492/300 Cal, Move: 0/0, Exercise: 95/30 Minutes, Stand: 16/11 Hours)
ActivitySummary:2020-12-02 (Energy: 634.471/300 Cal, Move: 0/0, Exercise: 90/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-12-03 (Energy: 659.84/300 Cal, Move: 0/0, Exercise: 96/30 Minutes, Stand: 17/11 Hours)
ActivitySummary:2020-12-04 (Energy: 647.78/300 Cal, Move: 0/0, Exercise: 93/30 Minutes, Stand: 18/11 Hours)
ActivitySummary:2020-12-05 (Energy: 583.725/300 Cal, Move: 0/0, Exercise: 91/30 Minutes, Stand: 16/11 Hours)
ActivitySummary:2020-12-06 (Energy: 610.788/300 Cal, Move: 0/0, Exercise: 113/30 Minutes, Stand: 14/11 Hours)

func (ActivitySummary) String

func (a ActivitySummary) String() string

String describes ActivitySummary

type AudioExposure

type AudioExposure struct {
	Exposure []Exposure `json:"exposure"`
}

AudioExposure slice of all data

type Audiogram

type Audiogram struct {
	XMLName xml.Name `xml:"Audiogram" json:"-"`
	// Attributes
	Type          string `xml:"type,attr" json:"type"`
	SourceName    string `xml:"sourceName,attr" json:"source_name"`
	SourceVersion string `xml:"sourceVersion,attr,omitempty" json:"source_version,omitempty"`
	Device        string `xml:"device,attr,omitempty" json:"device,omitempty"`
	CreationDate  string `xml:"creationDate,attr,omitempty" json:"creation_date,omitempty"`
	StartDate     string `xml:"startDate,attr" json:"start_date"`
	EndDate       string `xml:"endDate,attr" json:"end_date"`
	// Elements
	MetadataEntries   []MetadataEntry    `xml:"MetadataEntry,omitempty" json:"metadata,omitempty"`
	SensitivityPoints []SensitivityPoint `xml:"SensitivityPoint,omitempty" json:"sensitivity_points,omitempty"`
}

Audiogram records

type BodyMassComposition

type BodyMassComposition struct {
	Mass          []BodyMassElement `json:"mass"`
	LeanMass      []BodyMassElement `json:"lean_body_mass"`
	BMI           []BodyMassElement `json:"bmi"`
	FatPercentage []BodyMassElement `json:"fat_percent"`
}

BodyMassComposition data slices related to body mass.

type BodyMassElement

type BodyMassElement struct {
	CreationDate int64   `json:"creation_timestamp_sec"`
	SourceName   string  `json:"source"`
	Unit         string  `json:"unit,omitempty"`
	Value        float32 `json:"value"`
}

BodyMassElement elements in various types of body-mass data

type ClinicalRecord

type ClinicalRecord struct {
	XMLName xml.Name `xml:"ClinicalRecord" json:"-"`
	// Attributes
	Type         string `xml:"type,attr" json:"type"`
	ID           string `xml:"identifier,attr" json:"id"`
	SourceName   string `xml:"sourceName,attr" json:"source_name"`
	SourceURL    string `xml:"sourceURL,attr" json:"source_url"`
	FHIRVersion  string `xml:"fhirVersion,attr" json:"fhir_version"`
	ReceivedDate string `xml:"receivedDate,attr" json:"received_date"`
	FilePath     string `xml:"resourceFilePath,attr" json:"file_path"`
}

ClinicalRecord element data. Contains Source, URL and FilePath data provided.

type Correlation

type Correlation struct {
	XMLName xml.Name `xml:"Correlation" json:"-"`
	// Attributes
	Type          string `xml:"type,attr" json:"type"`
	SourceName    string `xml:"sourceName,attr" json:"source_name"`
	SourceVersion string `xml:"sourceVersion,attr,omitempty" json:"source_version,omitempty"`
	Device        string `xml:"device,attr,omitempty" json:"device,omitempty"`
	CreationDate  string `xml:"creationDate,attr,omitempty" json:"creation_date,omitempty"`
	StartDate     string `xml:"startDate,attr" json:"start_date"`
	EndDate       string `xml:"endDate,attr" json:"end_date"`
	// Elements
	MetadataEntries []MetadataEntry `xml:"MetadataEntry" json:"metadata"`
	Records         []Record        `xml:"Record" json:"records"`
}

Correlation element groups correlated Records.

type Date

type Date struct {
	XMLName xml.Name `xml:"ExportDate" json:"-"`
	Value   string   `xml:"value,attr" json:"value"`
}

Date a Export Date element

type Exposure

type Exposure struct {
	CreationDate int64   `json:"creation_timestamp_sec"`
	EndDate      int64   `json:"end_date"`
	SourceName   string  `json:"source"`
	Unit         string  `json:"unit,omitempty"`
	Value        float32 `json:"value"`
}

Exposure elements for exposure

type FileReference

type FileReference struct {
	XMLName xml.Name `xml:"FileReference" json:"-"`
	Path    string   `xml:"path,attr" json:"path"`
}

FileReference relative path where a WorkoutRoute data is stored

type HealthData

type HealthData struct {
	// Attribute
	Locale string `xml:"locale,attr" json:"locate"`
	// Elements
	Exported          Date              `xml:"ExportDate" json:"exported_date"`
	Me                Me                `xml:"Me" json:"me"`
	Records           []Record          `xml:"Record"  json:"records,omitempty"`
	ClinicalRecords   []ClinicalRecord  `xml:"ClinicalRecord" json:"clinical_records,omitempty"`
	Correlations      []Correlation     `xml:"Correlation" json:"correlations,omitempty"`
	Workouts          []Workout         `xml:"Workout" json:"workouts,omitempty"`
	ActivitiesSummary []ActivitySummary `xml:"ActivitySummary" json:"activities_summary,omitempty"`
	Audiograms        []Audiogram       `xml:"Audiogram,omitempty"  json:"audiograms,omitempty"`
}

HealthData is composite of exports.xml

func Parse

func Parse(fileName string) (*HealthData, error)

Parse Apple HK exported XML fileName and returns pointer to HealthData, or error if any

Example

Parse reads and parses data from Apple Export file. Describe summary of data.

file := "../public/sampleexport.xml"
d, err := Parse(file)
if err != nil {
	return
}
d.Describe()
Output:

Export date: 2020-12-06
Me: DOB:1990-12-06, Sex:Male, BloodType:NotSet, SkinType:NotSet, Medication:None
Records: 5, #Metadata: 0, #HRV: 1
Records by Type:
	BodyMassIndex: 4
	HeartRateVariabilitySDNN: 1
Total Count: 5
Records by SourceName:
	Renpho: 4
	🕛🕐🕑🕒: 1
Total Count: 5
Records Metadata Entries SourceName:
	Renpho: 0
	🕛🕐🕑🕒: 0
Total Count: 0
Types (4) by SourceName "Renpho"
	BodyMassIndex: 4
Total Count: 4
Types (1) by SourceName "🕛🕐🕑🕒"
	HeartRateVariabilitySDNN: 1
Total Count: 1
SourceName (1) by Type "BodyMassIndex"
	Renpho: 4
Total Count: 4
SourceName (1) by Type "HeartRateVariabilitySDNN"
	🕛🕐🕑🕒: 1
Total Count: 1
Clinical: 6
Correlations: 0, #Metadata: 0, #Records: 0
Workouts: 1, #Metadata: 1, #Events: 8, Routes: 1
ActivitiesSummary: 17

func (*HealthData) AudioExposure

func (h *HealthData) AudioExposure() *AudioExposure

AudioExposure processes and returns Audio exposure data

func (*HealthData) BodyMassData

func (h *HealthData) BodyMassData() *BodyMassComposition

BodyMassData get the body mass data

func (*HealthData) Describe

func (h *HealthData) Describe()

Describe prints summary health data

func (*HealthData) DescribeRecords

func (h *HealthData) DescribeRecords()

DescribeRecords prints a summary data by source type

func (*HealthData) DescribeRecordsSourceName

func (h *HealthData) DescribeRecordsSourceName()

DescribeRecordsSourceName Metadata Keys. Sort keys by alphanumeric

func (*HealthData) DescribeRecordsSourceNameByTypes

func (h *HealthData) DescribeRecordsSourceNameByTypes()

DescribeRecordsSourceNameByTypes lists all Sources that provided a specific type.

func (*HealthData) DescribeRecordsTable

func (h *HealthData) DescribeRecordsTable(w io.Writer, sep string)

DescribeRecordsTable writes a summary to a ioWrite, in table columns as Type .. device .. metadata tag .. count

func (*HealthData) DescribeRecordsTypesBySourceName

func (h *HealthData) DescribeRecordsTypesBySourceName()

DescribeRecordsTypesBySourceName lists all types reported by a source

func (*HealthData) GetRecords

func (h *HealthData) GetRecords(tag RecordType, date string) []Record

GetRecords Get all GetRecords

func (*HealthData) RecordsSources

func (h *HealthData) RecordsSources() KeyCounts

RecordsSources returns summary of all Record by SourceName

func (*HealthData) RecordsSummary

func (h *HealthData) RecordsSummary() NameTypeKeyCounts

RecordsSummary returns a summary of HealthData in a sorted slice.

func (*HealthData) RecordsTypes

func (h *HealthData) RecordsTypes() KeyCounts

RecordsTypes returns summary of all Record by SourceName

func (*HealthData) Summary

func (h *HealthData) Summary() []ActivitySummary

Summary returns a sorted []ActivitySummary data

func (*HealthData) UnseenCheck

func (h *HealthData) UnseenCheck()

UnseenCheck Prints out any unseen keys

func (*HealthData) WalkerData

func (h *HealthData) WalkerData() *WalkerData

WalkerData Get Walker data and send back

type HeartRateVariabilityMetadataList

type HeartRateVariabilityMetadataList struct {
	BPM []InstantaneousBeatsPerMinute `xml:"InstantaneousBeatsPerMinute" json:"instantaneous_bpm"`
}

HeartRateVariabilityMetadataList BPM, not like Metadata above

type InstantaneousBeatsPerMinute

type InstantaneousBeatsPerMinute struct {
	BPM  string `xml:"bpm,attr" json:"bpm"`
	Time string `xml:"time,attr" json:"time"`
}

InstantaneousBeatsPerMinute Heart rate

type KeyCount

type KeyCount struct {
	Key   string `json:"key"`
	Count int    `json:"count"`
}

KeyCount helper to sort data in decreasing order

func (KeyCount) MarshalLogObject

func (k KeyCount) MarshalLogObject(enc zapcore.ObjectEncoder) error

type KeyCounts

type KeyCounts []KeyCount

func (KeyCounts) Len

func (k KeyCounts) Len() int

Len of KeyCounts for sort

func (KeyCounts) Less

func (k KeyCounts) Less(i, j int) bool

Less of KeyCounts for sort in decreasing order

func (KeyCounts) MarshalLogArray

func (k KeyCounts) MarshalLogArray(enc zapcore.ArrayEncoder) error

func (KeyCounts) Swap

func (k KeyCounts) Swap(i, j int)

Swap two KeyCounts sort interface

type Me

type Me struct {
	XMLName xml.Name `xml:"Me" json:"-"`
	// Attributes
	DateOfBirth   string `xml:"HKCharacteristicTypeIdentifierDateOfBirth,attr" json:"dob"`
	BiologicalSex string `xml:"HKCharacteristicTypeIdentifierBiologicalSex,attr" json:"biological_sex"`
	BloodType     string `xml:"HKCharacteristicTypeIdentifierBloodType,attr" json:"blood_type"`
	SkinType      string `xml:"HKCharacteristicTypeIdentifierFitzpatrickSkinType,attr" json:"skin_type"`
	MedicationUse string `xml:"HKCharacteristicTypeIdentifierCardioFitnessMedicationsUse,attr,omitempty" json:"medication_use,omitempty"`
}

Me XML element

func (Me) String

func (m Me) String() string

String describes Me

type MetadataEntry

type MetadataEntry struct {
	Key   string `xml:"key,attr" json:"key"`
	Value string `xml:"value,attr" json:"value"`
}

MetadataEntry Key/Value used across structures. Examples of MetadataEntry with Record.SourceName

AppleWatch: <MetadataEntry key="HKMetadataKeyHeartRateMotionContext" value="1"/>
MyFitnessPal: <MetadataEntry key="meal" value="Lunch"/>
MyFitnessPal: <MetadataEntry key="meal" value="Dinner"/>
MyFitnessPal: <MetadataEntry key="Meal" value="Dinner"/>
MyFitnessPal: <MetadataEntry key="Meal" value="Snacks"/>
AppleWatch: <MetadataEntry key="HKMetadataKeySyncVersion" value="1"/>
AppleWatch: <MetadataEntry key="HKMetadataKeySyncIdentifier" value="3:1B17A065-24BD-4C42-88C4-2185852AC39B:613580458.67789:613580909.63101:89"/>
AppleWatch: <MetadataEntry key="HKVO2MaxTestType" value="2"/>
AutoSleep: <MetadataEntry key="Recharge" value="100"/>
AutoSleep: <MetadataEntry key="Asleep" value="19020"/>
AutoSleep: <MetadataEntry key="Average HR" value="49.63"/>
AutoSleep: <MetadataEntry key="Rating" value="11.97"/>
AutoSleep: <MetadataEntry key="Daytime HR" value="68.35"/>
AutoSleep: <MetadataEntry key="Deep Sleep" value="1020"/>
AutoSleep: <MetadataEntry key="Lights" value="NO"/>
AutoSleep: <MetadataEntry key="Energy Threshold" value="1200"/>
AutoSleep: <MetadataEntry key="Nap" value="YES"/>
AutoSleep: <MetadataEntry key="Tags" value="1"/>
AutoSleep: <MetadataEntry key="Edit Slots" value="0415,0630,0500,0445,0530,0615,0430,0645,0515,0600,0545"/>
Sleep++ and Clock: <MetadataEntry key="HKTimeZone" value="America/Los_Angeles"/>
iPhone: <MetadataEntry key="HKMetadataKeyAppleDeviceCalibrated" value="1"/>

type NameTypeKeyCount

type NameTypeKeyCount struct {
	Name     string `json:"name,omitempty"`
	Type     string `json:"type,omitempty"`
	KeyCount `json:"data,omitempty"`
}

NameTypeKeyCount helper for containing Named KeyCounts

type NameTypeKeyCounts

type NameTypeKeyCounts []NameTypeKeyCount

NameTypeKeyCounts container for a "name" KeyCounts data

func (NameTypeKeyCounts) Len

func (k NameTypeKeyCounts) Len() int

Len of NameKeyCounts for sort

func (NameTypeKeyCounts) Less

func (k NameTypeKeyCounts) Less(i, j int) bool

Less of NameKeyCounts for sort in decreasing order of who has fewer Data Count

func (NameTypeKeyCounts) Swap

func (k NameTypeKeyCounts) Swap(i, j int)

Swap two NameKeyCounts sort interface

type Record

type Record struct {
	XMLName xml.Name `xml:"Record" json:"-"`
	// Attributes
	Type          string `xml:"type,attr" json:"type"`
	Unit          string `xml:"unit,attr,omitempty" json:"unit,omitempty"`
	Value         string `xml:"value,attr,omitempty" json:"value,omitempty"`
	SourceName    string `xml:"sourceName,attr" json:"source_name"`
	SourceVersion string `xml:"sourceVersion,attr,omitempty" json:"source_version,omitempty"`
	Device        string `xml:"device,attr,omitempty" json:"device,omitempty"`
	CreationDate  string `xml:"creationDate,attr,omitempty" json:"creation_date,omitempty"`
	StartDate     string `xml:"startDate,attr" json:"start_date"`
	EndDate       string `xml:"endDate,attr" json:"end_date"`
	// Elements
	MetadataEntries []MetadataEntry                    `xml:"MetadataEntry,omitempty" json:"metadata,omitempty"`
	HRV             []HeartRateVariabilityMetadataList `xml:"HeartRateVariabilityMetadataList,omitempty"  json:"hrv,omitempty"`
}

Record a typical record saved by various devices. A example is:

<Record type="HKQuantityTypeIdentifierBodyMassIndex" sourceName="Renpho" sourceVersion="4" unit="count" creationDate="2020-04-19 06:53:46 -0800" startDate="2020-04-14 05:51:27 -0800" endDate="2020-04-14 05:51:27 -0800" value="22.6"/>

func (Record) String

func (r Record) String() string

String describes a Record

type RecordMetadataKey

type RecordMetadataKey string

RecordMetadataKey Metadata keys

const (
	// Asleep example <MetadataEntry key="Asleep" value="20580"/>
	Asleep RecordMetadataKey = "Asleep"
	// AverageHR  record example <MetadataEntry key="Average HR" value="50.51"/>
	AverageHR RecordMetadataKey = "Average HR"
	// DaytimeHR record example <MetadataEntry key="Daytime HR" value="60.15"/>
	DaytimeHR RecordMetadataKey = "Daytime HR"
	// DeepSleep record example <MetadataEntry key="Deep Sleep" value="8053"/>
	DeepSleep RecordMetadataKey = "Deep Sleep"
	// DevicePlacementSide example <Record type="HKQuantityTypeIdentifierWalkingAsymmetryPercentage" ..>
	//    <MetadataEntry key="HKMetadataKeyDevicePlacementSide" value="2"/>
	DevicePlacementSide RecordMetadataKey = "HKMetadataKeyDevicePlacementSide"
	// EditSlots record example  <MetadataEntry key="Edit Slots" value="0415,0630,0500,0445,0530,0615,0430,0515,0545"/>
	EditSlots RecordMetadataKey = "Edit Slots"
	// EnergyThreshold record example <MetadataEntry key="Energy Threshold" value="1200"/>
	EnergyThreshold RecordMetadataKey = "Energy Threshold"
	// Calibrated example <MetadataEntry key="HKMetadataKeyAppleDeviceCalibrated" value="1"/>
	Calibrated RecordMetadataKey = "HKMetadataKeyAppleDeviceCalibrated"
	// MotionContext example <MetadataEntry key="HKMetadataKeyHeartRateMotionContext" value="1"/>
	MotionContext RecordMetadataKey = "HKMetadataKeyHeartRateMotionContext"
	// SyncID example <MetadataEntry key="HKMetadataKeySyncIdentifier" value="3:32FAC695-B2D3-4358-9154-CA13801043FA:613624195.01513:613624791.01513:119"/>
	SyncID RecordMetadataKey = "HKMetadataKeySyncIdentifier"
	// SyncVersion example <MetadataEntry key="HKMetadataKeySyncVersion" value="1"/>
	SyncVersion RecordMetadataKey = "HKMetadataKeySyncVersion"
	// RecordTimeZone example  <MetadataEntry key="HKTimeZone" value="America/Los_Angeles"/>
	RecordTimeZone RecordMetadataKey = "HKTimeZone"
	// HKVO2MaxTestType  <MetadataEntry key="HKVO2MaxTestType" value="2"/>
	HKVO2MaxTestType RecordMetadataKey = "HKVO2MaxTestType"
	// Lights example <MetadataEntry key="Lights" value="NO"/>
	Lights RecordMetadataKey = "Lights"
	// Meal <MetadataEntry key="Meal" value="Lunch"/> "Dinner" "Snacks" or "Breakfast"
	// meal is also seen in some records. Ignore case. <MetadataEntry key="meal" value="Lunch"/>
	Meal          RecordMetadataKey = "Meal"
	MealLowercase RecordMetadataKey = "meal"
	// Nap <MetadataEntry key="Nap" value="YES"/>
	Nap RecordMetadataKey = "Nap"
	// Rating examples <MetadataEntry key="Rating" value="7.62"/> or <MetadataEntry key="Rating" value="83.25"/>
	Rating RecordMetadataKey = "Rating"
	// Recharge example <MetadataEntry key="Recharge" value="9"/> or <MetadataEntry key="Recharge" value="100"/>
	Recharge RecordMetadataKey = "Recharge"
	// Tags example <MetadataEntry key="Tags" value="1"/>
	Tags RecordMetadataKey = "Tags"
)

type RecordMetadataKeys

type RecordMetadataKeys []RecordMetadataKey

func (RecordMetadataKeys) Len

func (r RecordMetadataKeys) Len() int

Len of RecordMetadataKeys for sort

func (RecordMetadataKeys) Less

func (r RecordMetadataKeys) Less(i, j int) bool

Less of RecordMetadataKeys for sort

func (RecordMetadataKeys) Swap

func (r RecordMetadataKeys) Swap(i, j int)

Swap two RecordMetadataKeys for sort

type RecordSource

type RecordSource string

RecordSource defines enum space of known "sourceName" in a Record

const (
	// AutoSleep eg: <Record type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="AutoSleep" sourceVersion="6.4.0" creationDate="2020-08-17 18:29:28 -0800" startDate="2020-08-16 22:00:00 -0800" endDate="2020-08-17 04:22:00 -0800" value="HKCategoryValueSleepAnalysisAsleep"/>
	AutoSleep RecordSource = "AutoSleep"
	// Clock eg:  <Record type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="Clock" sourceVersion="50" device="&lt;&lt;HKDevice: 0x283704280&gt;, name:iPhone, manufacturer:Apple, model:iPhone, hardware:iPhone9,4, software:11.0&gt;" creationDate="2017-09-24 06:01:00 -0800" startDate="2017-09-23 23:24:48 -0800" endDate="2017-09-24 06:00:52 -0800" value="HKCategoryValueSleepAnalysisInBed">
	Clock RecordSource = "Clock"
	// Headspace eg:  <Record type="HKCategoryTypeIdentifierMindfulSession" sourceName="Headspace" sourceVersion="10878" creationDate="2018-05-21 19:32:46 -0800" startDate="2018-05-21 19:21:15 -0800" endDate="2018-05-21 19:32:46 -0800"/>
	Headspace RecordSource = "Headspace"
	// MyFitnessPal eg: <Record type="HKQuantityTypeIdentifierBodyMass" sourceName="MyFitnessPal" sourceVersion="22314" unit="lb" creationDate="2019-01-21 20:50:22 -0800" startDate="2019-01-04 20:50:00 -0800" endDate="2019-01-04 20:50:00 -0800" value="185.078"/>
	MyFitnessPal RecordSource = "MyFitnessPal"
	// Pacer eg:  <Record type="HKQuantityTypeIdentifierActiveEnergyBurned" sourceName="Pacer" sourceVersion="3.9.1.307" unit="Cal" creationDate="2019-02-07 13:08:13 -0800" startDate="2019-02-07 12:15:00 -0800" endDate="2019-02-07 12:30:00 -0800" value="12.0754"/>
	Pacer RecordSource = "Pacer"
	// Renpho eg: <Record type="HKQuantityTypeIdentifierActiveEnergyBurned" sourceName="Pacer" sourceVersion="3.9.1.307" unit="Cal" creationDate="2019-02-07 13:08:13 -0800" startDate="2019-02-07 12:15:00 -0800" endDate="2019-02-07 12:30:00 -0800" value="12.0754"/>
	Renpho RecordSource = "Renpho"
	// SleepPP eg:  <Record type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="Sleep++" sourceVersion="58" creationDate="2019-05-27 13:41:31 -0800" startDate="2019-05-18 22:03:49 -0800" endDate="2019-05-19 02:47:07 -0800" value="HKCategoryValueSleepAnalysisAsleep">
	SleepPP RecordSource = "Sleep++"
	// SleepWatch eg: <Record type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="SleepWatch" sourceVersion="5.6.0.0" creationDate="2019-03-19 21:09:51 -0800" startDate="2019-03-12 21:55:00 -0800" endDate="2019-03-13 02:10:00 -0800" value="HKCategoryValueSleepAnalysisInBed"/>
	SleepWatch RecordSource = "SleepWatch"
	// IPhone eg: <Record type="HKQuantityTypeIdentifierStepCount" sourceName="🔜" sourceVersion="10.1.1" device="&lt;&lt;HKDevice: 0x283714aa0&gt;, name:iPhone, manufacturer:Apple, model:iPhone, hardware:iPhone9,4, software:10.1.1&gt;" unit="count" creationDate="2016-12-08 19:46:37 -0800" startDate="2016-12-08 19:20:57 -0800" endDate="2016-12-08 19:21:58 -0800" value="9"/>
	IPhone RecordSource = "🔜"
	// AppleWatch eg: <Record type="HKQuantityTypeIdentifierHeartRate" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x283735e00&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" unit="count/min" creationDate="2018-10-22 17:30:36 -0800" startDate="2018-10-22 17:26:28 -0800" endDate="2018-10-22 17:26:28 -0800" value="64">
	AppleWatch RecordSource = "🕛🕐🕑🕒"
)

type RecordSources

type RecordSources []RecordSource

RecordSources slice of "sourceName" values known so far

func (RecordSources) Len

func (r RecordSources) Len() int

Len of RecordSources for sort

func (RecordSources) Less

func (r RecordSources) Less(i, j int) bool

Less of RecordSources for sort

func (RecordSources) Swap

func (r RecordSources) Swap(i, j int)

Swap two RecordTypes sort interface

type RecordType

type RecordType string

RecordType all Record types seen so far

const (
	// AppleStandHour eg: <Record type="HKCategoryTypeIdentifierAppleStandHour" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x2834ef0c0&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" creationDate="2018-10-23 08:10:57 -0800" startDate="2018-10-23 08:00:00 -0800" endDate="2018-10-23 09:00:00 -0800" value="HKCategoryValueAppleStandHourStood"/>
	AppleStandHour RecordType = "HKCategoryTypeIdentifierAppleStandHour"
	// HandwashingEvent eg: <Record type="HKCategoryTypeIdentifierHandwashingEvent" sourceName="🕛🕐🕑🕒" sourceVersion="5.3" creationDate="2020-09-20 07:24:43 -0800" startDate="2020-09-20 07:24:08 -0800" endDate="2020-09-20 07:24:43 -0800"/>
	HandwashingEvent RecordType = "HKCategoryTypeIdentifierHandwashingEvent"
	// MindfulSession eg: <Record type="HKCategoryTypeIdentifierMindfulSession" sourceName="Headspace" sourceVersion="10878" creationDate="2018-05-21 19:32:46 -0800" startDate="2018-05-21 19:21:15 -0800" endDate="2018-05-21 19:32:46 -0800"/>
	MindfulSession RecordType = "HKCategoryTypeIdentifierMindfulSession"
	// SleepAnalysis eg: <Record type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="Clock" sourceVersion="50" device="&lt;&lt;HKDevice: 0x283704280&gt;, name:iPhone, manufacturer:Apple, model:iPhone, hardware:iPhone9,4, software:11.0&gt;" creationDate="2017-09-23 06:01:10 -0800" startDate="2017-09-22 23:49:16 -0800" endDate="2017-09-23 06:01:10 -0800" value="HKCategoryValueSleepAnalysisInBed">
	SleepAnalysis RecordType = "HKCategoryTypeIdentifierSleepAnalysis"
	// ActiveEnergyBurned eg: <Record type="HKQuantityTypeIdentifierActiveEnergyBurned" sourceName="🕛🕐🕑🕒" sourceVersion="7.0.1" device="&lt;&lt;HKDevice: 0x2834eed50&gt;, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch4,2, software:7.0.1&gt;" unit="Cal" creationDate="2020-10-05 12:30:30 -0800" startDate="2020-10-05 12:29:55 -0800" endDate="2020-10-05 12:30:05 -0800" value="0.041"/>
	ActiveEnergyBurned RecordType = "HKQuantityTypeIdentifierActiveEnergyBurned"
	// AppleExerciseTime eg: <Record type="HKQuantityTypeIdentifierAppleExerciseTime" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x2837100a0&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" unit="min" creationDate="2018-10-23 10:55:55 -0800" startDate="2018-10-23 10:54:40 -0800" endDate="2018-10-23 10:55:40 -0800" value="1"/>
	AppleExerciseTime RecordType = "HKQuantityTypeIdentifierAppleExerciseTime"
	// AppleStandTime eg: <Record type="HKQuantityTypeIdentifierAppleStandTime" sourceName="🕛🕐🕑🕒" unit="min" creationDate="2019-09-19 17:10:11 -0800" startDate="2019-09-19 17:05:00 -0800" endDate="2019-09-19 17:10:00 -0800" value="2"/>
	AppleStandTime RecordType = "HKQuantityTypeIdentifierAppleStandTime"
	// BasalEnergyBurned eg: <Record type="HKQuantityTypeIdentifierBasalEnergyBurned" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x2837100a0&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" unit="Cal" creationDate="2018-10-22 17:40:20 -0800" startDate="2018-10-22 17:24:09 -0800" endDate="2018-10-22 17:38:00 -0800" value="20.157"/>
	BasalEnergyBurned RecordType = "HKQuantityTypeIdentifierBasalEnergyBurned"
	// BodyFatPercentage eg:  <Record type="HKQuantityTypeIdentifierBodyFatPercentage" sourceName="Renpho" sourceVersion="4" unit="%" creationDate="2020-04-19 06:53:44 -0800" startDate="2020-04-15 05:58:55 -0800" endDate="2020-04-15 05:58:55 -0800" value="0.161"/>
	BodyFatPercentage RecordType = "HKQuantityTypeIdentifierBodyFatPercentage"
	// BodyMass eg: <Record type="HKQuantityTypeIdentifierBodyMass" sourceName="🔜" sourceVersion="14.2" unit="lb" creationDate="2020-10-05 12:02:41 -0800" startDate="2020-10-05 12:02:41 -0800" endDate="2020-10-05 12:02:41 -0800" value="140"/>
	BodyMass RecordType = "HKQuantityTypeIdentifierBodyMass"
	// BodyMassIndex eg: <Record type="HKQuantityTypeIdentifierBodyMassIndex" sourceName="Renpho" sourceVersion="4" unit="count" creationDate="2020-04-19 06:53:45 -0800" startDate="2020-04-14 14:48:12 -0800" endDate="2020-04-14 14:48:12 -0800" value="22.2"/>
	BodyMassIndex RecordType = "HKQuantityTypeIdentifierBodyMassIndex"
	// DietaryCalcium eg: <Record type="HKQuantityTypeIdentifierDietaryCalcium" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="75.6628">
	DietaryCalcium RecordType = "HKQuantityTypeIdentifierDietaryCalcium"
	// DietaryCarbohydrates eg:  <Record type="HKQuantityTypeIdentifierDietaryCarbohydrates" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 20:53:07 -0800" startDate="2018-12-28 17:57:00 -0800" endDate="2018-12-28 17:57:00 -0800" value="39.94">
	DietaryCarbohydrates RecordType = "HKQuantityTypeIdentifierDietaryCarbohydrates"
	// DietaryCholesterol eg:  <Record type="HKQuantityTypeIdentifierDietaryCholesterol" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="262.157">
	DietaryCholesterol RecordType = "HKQuantityTypeIdentifierDietaryCholesterol"
	// DietaryEnergyConsumed eg: <Record type="HKQuantityTypeIdentifierDietaryEnergyConsumed" sourceName="MyFitnessPal" sourceVersion="22314" unit="Cal" creationDate="2018-12-28 15:44:53 -0800" startDate="2018-12-28 15:44:00 -0800" endDate="2018-12-28 15:44:00 -0800" value="741">
	DietaryEnergyConsumed RecordType = "HKQuantityTypeIdentifierDietaryEnergyConsumed"
	// DietaryFatMonounsaturated eg:  <Record type="HKQuantityTypeIdentifierDietaryFatMonounsaturated" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="7.979">
	DietaryFatMonounsaturated RecordType = "HKQuantityTypeIdentifierDietaryFatMonounsaturated"
	// DietaryFatPolyunsaturated eg: <Record type="HKQuantityTypeIdentifierDietaryFatPolyunsaturated" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="2.0911">
	DietaryFatPolyunsaturated RecordType = "HKQuantityTypeIdentifierDietaryFatPolyunsaturated"
	// DietaryFatSaturated eg: <Record type="HKQuantityTypeIdentifierDietaryFatSaturated" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="11.0707">
	DietaryFatSaturated RecordType = "HKQuantityTypeIdentifierDietaryFatSaturated"
	// DietaryFatTotal eg: <Record type="HKQuantityTypeIdentifierDietaryFatTotal" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="39.0836">
	DietaryFatTotal RecordType = "HKQuantityTypeIdentifierDietaryFatTotal"
	// DietaryFiber eg: <Record type="HKQuantityTypeIdentifierDietaryFiber" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 15:44:54 -0800" startDate="2018-12-28 15:44:00 -0800" endDate="2018-12-28 15:44:00 -0800" value="0">
	DietaryFiber RecordType = "HKQuantityTypeIdentifierDietaryFiber"
	// DietaryIron eg:  <Record type="HKQuantityTypeIdentifierDietaryIron" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="4.1756">
	DietaryIron RecordType = "HKQuantityTypeIdentifierDietaryIron"
	// DietaryPotassium eg: <Record type="HKQuantityTypeIdentifierDietaryPotassium" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="915.111">
	DietaryPotassium RecordType = "HKQuantityTypeIdentifierDietaryPotassium"
	// DietaryProtein eg: <Record type="HKQuantityTypeIdentifierDietaryProtein" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="81.2453">
	DietaryProtein RecordType = "HKQuantityTypeIdentifierDietaryProtein"
	// DietarySodium eg: <Record type="HKQuantityTypeIdentifierDietarySodium" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="941.965">
	DietarySodium RecordType = "HKQuantityTypeIdentifierDietarySodium"
	// DietarySugar eg: <Record type="HKQuantityTypeIdentifierDietarySugar" sourceName="MyFitnessPal" sourceVersion="22314" unit="g" creationDate="2018-12-28 20:53:08 -0800" startDate="2018-12-28 17:57:00 -0800" endDate="2018-12-28 17:57:00 -0800" value="25.54">
	DietarySugar RecordType = "HKQuantityTypeIdentifierDietarySugar"
	// DietaryVitaminC eg: <Record type="HKQuantityTypeIdentifierDietaryVitaminC" sourceName="MyFitnessPal" sourceVersion="22314" unit="mg" creationDate="2018-12-28 22:28:18 -0800" startDate="2018-12-28 22:27:00 -0800" endDate="2018-12-28 22:27:00 -0800" value="22.7521">
	DietaryVitaminC RecordType = "HKQuantityTypeIdentifierDietaryVitaminC"
	// DistanceWalkingRunning eg: <Record type="HKQuantityTypeIdentifierDistanceWalkingRunning" sourceName="🕛🕐🕑🕒" sourceVersion="7.1" device="&lt;&lt;HKDevice: 0x283704460&gt;, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch4,2, software:7.1&gt;" unit="mi" creationDate="2020-12-01 15:42:18 -0800" startDate="2020-12-01 15:42:12 -0800" endDate="2020-12-01 15:42:14 -0800" value="0.00153413"/>
	DistanceWalkingRunning RecordType = "HKQuantityTypeIdentifierDistanceWalkingRunning"
	// FlightsClimbed eg:   <Record type="HKQuantityTypeIdentifierFlightsClimbed" sourceName="🔜" sourceVersion="10.1.1" device="&lt;&lt;HKDevice: 0x2834f21c0&gt;, name:iPhone, manufacturer:Apple, model:iPhone, hardware:iPhone9,4, software:10.1.1&gt;" unit="count" creationDate="2016-12-10 15:57:14 -0800" startDate="2016-12-10 15:08:33 -0800" endDate="2016-12-10 15:08:33 -0800" value="1"/>
	FlightsClimbed RecordType = "HKQuantityTypeIdentifierFlightsClimbed"
	// EnvironmentalAudioExposure eg:  <Record type="HKQuantityTypeIdentifierEnvironmentalAudioExposure" sourceName="🕛🕐🕑🕒" sourceVersion="6.1" device="&lt;&lt;HKDevice: 0x2837080a0&gt;, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch4,2, software:6.1&gt;" unit="dBASPL" creationDate="2019-10-31 06:09:24 -0800" startDate="2019-10-31 06:01:21 -0800" endDate="2019-10-31 06:01:41 -0800" value="62.1341"/>
	EnvironmentalAudioExposure RecordType = "HKQuantityTypeIdentifierEnvironmentalAudioExposure"
	// HeadphoneAudioExposure eg: <Record type="HKQuantityTypeIdentifierHeadphoneAudioExposure" sourceName="🔜" sourceVersion="13.0" device="&lt;&lt;HKDevice: 0x283737ed0&gt;, name:AirPods, manufacturer:Apple Inc., model:0x2002, localIdentifier:60:F4:45:EC:48:62-tacl&gt;" unit="dBASPL" creationDate="2019-09-24 11:13:28 -0800" startDate="2019-09-24 11:09:58 -0800" endDate="2019-09-24 11:10:07 -0800" value="71.7391"/>
	HeadphoneAudioExposure RecordType = "HKQuantityTypeIdentifierHeadphoneAudioExposure"
	// HeartRate eg:  <Record type="HKQuantityTypeIdentifierHeartRate" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x283735e00&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" unit="count/min" creationDate="2018-10-22 17:20:16 -0800" startDate="2018-10-22 17:16:02 -0800" endDate="2018-10-22 17:16:02 -0800" value="60">
	HeartRate RecordType = "HKQuantityTypeIdentifierHeartRate"
	// HeartRateVariabilitySDNN eg: <Record type="HKQuantityTypeIdentifierHeartRateVariabilitySDNN" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" device="&lt;&lt;HKDevice: 0x28347bac0&gt;, name:Apple Watch, manufacturer:Apple, model:Watch, hardware:Watch4,2, software:5.0.1&gt;" unit="ms" creationDate="2018-10-24 10:16:25 -0800" startDate="2018-10-24 10:15:20 -0800" endDate="2018-10-24 10:16:25 -0800" value="67.1854">
	HeartRateVariabilitySDNN RecordType = "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
	// Height eg: <Record type="HKQuantityTypeIdentifierHeight" sourceName="🔜" sourceVersion="10.1.1" unit="ft" creationDate="2016-12-08 20:06:35 -0800" startDate="2016-12-08 20:06:35 -0800" endDate="2016-12-08 20:06:35 -0800" value="5.5"/>
	Height RecordType = "HKQuantityTypeIdentifierHeight"
	// LeanBodyMass eg: <Record type="HKQuantityTypeIdentifierLeanBodyMass" sourceName="Renpho" sourceVersion="4" unit="lb" creationDate="2020-04-19 06:53:44 -0800" startDate="2020-04-15 05:58:55 -0800" endDate="2020-04-15 05:58:55 -0800" value="115.8"/>
	LeanBodyMass RecordType = "HKQuantityTypeIdentifierLeanBodyMass"
	// RestingHeartRate eg:
	//   <Record type="HKQuantityTypeIdentifierRestingHeartRate" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" unit="count/min" creationDate="2018-10-27 20:40:57 -0800" startDate="2018-10-27 18:28:47 -0800" endDate="2018-10-27 20:37:20 -0800" value="59"/>
	RestingHeartRate RecordType = "HKQuantityTypeIdentifierRestingHeartRate"
	// SixMinuteWalkTestDistance eg:
	//   <Record type="HKQuantityTypeIdentifierSixMinuteWalkTestDistance" sourceName="🔜" sourceVersion="2420.8.11" unit="m" creationDate="2020-11-12 18:31:58 -0800" startDate="2020-11-12 18:31:49 -0800" endDate="2020-11-12 18:31:49 -0800" value="500">
	SixMinuteWalkTestDistance RecordType = "HKQuantityTypeIdentifierSixMinuteWalkTestDistance"
	// StepCount eg: <Record type="HKQuantityTypeIdentifierStepCount" sourceName="🔜" sourceVersion="10.1.1" device="&lt;&lt;HKDevice: 0x283714aa0&gt;, name:iPhone, manufacturer:Apple, model:iPhone, hardware:iPhone9,4, software:10.1.1&gt;" unit="count" creationDate="2016-12-09 09:52:21 -0800" startDate="2016-12-09 09:37:52 -0800" endDate="2016-12-09 09:43:12 -0800" value="155"/>
	StepCount RecordType = "HKQuantityTypeIdentifierStepCount"
	// VO2Max eg:
	//   <Record type="HKQuantityTypeIdentifierVO2Max" sourceName="🕛🕐🕑🕒" unit="mL/min·kg" creationDate="2018-12-19 17:49:50 -0800" startDate="2018-12-19 17:49:50 -0800" endDate="2018-12-19 17:49:50 -0800" value="32.7204">
	VO2Max RecordType = "HKQuantityTypeIdentifierVO2Max"
	// WalkingAsymmetryPercentage A quantity sample measuring the percentage of steps in which one foot moves at a
	// different speed than the other when walking steadily over flat ground. eg:
	//     <Record type="HKQuantityTypeIdentifierWalkingAsymmetryPercentage" sourceName="Dharti Shah’s iPhone" sourceVersion="14.0" device="&lt;&lt;HKDevice: 0x281326260&gt;, name:iPhone, manufacturer:Apple Inc., model:iPhone, hardware:iPhone12,3, software:14.0&gt;" unit="%" creationDate="2020-09-16 17:56:41 -0800" startDate="2020-09-16 17:52:45 -0800" endDate="2020-09-16 17:53:09 -0800" value="0.07">
	//        <MetadataEntry key="HKMetadataKeyDevicePlacementSide" value="2"/>
	//    </Record>
	WalkingAsymmetryPercentage RecordType = "HKQuantityTypeIdentifierWalkingAsymmetryPercentage"
	// WalkingDoubleSupportPercentage A quantity sample that measures the percentage of time when both of the user’s feet
	// are touching the ground while walking steadily over flat ground. eg:
	//      <Record type="HKQuantityTypeIdentifierWalkingDoubleSupportPercentage" sourceName="Dharti Shah’s iPhone" sourceVersion="14.0" device="&lt;&lt;HKDevice: 0x28134ec60&gt;, name:iPhone, manufacturer:Apple Inc., model:iPhone, hardware:iPhone12,3, software:14.0&gt;" unit="%" creationDate="2020-09-16 18:35:24 -0800" startDate="2020-09-16 18:33:42 -0800" endDate="2020-09-16 18:34:15 -0800" value="0.294"/>
	WalkingDoubleSupportPercentage RecordType = "HKQuantityTypeIdentifierWalkingDoubleSupportPercentage"
	// WalkingHeartRateAverage eg:
	//   <Record type="HKQuantityTypeIdentifierWalkingHeartRateAverage" sourceName="🕛🕐🕑🕒" sourceVersion="5.0.1" unit="count/min" creationDate="2018-10-28 15:27:01 -0800" startDate="2018-10-27 23:03:10 -0800" endDate="2018-10-28 15:26:56 -0800" value="97.5"/>
	WalkingHeartRateAverage RecordType = "HKQuantityTypeIdentifierWalkingHeartRateAverage"
	// WalkingSpeed eg:  2.52774 mi/hr
	//   <Record type="HKQuantityTypeIdentifierWalkingSpeed" sourceName="Dharti Shah’s iPhone" sourceVersion="14.2" device="&lt;&lt;HKDevice: 0x28135db30&gt;, name:iPhone, manufacturer:Apple Inc., model:iPhone, hardware:iPhone12,3, software:14.2&gt;" unit="mi/hr" creationDate="2021-01-02 11:07:49 -0800" startDate="2021-01-02 11:03:45 -0800" endDate="2021-01-02 11:03:58 -0800" value="2.52774"/>
	WalkingSpeed RecordType = "HKQuantityTypeIdentifierWalkingSpeed"
	// WalkingStepLength eg: 17.3228 in step
	//   <Record type="HKQuantityTypeIdentifierWalkingStepLength" sourceName="Dharti Shah’s iPhone" sourceVersion="14.0" device="&lt;&lt;HKDevice: 0x281307c50&gt;, name:iPhone, manufacturer:Apple Inc., model:iPhone, hardware:iPhone12,3, software:14.0&gt;" unit="in" creationDate="2020-09-18 08:16:42 -0800" startDate="2020-09-18 07:49:05 -0800" endDate="2020-09-18 07:49:10 -0800" value="17.3228"/>
	WalkingStepLength RecordType = "HKQuantityTypeIdentifierWalkingStepLength"
	// All get all available Records
	All RecordType = "All"
)

type RecordTypes

type RecordTypes []RecordType // Array of RecordTypes

func (RecordTypes) Len

func (r RecordTypes) Len() int

Len of RecordTypes for sort

func (RecordTypes) Less

func (r RecordTypes) Less(i, j int) bool

Less of RecordTypes for sort

func (RecordTypes) Swap

func (r RecordTypes) Swap(i, j int)

Swap two RecordTypes sort interface

type SensitivityPoint

type SensitivityPoint struct {
	XMLName xml.Name `xml:"SensitivityPoint" json:"-"`
	// Attributes
	FrequencyValue string `xml:"frequencyValue" json:"frequency_value"`
	FrequencyUnit  string `xml:"frequencyUnit" json:"frequency_unit"`
	LeftEarValue   string `xml:"leftEarValue,omitempty" json:"left_ear_value,omitempty"`
	LeftEarUnit    string `xml:"leftEarUnit,omitempty" json:"left_ear_unit,omitempty"`
	RightEarValue  string `xml:"rightEarValue,omitempty" json:"right_ear_value,omitempty"`
	RightEarUnit   string `xml:"rightEarUnit,omitempty" json:"right_ear_unit,omitempty"`
}

SensitivityPoint microphone data

type WalkerData

type WalkerData struct {
	StepCount              []WalkingDataElement `json:"step_count"`
	DistanceWalkingRunning []WalkingDataElement `json:"distance_walking_running"`
}

WalkerData holds step count and walking orr running distance

type WalkingDataElement

type WalkingDataElement struct {
	YYYYMMDD   string  `json:"yyyymmdd"` // CreationDate truncated to CreationDate in format "YYYY-MM-DD"
	SourceName string  `json:"source"`
	Unit       string  `json:"unit,omitempty"`
	Value      float32 `json:"value"`
	Count      int     `json:"count"`
}

WalkingDataElement for daily StepCount and DistanceWalkingRunning

type WorkOutActivityType

type WorkOutActivityType string

WorkOutActivityType all activity types seen

type WorkOutActivityTypes

type WorkOutActivityTypes []WorkOutActivityType

WorkOutActivityTypes all activity types seen

func (WorkOutActivityTypes) Len

func (w WorkOutActivityTypes) Len() int

Len of WorkOutActivityTypes for sort

func (WorkOutActivityTypes) Less

func (w WorkOutActivityTypes) Less(i, j int) bool

Less of WorkOutActivityTypes for sort

func (WorkOutActivityTypes) Swap

func (w WorkOutActivityTypes) Swap(i, j int)

Swap two WorkOutActivityTypes for sort

type Workout

type Workout struct {
	XMLName xml.Name `xml:"Workout"  json:"-"`
	// attributes
	ActivityType          string `xml:"workoutActivityType,attr" json:"activity_type"`
	Duration              string `xml:"duration,attr,omitempty" json:"duration,omitempty"`
	DurationUnit          string `xml:"durationUnit,attr,omitempty" json:"duration_unit,omitempty"`
	TotalDistance         string `xml:"totalDistance,attr,omitempty" json:"total_distance,omitempty"`
	TotalDistanceUnit     string `xml:"totalDistanceUnit,attr,omitempty" json:"total_distance_unit,omitempty"`
	TotalEnergyBurned     string `xml:"totalEnergyBurned,attr,omitempty" json:"total_energy_burned,omitempty"`
	TotalEnergyBurnedUnit string `xml:"totalEnergyBurnedUnit,attr,omitempty" json:"total_energy_burned_unit,omitempty"`
	SourceName            string `xml:"sourceName,attr" json:"source_name"`
	SourceVersion         string `xml:"sourceVersion,attr,omitempty" json:"source_version,omitempty"`
	Device                string `xml:"device,attr,omitempty" json:"device,omitempty"`
	CreationDate          string `xml:"creationDate,attr,omitempty" json:"creation_date,omitempty"`
	StartDate             string `xml:"startDate,attr" json:"start_date"`
	EndDate               string `xml:"endDate,attr" json:"end_date"`
	// Elements
	MetadataEntries []MetadataEntry `xml:"MetadataEntry,omitempty" json:"metadata,omitempty"`
	Events          []WorkoutEvent  `xml:"WorkoutEvent,omitempty" json:"events,omitempty"`
	Routes          []WorkoutRoute  `xml:"WorkoutRoute,omitempty" json:"routes,omitempty"`
}

Workout key workout element.

type WorkoutEvent

type WorkoutEvent struct {
	XMLName xml.Name `xml:"WorkoutEvent" json:"-"`
	// Attributes
	Type         string `xml:"type,attr" json:"type"`
	Date         string `xml:"date,attr" json:"date"`
	Duration     string `xml:"duration,attr,omitempty" json:"duration,omitempty"`
	DurationUnit string `xml:"durationUnit,attr,omitempty" json:"duration_unit,omitempty"`
}

WorkoutEvent element outlines the Type and Duration of workout

type WorkoutMetadataKey

type WorkoutMetadataKey string

WorkoutMetadataKey Metadata keys

const (
	// AverageMETs example <MetadataEntry key="HKAverageMETs" value="5.11259 kcal/hr·kg"/>
	AverageMETs WorkoutMetadataKey = "HKAverageMETs"
	// ElevationAscended <MetadataEntry key="HKElevationAscended" value="67254 cm"/>
	ElevationAscended WorkoutMetadataKey = "HKElevationAscended"
	// IndoorWorkout <MetadataEntry key="HKIndoorWorkout" value="1"/> or "0"
	IndoorWorkout WorkoutMetadataKey = "HKIndoorWorkout"
	// TimeZone <MetadataEntry key="HKTimeZone" value="America/Los_Angeles"/>
	TimeZone WorkoutMetadataKey = "HKTimeZone"
	// Humidity  <MetadataEntry key="HKWeatherHumidity" value="10000 %"/>
	Humidity WorkoutMetadataKey = "HKWeatherHumidity"
	// Temperature <MetadataEntry key="HKWeatherTemperature" value="54 degF"/>
	Temperature WorkoutMetadataKey = "HKWeatherTemperature"
)

type WorkoutMetadataKeys

type WorkoutMetadataKeys []WorkoutMetadataKey

WorkoutMetadataKeys slice of multiple WorkoutMetadataKey items

func (WorkoutMetadataKeys) Len

func (w WorkoutMetadataKeys) Len() int

Len of WorkoutMetadataKeys for sort

func (WorkoutMetadataKeys) Less

func (w WorkoutMetadataKeys) Less(i, j int) bool

Less of WorkoutMetadataKeys for sort

func (WorkoutMetadataKeys) Swap

func (w WorkoutMetadataKeys) Swap(i, j int)

Swap two WorkoutMetadataKeys for sort

type WorkoutRoute

type WorkoutRoute struct {
	XMLName xml.Name `xml:"WorkoutRoute" json:"-"`
	// Attributes
	SourceName    string `xml:"sourceName,attr" json:"source_name"`
	SourceVersion string `xml:"sourceVersion,attr,omitempty" json:"source_version,omitempty"`
	Device        string `xml:"device,attr,omitempty" json:"device,omitempty"`
	CreationDate  string `xml:"creationDate,attr,omitempty" json:"creation_date,omitempty"`
	StartDate     string `xml:"startDate,attr" json:"start_date"`
	EndDate       string `xml:"endDate,attr" json:"end_date"`
	// Elements
	MetadataEntries []MetadataEntry `xml:"MetadataEntry" json:"metadata"`
	FileReference   []FileReference `xml:"FileReference" json:"file_reference"`
}

WorkoutRoute gpx data file name with the route

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL