These materials are for informational purposes only and do not constitute legal advice. You should contact an attorney to obtain advice with respect to the development of a CareKit app and any applicable laws.

Creating the Symptom and Measurement Tracker

The Symptom and Measurement Tracker manages assessment actions and events to measure the effectiveness of the user’s care plan.

Symptom and Measurement Tracker Screenshot
Figure 1: The Symptom and Measurement Tracker.

The procedure for creating the Symptom and Measurement Tracker is similar to creating a Care Card, but involves an extra delegate object.

  1. Instantiate the app’s Care Plan Store.
  2. Add the desired assessment activities to the store.
  3. Create the Symptom and Measurement Tracker delegate.
  4. Instantiate and present the Symptom and Measurement Tracker view controller.

The Symptom and Measurement Tracker automatically displays the assessment activity events for each day and automatically tracks the user’s progress as they complete these events.

Evaluation Screenshot
Figure 2: An example evaluation.

Instantiate the Care Plan Store

If you haven’t already instantiated the Care Plan Store, follow the instructions listed in Creating the Care Card.

Remember: You need only a single care plan store per app. The stores are long-lived objects. Create the store once, and keep a reference to it for later use.

Add Assessment Activities

  1. Before adding an activity to the care plan store, you should check to see if that activity already exists.

     store.activityForIdentifier(MyEmotionalSurveyIdentifier) { (success, activityOrNil, errorOrNil) -> Void in
         guard success else {
             // perform real error handling here.
             fatalError("*** An error occurred \(errorOrNil?.localizedDescription) ***")
         if let activity = activityOrNil {
             // the activity already exists.
         } else {
             // ADD THE ACTIVITY HERE... 

Each activity has a unique identifier. If an identifier is already used in the store, any attempt to add another activity with the same identifier has no effect on the store.

  1. Create the activity’s schedule.

     // take the emotional survey once a day, every day starting March 15, 2016
     let startDay = NSDateComponents(year: 2016, month: 3, day: 15)
     let onceADay = OCKCareSchedule.dailyScheduleWithStartDate(startDay, occurrencesPerDay: 1)
  2. Instantiate the assessment activity.

     let emotionalSurvey = OCKCarePlanActivity(
         identifier: MyEmotionalSurveyIdentifier,
         groupIdentifier: nil,
         type: .Assessment,
         title: "Daily Emotional Survey",
         text: "How are you feeling today?",
         tintColor: nil,
         instructions: nil,
         imageURL: nil,
         schedule: onceADay,
         resultResettable: false,
         userInfo: nil)

Activity objects are immutable, which means that you cannot change their properties after they are created.

To appear on the Symptom and Measurement Tracker, the activity must use the OCKCarePlanActivityType.Assessment activity type. Assessment activities also require valid schedule, title, and text parameters. The schedule sets the number of circles to be filled on each day. CareKit displays the title and text on the Symptom and Measurement Tracker.

Other parameters can further modify how the activity behaves, or how it appears. In particular, the resultResettable parameter determines whether the user can retry the event after they have completed it. In this example, the user can take the survey only once each day, and they cannot edit their results.

Create the Symptom and Measurement Tracker View Controller

To initialize your Symptom and Measurement Tracker view controller, pass your Care Plan Store and your delegate to the constructor.

let symptomTrackerController = OCKSymptomTrackerViewController(carePlanStore: store, delegate: self)

Next, present the Symptom and Measurement Tracker just like you would present any other view controller. You can add it to a tab bar controller, push it onto a navigation controller, or present it modally.

// presenting the view controller modally
presentViewController(symptomTrackerController, animated: true, completion: nil)

For more information on working with view controllers, see View Controller Programming Guide for iOS.

Update the Symptom and Measurement Tracker

CareKit automatically updates the Symptom and Measurement Tracker whenever you make changes to the Care Plan Store. To modify the Symptom and Measurement Tracker, simply add or remove assessment activities from the store, or update assessment events in the store.