carp.core-kotlin icon indicating copy to clipboard operation
carp.core-kotlin copied to clipboard

Support triggers based on data streams originating from multiple devices.

Open Whathecode opened this issue 6 years ago • 1 comments

Right now, a Trigger is tied to exactly one device, specified through sourceDeviceRoleName: "The device role name from which the trigger originates."

However, this neglects use cases where something might need to be triggered based on data collected from multiple, separate, devices. For example: once two devices are within close proximity of a beacon, a survey needs to be sent out to both devices.

What is the best way to ensure the domain model supports expressing such protocols? Rather than storing a single sourceDeviceRoleName, should we store a set?

Whathecode avatar Apr 08 '19 13:04 Whathecode

I think the best will be to change the base class of Trigger to include a set of source devices. The helper methods which initialize the triggers remain the same. They simply initialize the set with a single source device. In case you want to specify triggers from multiple device origins, you can still initialize these (maybe through some TriggerComposer helper class) manually and add them using the same API in StudyProtocol as we have now.

In the end, it is still the more concrete Trigger implementations which will define what data needs to be uploaded and how frequently (i.e., which data streams they operate on and what the conditions are). But, the need to trigger based on data collected from separate devices seems realistic.

Whathecode avatar Apr 08 '19 13:04 Whathecode