DataStreamService
Store and retrieve data streams for study deployments.
The server-side data endpoint in CARP Core. Data streams for a deployment are opened with a DataStreamsConfiguration, appended to with DataStreamBatches, and closed when the study ends. Implemented by the CARP web services client (carp_webservices).
Constructors
DataStreamService
Constants
API_VERSION
Methods
appendToDataStreams
- String studyDeploymentId,
- List<
DataStreamBatch> batch
Append a batch of data measures to corresponding data streams in studyDeploymentId.
Throws IllegalArgumentException when:
- the
studyDeploymentIdof one or more sequences inbatchdoes not matchstudyDeploymentId - the start of one or more of the sequences contained in
batchprecede the end of a previously appended sequence to the same data stream batchcontains a sequence with DataStreamId which wasn't configured forstudyDeploymentId
Throws IllegalStateException when data streams for studyDeploymentId have been closed.
closeDataStreams
Stop accepting incoming data for all data streams for each of the studyDeploymentIds.
Throws IllegalArgumentException when no data streams were ever opened for any of the studyDeploymentIds.
getDataStream
- DataStreamId dataStream,
- int fromSequenceId, [
- int? toSequenceIdInclusive
Retrieve all data points in dataStream that fall within the inclusive range defined by fromSequenceId and toSequenceIdInclusive. If toSequenceIdInclusive is null, all data points starting fromSequenceId are returned.
In case no data for dataStream is stored in this repository, or is available for the specified range, an empty list is returned.
Throws IllegalArgumentException if:
dataStreamhas never been opened- the
dataStreamdoes not exist (i.e., the combination of DataStreamId.deviceRoleName and DataStreamId.dataType is not valid for the protocol used in the DataStreamId.studyDeploymentId deployment) fromSequenceIdis negative ortoSequenceIdInclusiveis smaller thanfromSequenceId
openDataStreams
- DataStreamsConfiguration configuration
Start accepting data for a study deployment for data streams configured in configuration.
Throws IllegalStateException when data streams for the specified study deployment have already been configured.
removeDataStreams
Close data streams and remove all data for each of the studyDeploymentIds.
Returns the IDs of the study deployments for which data streams were configured. IDs for which no study deployment exists are ignored.