OCKCarePlanEventResult Class Reference

Inherits from NSObject
Conforms to NSCopying
NSSecureCoding
Declared in OCKCarePlanEventResult.h

The ‘OCKCarePlanEventResult'class defines a result object for an OCKCarePlanEvent object. Create an instance of this class and attach it to an event using the OCKCarePlanStore API.

To avoid saving duplicates of health data, use the HealthKit category for an HKSample object that is already in HealthKit. Simply pass in the HKSample object with value formatting parameters. OCKCarePlanStore stores only the UUID and sample type from an HKSample object. The OCKCarePlanStore object uses the UUID and type to fetch the actual sample object from HealthKit.

An OCKCarePlanEventResult object uses the HKSample object with the value formatting parameters to populate valueString and unitString.

Other Methods

– initWithValueString:unitString:userInfo:values:

Initializer for creating an OCKCarePlanEventResult instance. Attach the created instance to an OCKCarePlanEvent object using the OCKCarePlanStore API.

- (instancetype)initWithValueString:(NSString *)valueString unitString:(NSString *)unitString userInfo:(nullable NSDictionary<NSString*,id<NSCoding> > *)userInfo values:(nullable NSArray<NSNumber*> *)values

Parameters

valueString

Value string to be displayed to the user.

unitString

Unit string to be displayed to the user.

userInfo

Dictionary to save any additional objects that comply with the NSCoding protocol.

values

The array of numeric values associated with the result. These values can be used to evaluate thresholds.

Return Value

Initialized instance.

Declared In

OCKCarePlanEventResult.h

  creationDate

The time the result object is created.

@property (nonatomic, readonly) NSDate *creationDate

Declared In

OCKCarePlanEventResult.h

  valueString

A representative value string.

@property (nonatomic, copy, readonly) NSString *valueString

Declared In

OCKCarePlanEventResult.h

  unitString

A representative unit string for the value string.

@property (nonatomic, copy, readonly, nullable) NSString *unitString

Declared In

OCKCarePlanEventResult.h

  values

An array of values associated with the result to use for threshold checking (max length 2).

@property (nonatomic, copy, readonly, nullable) NSArray<NSNumber*> *values

Declared In

OCKCarePlanEventResult.h

  userInfo

Use this dictionary to store objects that comply with the NSCoding protocol.

@property (nonatomic, copy, readonly, nullable) NSDictionary<NSString*id<NSCoding> > *userInfo

Declared In

OCKCarePlanEventResult.h

HealthKit Methods

– initWithQuantitySample:quantityStringFormatter:displayUnit:displayUnitStringKey:userInfo:

Initializer for creating an OCKCarePlanEventResult instance with an HKQuantitySample object. Attach the created instance to an OCKCarePlanEvent object using the OCKCarePlanStore API.

- (instancetype)initWithQuantitySample:(HKQuantitySample *)quantitySample quantityStringFormatter:(nullable NSNumberFormatter *)quantityStringFormatter displayUnit:(HKUnit *)displayUnit displayUnitStringKey:(NSString *)displayUnitStringKey userInfo:(nullable NSDictionary<NSString*,id<NSCoding> > *)userInfo

Parameters

quantitySample

An HKQuantitySample object that is in HealthKit.

quantityStringFormatter

A formatter formats the quantity value to valueString.

displayUnit

A preferred HKUnit object for displaying the value.

displayUnitStringKey

A localized string key of the unit.

userInfo

Dictionary to save any additional objects that comply with the NSCoding protocol.

Return Value

Initialized instance.

Declared In

OCKCarePlanEventResult.h

– initWithQuantitySample:quantityStringFormatter:unitStringKeys:userInfo:

Initializer for creating an OCKCarePlanEventResult instance with an HKQuantitySample object. Attach the created instance to an OCKCarePlanEvent object using the OCKCarePlanStore API.

- (instancetype)initWithQuantitySample:(HKQuantitySample *)quantitySample quantityStringFormatter:(nullable NSNumberFormatter *)quantityStringFormatter unitStringKeys:(NSDictionary<HKUnit*,NSString*> *)unitStringKeys userInfo:(nullable NSDictionary<NSString*,id<NSCoding> > *)userInfo

Parameters

quantitySample

An HKQuantitySample object that is in HealthKit.

quantityStringFormatter

A formatter formats the quantity value to valueString.

unitStringKeys

A dictionary of localized string keys for possible system preferred units.

userInfo

Dictionary to save any additional objects that comply with the NSCoding protocol.

