Skip to main content

PatientApi

@icure/medical-device-sdk / PatientApi

SDK API: PatientApi

The PatientApi interface provides methods to manage patients.

Table of contents

Methods

Methods

createOrModifyPatient

createOrModifyPatient(patient): Promise<Patient>

When modifying a patient, you must ensure that the rev obtained when getting or creating the patient is present as the rev is used to guarantee that the patient has not been modified by a third party. Create or update a [Patient]

Parameters

NameType
patientPatient

Returns

Promise<Patient>

Defined in

src/apis/PatientApi.ts:16


deletePatient

deletePatient(patientId): Promise<string>

Deletes the patient identified by the provided unique [patientId]. Delete a [Patient]

Parameters

NameType
patientIdstring

Returns

Promise<string>

Defined in

src/apis/PatientApi.ts:22


filterPatients

filterPatients(filter, nextPatientId?, limit?): Promise<PaginatedListPatient>

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

  • PatientByHealthcarePartyDateOfBirthBetweenFilter;
  • PatientByHealthcarePartyFilter;
  • PatientByHealthcarePartyGenderEducationProfessionFilter;
  • PatientByHealthcarePartyIdentifiersFilter;
  • PatientByHealthcarePartyNameContainsFuzzyFilter;
  • PatientByHealthcarePartySsinsFilter;
  • and PatientsByIdsFilter.

This method returns a paginated list of patient (with a cursor that lets you query the following items). Load patients from the database by filtering them using the provided [filter].

Parameters

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

Returns

Promise<PaginatedListPatient>

Defined in

src/apis/PatientApi.ts:39


getPatient

getPatient(patientId): Promise<Patient>

Each patient is uniquely identified by a patient id. The patient id is a UUID. This [patientId] is the preferred method to retrieve one specific patient. Get a [Patient]

Parameters

NameType
patientIdstring

Returns

Promise<Patient>

Defined in

src/apis/PatientApi.ts:45


getPatientAndTryDecrypt

getPatientAndTryDecrypt(patientId): Promise<PotentiallyEncryptedPatient>

Gets a patient and tries to decrypt its content. If it is not possible to decrypt the content only the unencrypted data will be available. This method is useful to allow new patient users to access some of their own data before their doctor actually gave them access to their own data: instead of giving an error if the data can't be decrypted (like what happens in getPatient) you will be able to get at least partial information.

Parameters

NameType
patientIdstring

Returns

Promise<PotentiallyEncryptedPatient>

Defined in

src/apis/PatientApi.ts:105


giveAccessTo

giveAccessTo(patient, delegatedTo): Promise<Patient>

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

Parameters

NameTypeDescription
patientPatientPatient 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<Patient>

Defined in

src/apis/PatientApi.ts:59


giveAccessToAllDataOf

giveAccessToAllDataOf(patientId): Promise<SharingResult>

Service that allows a Data Owner to share all the data of a Patient with the patient itself. This means this service is sharing :

  • The information of the patient;
  • All the observations linked to the patient;
  • All the conditions linked to the patient;

Parameters

NameTypeDescription
patientIdstringthe id of the Patient to which we want to give access back to its own data

Returns

Promise<SharingResult>

Defined in

src/apis/PatientApi.ts:78


giveAccessToPotentiallyEncrypted

giveAccessToPotentiallyEncrypted(patient, delegatedTo): Promise<PotentiallyEncryptedPatient>

Same as giveAccessTo but allowing also to share encrypted patients. This is useful if the delegator does not know the encryption key of the patient but has a secret id and wants to share it.

Parameters

NameTypeDescription
patientPotentiallyEncryptedPatientPatient 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<PotentiallyEncryptedPatient>

Defined in

src/apis/PatientApi.ts:67


matchPatients

matchPatients(filter): Promise<string[]>

Filters are complex selectors that are built by combining basic building blocks. Examples of filters available for [Patient] are AllPatientsFilter and PatientsByIdsFilter. This method returns the list of the ids of the users matching the [filter]. Load patient ids from the database by filtering them using the provided [filter].

Parameters

NameTypeDescription
filterFilter<Patient>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/PatientApi.ts:51


modifyPotentiallyEncryptedPatient

modifyPotentiallyEncryptedPatient(modifiedPatient): Promise<PotentiallyEncryptedPatient>

Modifies a potentially encrypted patient, ensuring that if originally the patient could not be decrypted then the modified patient does not change to data which should be encrypted according to the current api configuration. Similarly to getPatientAndTryDecrypt this method is useful when a patient needs to update his own data before an hcp gave him access to his own encrypted data.

Parameters

NameType
modifiedPatientPotentiallyEncryptedPatient

Returns

Promise<PotentiallyEncryptedPatient>

Defined in

src/apis/PatientApi.ts:113


subscribeToPatientEvents

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

Opens a WebSocket Connection in order to receive all the Patients 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<Patient>Filter criteria to filter to the Patients you would like to receive
eventFired(patient: Patient) => Promise<void>Action applied each time you receive a Patient 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/PatientApi.ts:91