Skip to content

CarpProtocolService

A CARP Core ProtocolService and ProtocolFactoryService that talks to CAWS.

Stores, versions and fetches StudyProtocols on the server. The user must be authenticated as a researcher. Participant apps normally do not need it; they get their deployment from CarpDeploymentService.

Inheritance
Implemented types

Constructors

CarpProtocolService

CarpProtocolService()

Returns the singleton default instance of the CarpProtocolService. Before this instance can be used, it must be configured using the configure method.

Properties

rpcEndpointName

String get rpcEndpointName
override

The name of this service's RPC endpoint at CAWS, like deployment-service.

Methods

add

Future<void> add(
  1. StudyProtocol protocol, [
  2. String? versionTag
])
override

Add the specified study protocol.

versionTag is an optional label used to identify this first version of the protocol. Timestamp of initial creation by default.

addVersion

Future<void> addVersion(
  1. StudyProtocol protocol, [
  2. String? versionTag
])
override

Add a new version for the specified study protocol, of which a previous version with the same id, ownerId, and name is already stored.

versionTag is an optional unique label used to identify this specific version of the protocol. The current date/time by default.

createCustomProtocol

Future<StudyProtocol> createCustomProtocol(
  1. String ownerId,
  2. String name,
  3. String description,
  4. String customProtocol,
)
override

Create a study protocol to be deployed to a single device which has its own way of describing study protocols that deviates from the CARP core study protocol model.

The customProtocol is stored in a single CustomProtocolTask which in the CARP study protocol model is described as being triggered at the start of the study for a CustomProtocolDevice with role name "Custom device".

getAllForOwner

Future<List<StudyProtocol>> getAllForOwner(
  1. String ownerId
)
override

Finds all StudyProtocols owned by the owner with ownerId. In CAWS, the ownerId is the CarpUser.id of the signed-in user.

Returns the last version of each StudyProtocol owned by the requested owner, or an empty list when none are found.

getBy

Future<StudyProtocol> getBy(
  1. String protocolId, [
  2. String? versionTag
])
override

Return the StudyProtocol with the specified protocolId,

versionTag is the tag of the specific version of the protocol to return. The latest version is returned when not specified.

getVersionHistoryFor

Future<List<ProtocolVersion>> getVersionHistoryFor(
  1. String protocolId
)
override

Returns all stored versions for the protocol with the specified protocolId.

updateParticipantDataConfiguration

Future<StudyProtocol> updateParticipantDataConfiguration(
  1. String protocolId,
  2. String versionTag,
  3. List<ExpectedParticipantData> expectedParticipantData
)
override

Replace the expected participant data for the study protocol with the specified protocolId and versionTag with expectedParticipantData.

Returns the updated StudyProtocol.