RPAppTask class

An AppTask that asks the user to complete a Research Package task.

The rpTask can be a survey, a cognitive test, or any other RPTask from Research Package. Add it to a protocol with a trigger, like any other task. When triggered, it shows up as a SurveyUserTask in the AppTaskController.userTaskQueue.

Key points:

  • The type decides how the app treats it, e.g. AppTask.SURVEY_TYPE or AppTask.COGNITIVE_ASSESSMENT_TYPE.
  • The SurveySamplingPackage.SURVEY measure and a completed app task measure are always added to measures, so the result is collected.
  • Other measures are sampled in the background while the user does the task.

For example, a PeriodicTrigger triggers the survey on a regular basis, and a RecurrentScheduledTrigger schedules a recurrent survey, e.g. every Monday at 8pm:

protocol.addTaskControl(
  RecurrentScheduledTrigger(type: RecurrentType.daily, time: TimeOfDay(hour: 13)),
  RPAppTask(type: AppTask.SURVEY_TYPE, name: 'WHO-5 Survey', rpTask: who5Task),
  phone,
);
Inheritance
  • Object
  • Serializable
  • TaskConfiguration
  • AppTask
  • RPAppTask
Annotations
  • @JsonSerializable.new(includeIfNull: false, explicitToJson: true)

Constructors

RPAppTask({String? name, required String type, String title = '', String? description = '', String instructions = '', int? minutesToComplete, Duration? expire, bool notification = false, List<Measure>? measures, required RPTask rpTask})
RPAppTask.fromJson(Map<String, dynamic> json)
factory

Properties

$type ↔ String?
The type name written to __type in JSON; set to jsonType on creation.
getter/setter pairinherited
backgroundTask → BackgroundTask
The list of background measures as a BackgroundTask.
no setterinherited
description ↔ String
A short description (one line) of this task. Can be used in the app.
getter/setter pairinherited
expire ↔ Duration?
The duration of this app task, i.e. when it expire and is removed from the AppTaskController's queue. If null the task never expire.
getter/setter pairinherited
fromJsonFunction → Function
The generated function that converts a JSON map to an object of this type.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
instructions ↔ String
A longer instruction text explaining how a user should perform this task.
getter/setter pairinherited
jsonType → String
The __type used for JSON serialization of this class.
no setterinherited
measures ↔ List<Measure>?
The data which needs to be collected/measured passively as part of this task.
getter/setter pairinherited
minutesToComplete ↔ int?
How many minutes will it take for the user to perform this task? Typically shown to the user before engaging into this task. If null the task has no completion time.
getter/setter pairinherited
name ↔ String
A name which uniquely identifies the task.
getter/setter pairinherited
notification ↔ bool
Should a notification be send to the user on the phone?
getter/setter pairinherited
rpTask ↔ RPTask
The survey, cognitive test or other Research Package task to show to the user.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
title ↔ String
A title for this task. Can be used in the app.
getter/setter pairinherited
type ↔ String
Type of task. For example a survey.
getter/setter pairinherited

Methods

addMeasure(Measure measure) → void
Add measure to this task.
inherited
addMeasures(Iterable<Measure> list) → void
Add a list of measures to this task.
inherited
getAllExpectedDataTypes() → Set<String>
Get data types of all data which may be collected, either passively as part of task measures, or as the result of user interactions, for this task.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeMeasure(Measure measure) → void
Remove measure from this task.
inherited
toJson() → Map<String, dynamic>
Returns a JSON map of this object, including the __type property.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited