Skip to main content

DataSampleApi

@icure/medical-device-sdk / DataSampleApi

SDK API: DataSampleApi

The DataSampleApi interface provides methods to manage observations.

Table of contents

Methods

Methods

createOrModifyDataSampleFor

createOrModifyDataSampleFor(patientId, dataSample): Promise<DataSample>

When modifying an observation, you can't update the patient of it : For this, you need to delete the faulty observation and create a new one. When modifying the observation, you also need to keep the same batchId : It is not possible to change the batch of an observation. Create or update a [DataSample] for a patient

Parameters

NameType
patientIdstring
dataSampleDataSample

Returns

Promise<DataSample>

Defined in

src/apis/DataSampleApi.ts:18


createOrModifyDataSamplesFor

createOrModifyDataSamplesFor(patientId, dataSample): Promise<DataSample[]>

All the provided observations will be created in the same batch. If you are trying to update some observations, then those ones need to come from the same batch. When modifying an observation, you can't update the patient of it : For this, you need to delete the faulty observation and create a new one. When modifying the observation, you also need to keep the same batchId : It is not possible to change the batch of an observation. Create or update a batch of [DataSample] for a patient

Parameters

NameType
patientIdstring
dataSampleDataSample[]

Returns

Promise<DataSample[]>

Defined in

src/apis/DataSampleApi.ts:26


deleteAttachment

deleteAttachment(dataSampleId, documentId): Promise<string>

Deletes an attachment, using its corresponding documentId Delete an attachment of a DataSample

Parameters

NameType
dataSampleIdstring
documentIdstring

Returns

Promise<string>

Defined in

src/apis/DataSampleApi.ts:34


deleteDataSample

deleteDataSample(dataSampleId): Promise<string>

Deletes the observation identified by the provided unique [dataSampleId]. Delete a [DataSample] by its id

Parameters

NameType
dataSampleIdstring

Returns

Promise<string>

Defined in

src/apis/DataSampleApi.ts:41


deleteDataSamples

deleteDataSamples(requestBody): Promise<string[]>

Deletes the batch of observations identified by the provided [dataSampleIds]. The observations to delete need to be part of the same batch Delete a batch of [Observations]

Parameters

NameType
requestBodystring[]

Returns

Promise<string[]>

Defined in

src/apis/DataSampleApi.ts:48


extractPatientId

extractPatientId(dataSample): Promise<undefined | string>

Parameters

NameType
dataSampleDataSample

Returns

Promise<undefined | string>

Defined in

src/apis/DataSampleApi.ts:154


filterDataSample

filterDataSample(filter, nextDataSampleId?, limit?): Promise<PaginatedListDataSample>

Filters are complex selectors that are built by combining basic building blocks. Examples of filters available for [DataSample] are :

  • DataSampleByHealthcarePartyFilter;
  • DataSampleByHealthcarePartyHealthcareElementFilter;
  • DataSampleByHealthcarePartyIdentifiersFilter;
  • DataSampleByHealthcarePartyPatientFilter;
  • DataSampleByHealthcarePartyTagCodeDateFilter;
  • and DataSamplesByIdsFilter.

This method returns a paginated list of observations (with a cursor that lets you query the following items). Find observations using the provided [filter].

Parameters

NameTypeDescription
filterFilter<DataSample>The Filter object that describes which condition(s) the elements whose the ids should be returned must fulfill
nextDataSampleId?stringThe id of the first observation in the next page
limit?numberThe maximum number of observations that should contain the returned page. By default, a page contains 1000 observations

Returns

Promise<PaginatedListDataSample>

Defined in

src/apis/DataSampleApi.ts:65


getDataSample

getDataSample(dataSampleId): Promise<DataSample>

Each observation is uniquely identified by an observation id which is a UUID. This [dataSampleId] is the preferred method to retrieve one specific observation. Get a [DataSample] by its id

Parameters

NameType
dataSampleIdstring

Returns

Promise<DataSample>

Defined in

src/apis/DataSampleApi.ts:72


getDataSampleAttachmentContent

