cph-cachet / carp.core-kotlin

Infrastructure-agnostic framework for distributed data collection.
https://carp.cachet.dk/core/
MIT License
20 stars 2 forks source link

Which devices require registration and which one are 'dependent'? #118

Open Whathecode opened 4 years ago

Whathecode commented 4 years ago

While continuing the implementation of DeploymentService, some questions arose in regards to the registration of devices, and when devices are considered 'dependent' on one another.

Dependent devices The original reason why it was expected that some devices require registration prior to being able to retrieve the PrimaryDeviceDeployment of another device was because they might need to communicate and information needs to be exchanged in order to establish that communication. However, we also envisioned that the back-end may decide to only support server/client communication in between multiple primary devices; that is, the individual primary devices do not depend on one another, but all depend on the server as the middleman to communicate with one another. Since this would be the default fallback mechanisms, this is the first form of communication we intend to implement. In case of such a deployment, primary devices do not depend on one another. To contrast, the current implementation assumes they always do, even if no form of communication between them is configured in the study protocol.

Required registration Some ambiguity in terms of what it means for a device 'requiring registration' arose. The concept was introduced to indicate the dependencies described above, and thus all top-level primary devices by default required registration. However, now the question also arises whether all devices should be registered prior to a study deployment being able to 'start'. Connected devices can be registered locally on a primary device, but it might make sense to notify the back-end of that registration so that a complete history of which physical devices were used to run a study is available.

Whathecode commented 4 years ago

The second part 'required registration' is addressed in https://github.com/cph-cachet/carp.core-kotlin/pull/119.

All devices require registration on the back-end before a deployment can be considered 'ready' (https://github.com/cph-cachet/carp.core-kotlin/commit/eb4aa8862be1cb24c8272a6dce7c8004b96ee782). The previous requiresRegistration is now specific to individual devices, represented as remainingDevicesToRegisterBeforeDeployment in DeviceDeploymentStatus (https://github.com/cph-cachet/carp.core-kotlin/commit/b067518d733e0886ea86865541b6d197aaf8aa9a).

Whathecode commented 4 years ago

Another formulation I just wrote up while looking into the different definitions again:

The current comments and variable naming in DeviceDeploymentStatus might not be in sync with this description, and it seems there is a bug as a result that a deployment for a master device cannot be obtained before registering a connected device.