Skip to content

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

DataStreamService()

Constants

API_VERSION

String const API_VERSION

Methods

appendToDataStreams

Future<void> appendToDataStreams(
  1. String studyDeploymentId,
  2. List<DataStreamBatch> batch
)

Append a batch of data measures to corresponding data streams in studyDeploymentId.

Throws IllegalArgumentException when:

  • the studyDeploymentId of one or more sequences in batch does not match studyDeploymentId
  • the start of one or more of the sequences contained in batch precede the end of a previously appended sequence to the same data stream
  • batch contains a sequence with DataStreamId which wasn't configured for studyDeploymentId

Throws IllegalStateException when data streams for studyDeploymentId have been closed.

closeDataStreams

Future<void> closeDataStreams(
  1. List<String> studyDeploymentIds
)

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

Future<List<DataStreamBatch>> getDataStream(
  1. DataStreamId dataStream,
  2. int fromSequenceId, [
  3. 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:

openDataStreams

Future<void> openDataStreams(
  1. 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

Future<Set<String>> removeDataStreams(
  1. List<String> studyDeploymentIds
)

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.