Step 1: Design your study
What you’ll do: write the study protocol from Configure your study in Dart, the recipe your app will follow. It answers four questions:
| Question | In the protocol | In this example |
|---|---|---|
| Where is data collected? | Device | The phone |
| What is collected? | Measures | Steps and battery |
| When is it collected? | Trigger | Right away, all the time |
| Where does data go? | Data endpoint | A database on the phone |
-
Create the protocol and choose where data goes.
final protocol = SmartphoneStudyProtocol(name: 'My first study',dataEndPoint: SQLiteDataEndPoint(),); -
Add the device and the participant. The phone collects the data; the participant is the person using it.
final phone = Smartphone();protocol.addPrimaryDevice(phone);protocol.addParticipantRole(ParticipantRole('Participant')); -
Say what to collect, and when.
ImmediateTriggermeans “start right away”;BackgroundTaskmeans “keep collecting quietly”.protocol.addTaskControl(ImmediateTrigger(),BackgroundTask(name: 'Steps and battery', measures: [Measure(type: SensorSamplingPackage.STEP_EVENT),Measure(type: DeviceSamplingPackage.BATTERY_STATE),]),phone,);
You’ll put this code into the app in the next step.
Check it
Section titled “Check it”You can answer the four questions above for your own study. If you’ll use CAWS, the protocol is usually created in the CARP Portal instead of in code. That’s covered in Step 3.
Next: Step 2: Build the app