Return Value

Initialized instance.

Declared In

OCKCarePlanEventResult.h

– initWithCorrelation:quantityStringFormatter:displayUnit:unitStringKeys:userInfo:

Initializer for creating an OCKCarePlanEventResult instance with an HKCorrelation object. Attach the created instance to an OCKCarePlanEvent object using the OCKCarePlanStore API.

- (instancetype)initWithCorrelation:(HKCorrelation *)correlation quantityStringFormatter:(nullable NSNumberFormatter *)quantityStringFormatter displayUnit:(nullable HKUnit *)displayUnit unitStringKeys:(NSDictionary<HKUnit*,NSString*> *)unitStringKeys userInfo:(nullable NSDictionary<NSString*,id<NSCoding> > *)userInfo

Parameters

correlation

A correlation object that is in HealthKit. (Currently only supports correlation with type HKCorrelationTypeIdentifierBloodPressure)

quantityStringFormatter

A formatter formats the systolic and diastolic blood pressure value to valueString.

displayUnit

A preferred HKUnit object for displaying the value.

unitStringKeys

A dictionary of localized string keys for possible units.

userInfo

Dictionary to save any additional objects that comply with the NSCoding protocol.

Return Value

Initialized instance.

Declared In

OCKCarePlanEventResult.h

– initWithCategorySample:categoryValueStringKeys:userInfo:

Initializer for creating an OCKCarePlanEventResult instance with an HKCategorySample object. Attach the created instance to an OCKCarePlanEvent object using the OCKCarePlanStore API.

- (instancetype)initWithCategorySample:(HKCategorySample *)categorySample categoryValueStringKeys:(NSDictionary<NSNumber*,NSString*> *)categoryValueStringKeys userInfo:(nullable NSDictionary<NSString*,id<NSCoding> > *)userInfo

Parameters

categorySample

A HKCategorySample object that is in HealthKit.

categoryValueStringKeys

An dictionary of localized string keys for the enum values in the HKCategorySample.

userInfo

Dictionary to save any additional objects that comply with the NSCoding protocol.

Return Value

Initialized instance.

Declared In

OCKCarePlanEventResult.h

  sampleUUID

UUID of the HKSample object.

@property (nonatomic, strong, readonly, nullable) NSUUID *sampleUUID

Declared In

OCKCarePlanEventResult.h

  sampleType

Type of the HKSample object.

@property (nonatomic, strong, readonly, nullable) HKSampleType *sampleType

Declared In

OCKCarePlanEventResult.h

  displayUnit

Prefered HKUnit object for displaying the value for an HKQuantitySample or HKCorrelation object. If this attribute is nil, the OCKCarePlanEventResult object uses a system preferred HKUnit object.

@property (nonatomic, strong, readonly, nullable) HKUnit *displayUnit

Declared In

OCKCarePlanEventResult.h

  unitStringKeys

Localized string keys for units. If you provide a display unit, then this dictionary only contains one string key for the display unit. Otherwise, you need to provide string keys for all possible system preferred HKUnit objects. This attribute only applies when the sample is HKQuantitySample or HKCorrelation type.

@property (nonatomic, copy, readonly, nullable) NSDictionary<HKUnit*NSString*> *unitStringKeys

Declared In

OCKCarePlanEventResult.h

  quantityStringFormatter

Formats the quantity value of an HKQuantitySample object to value string.

@property (nonatomic, strong, readonly, nullable) NSNumberFormatter *quantityStringFormatter

Discussion

If formatter is nil, framework uses [NSNumberFormatter localizedStringFromNumber:@(value) numberStyle:NSNumberFormatterDecimalStyle]. This attribute only applies when the sample is HKQuantitySample or HKCorrelation type.

Declared In

OCKCarePlanEventResult.h

  categoryValueStringKeys

Localized string keys for the enum values in the HKCategorySample. The OCKCarePlanEventResult object use this string dictionary to map an enum value to a string. This attribute only applies when the sample is HKCategorySample type.

@property (nonatomic, copy, readonly, nullable) NSDictionary<NSNumber*NSString*> *categoryValueStringKeys

Declared In

OCKCarePlanEventResult.h

  sample

The HKSample object. This sample itself is not persisted in care plan store to avoid saving duplicated health data. Each time store uses UUID and type to fetch the actual sample object from HealthKit. If the sample cannot be found in HealthKit, this attribute returns nil.

@property (nonatomic, strong, readonly, nullable) HKSample *sample

Declared In

OCKCarePlanEventResult.h