getDataSampleAttachmentContent(dataSampleId, documentId, attachmentId): Promise<ArrayBuffer>

Observations may contain attachments such as prescriptions, reports, ... Use this method to get the content of an attachment Get attachment content of a DataSample

Parameters

NameType
dataSampleIdstring
documentIdstring
attachmentIdstring

Returns

Promise<ArrayBuffer>

Defined in

src/apis/DataSampleApi.ts:81


getDataSampleAttachmentDocument

getDataSampleAttachmentDocument(dataSampleId, documentId): Promise<Document>

Observations may contain attachments such as prescriptions, reports, ... Use this method to get the document metadata information of an attachment Get document metadata of a DataSample attachment

Parameters

NameType
dataSampleIdstring
documentIdstring

Returns

Promise<Document>

Defined in

src/apis/DataSampleApi.ts:89


getDataSamplesForPatient

getDataSamplesForPatient(patient): Promise<DataSample[]>

Gets all the Observations associated to a Patient that the current dataOwner can access.

Parameters

NameTypeDescription
patientPatientthe Patient associated to the Observations to get

Returns

Promise<DataSample[]>

an array containing the Observations

Defined in

src/apis/DataSampleApi.ts:134


giveAccessTo

giveAccessTo(dataSample, delegatedTo): Promise<DataSample>

Service where current user gives access to the observation information to another dataOwner (HCP, patient or device). For this, the current user data owner should be able to access the observation provided in argument in order to provide access to another data owner.

Parameters

NameTypeDescription
dataSampleDataSampleObservation the current data owner would like to share with another data owner
delegatedTostringID of the data owner to which current user would like to give access

Returns

Promise<DataSample>

The dataSample with updated access rights

Defined in

src/apis/DataSampleApi.ts:126


matchDataSample

matchDataSample(filter): Promise<string[]>

Filters are complex selectors that are built by combining basic building blocks. Examples of filters available for [DataSample] are AllDataSamplesFilter and DataSamplesByIdsFilter. This method returns a paginated list of observations (with a cursor that lets you query the following items). Find observations ids using the provided Filter.

Parameters

NameTypeDescription
filterFilter<DataSample>The Filter object that describes which condition(s) the elements whose the ids should be returned must fulfill

Returns

Promise<string[]>

Defined in

src/apis/DataSampleApi.ts:96


setDataSampleAttachment

setDataSampleAttachment(dataSampleId, body, documentName?, documentVersion?, documentExternalUuid?, documentLanguage?): Promise<Document>

Link an attachment or update the attachment of an observation Add or update the attachment of a DataSample

Parameters

NameType
dataSampleIdstring
bodyArrayBuffer
documentName?string
documentVersion?string
documentExternalUuid?string
documentLanguage?string

Returns

Promise<Document>

Defined in

src/apis/DataSampleApi.ts:108


subscribeToDataSampleEvents

subscribeToDataSampleEvents(eventTypes, filter, eventFired, options?): Promise<Connection>

Opens a WebSocket Connection in order to receive all the Observations corresponding to specific filter criteria.

Parameters

NameTypeDescription
eventTypes("CREATE" | "UPDATE" | "DELETE")[]Type of event you would like to listen. It can be CREATE, UPDATE or DELETE
filterFilter<DataSample>Filter criteria to filter to the observations you would like to receive
eventFired(dataSample: DataSample) => Promise<void>Action applied each time you receive an observation through the WebSocket
options?ObjectOptions to configure the WebSocket. - keepAlive : How long to keep connection alive (ms); - lifetime : How long to keep the WebSocket alive (ms); - connectionMaxRetry : how many time retrying to reconnect to the iCure WebSocket; - connectionRetryIntervalInMs : How long base interval will be between two retry. The retry attempt is exponential and using a random value (connectionRetryIntervalMs * (random between 1 and 2))^nbAttempts)
options.connectionMaxRetry?number-
options.connectionRetryIntervalMs?number-

Returns

Promise<Connection>

Defined in

src/apis/DataSampleApi.ts:147