Skip to main content

Handling notifications

What Is a Notification?

A Notification represents a request from a Data Owner to another to perform an operation.
As for now, there are three types of Notifications:

  • KEY_PAIR_UPDATE: when a Patient loses their private key and gets a new one, they can send this type of Notification to a Practitioner to ask them to share their data with them again.
  • NEW_USER_OWN_DATA_ACCESS: when a Patient logs in for the first time, they can send this type of Notification to a Practitioner to aks for access to their own data.
  • OTHER: all the other use cases.

Status of a Notification

You can manage the lifecycle of a Notification by altering its status. Each Notification can have four possible states:

  • pending: the Notification was created, and it is waiting to be managed.
  • ongoing: the Notification was acknowledged, and the operations it prescribes are being managed.
  • completed: the Notification was managed, and the operations it prescribes ended.
  • cancelled: the Notification was cancelled without starting the operations it prescribes.

Creating a Notification

note

To perform the following operations, we suppose you have at least a Patient and a Practitioner in your database.

In the following example, a Patient creates a Notification for a Practitioner communicating that they have a new key and need access to their data.

const accessNotification = await patientApi.notificationApi.createOrModify(
new Notification({
type: NotificationTypeEnum.KeyPairUpdate,
}),
practitioner.id,
)
accessNotification
{
"id": "0f4d17e0-000a-4293-8c01-a570098cf87f",
"rev": "1-c974724265430b245f93c739feed4e89",
"status": "pending",
"created": 1700058616254,
"identifiers": [],
"modified": 1700058616254,
"author": "*",
"responsible": "*",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "FQVyGnTJMOnnnEsz1UnaYs86BmuneifvT8e7i143/W70IPD8wHsCtReqpju6JK+i",
"tags": {}
}
}
note

The default status of a Notification is pending

Retrieving a Notification

Retrieving a Notification Using its Id

In the following example, a Patient creates a Notification for a Practitioner and then retrieves it using its id.

const createdNotification = await patientApi.notificationApi.createOrModify(
new Notification({
type: NotificationTypeEnum.Other,
}),
practitioner.id,
)

const retrievedNotification = await patientApi.notificationApi.get(createdNotification.id)
createdNotification
{
"id": "5b5cb4e7-ea0d-4ce1-8ed6-9c1b1523dafb",
"rev": "1-05a84d91b9b4d0ad3dc4c773d4608e58",
"status": "pending",
"created": 1700058616285,
"identifiers": [],
"modified": 1700058616285,
"author": "*",
"responsible": "*",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Ms80pzAxBlM6YKHEa07/UBjpfHCINfSsFO7ZG99CXzr4SeaP1P+i7O/axAgxRLtI",
"tags": {}
}
}
retrievedNotification
{
"id": "5b5cb4e7-ea0d-4ce1-8ed6-9c1b1523dafb",
"rev": "1-05a84d91b9b4d0ad3dc4c773d4608e58",
"status": "pending",
"created": 1700058616285,
"identifiers": [],
"modified": 1700058616285,
"author": "*",
"responsible": "*",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Ms80pzAxBlM6YKHEa07/UBjpfHCINfSsFO7ZG99CXzr4SeaP1P+i7O/axAgxRLtI",
"tags": {}
}
}

Retrieving Notifications Using Complex Criteria

If you want to retrieve a set of Notifications that satisfy complex criteria, you can use a Filter.
In this example, a Practitioner filters all their Notifications that were created after a certain date.

const startTimestamp = new Date(2022, 8, 27).getTime()

const afterDateFilter = await new NotificationFilter(api)
.forDataOwner(user.healthcarePartyId)
.afterDate(startTimestamp)
.build()
afterDateFilter
{
"healthcarePartyId": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"date": 1664229600000,
"$type": "MaintenanceTasksAfterDateFilter"
}
note

You can learn more about Filters in the Filters How-To

After creating the filter, is it possible to use it to retrieve the Notifications.

const notificationsFirstPage = await api.notificationApi.filterBy(afterDateFilter, undefined, 10)
notificationsFirstPage
{
"rows": [
{
"id": "0f4d17e0-000a-4293-8c01-a570098cf87f",
"rev": "1-c974724265430b245f93c739feed4e89",
"status": "pending",
"created": 1700058616254,
"identifiers": [],
"modified": 1700058616254,
"author": "*",
"responsible": "*",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "FQVyGnTJMOnnnEsz1UnaYs86BmuneifvT8e7i143/W70IPD8wHsCtReqpju6JK+i",
"tags": {}
}
},
{
"id": "1437f725-00ef-43aa-a82d-e7138d21af30",
"rev": "1-f9d714ebf39772895c324fe48731c697",
"status": "pending",
"created": 1700058616477,
"identifiers": [],
"modified": 1700058616477,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "mqAKgG/l8yCFp9zyI65k+6cp7HNpZKF0fBAedmGCWsaPmVDmdHuybQQdeO8rysM4",
"tags": {}
}
},
{
"id": "36854fcc-463d-462d-85cc-ed16d3aa7f8b",
"rev": "1-2a162788959b03d053262590640dbff0",
"status": "pending",
"created": 1700058616399,
"identifiers": [],
"modified": 1700058616399,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "WPls2VA7JBrldN4lp8uUE/AZded4tLV4J8QZ8RZRZ1lDMnE0UUjQcqt0WERVNjjI",
"tags": {}
}
},
{
"id": "3c8397c1-99f1-4e01-bda9-182be7797f6c",
"rev": "1-9c70c95a146d1cbe0df3ddead7f61a0d",
"status": "pending",
"created": 1700058616368,
"identifiers": [],
"modified": 1700058616368,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Eki9vHWNA+6hgEwqBSEx7syjAMekr0RyrMNwOgTWdevxw8zqqtd39XGKCSe76OmT",
"tags": {}
}
},
{
"id": "45b1f8b2-49b1-4f44-a502-81ee9ecb58f9",
"rev": "1-23fd600d74bb44725a15897ecab1b2a8",
"status": "pending",
"created": 1700058616420,
"identifiers": [],
"modified": 1700058616420,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "m8uADFLoThZDSV3hJFp3hNbQLYpDg93AuFG9s9EUfHwWEE/jeQCyy+rraV06Mzy+",
"tags": {}
}
},
{
"id": "4d6c0f6e-9e17-41d3-9023-caa0718ae386",
"rev": "1-f4e46c25156dd9c3480876a35ee8834b",
"status": "pending",
"created": 1700058616339,
"identifiers": [],
"modified": 1700058616339,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "36lZD5XT5MHfZdyrzO/FUoR9Y4voOhzu+dbM5dp835+zh8FkgtYCh1cWKJjpRqv9",
"tags": {}
}
},
{
"id": "59fc8317-7b69-46b6-9c9b-b8545cfb25b9",
"rev": "1-167e34e95b17ee9bd13dd6e732a1d84e",
"status": "pending",
"created": 1700058616384,
"identifiers": [],
"modified": 1700058616384,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "x9kkscGo+dUVhknoYwpjwOmEfW3MtV5326+AEk9hJNFOL2tTIy8XqTV6ushL6ORm",
"tags": {}
}
},
{
"id": "5b5cb4e7-ea0d-4ce1-8ed6-9c1b1523dafb",
"rev": "1-05a84d91b9b4d0ad3dc4c773d4608e58",
"status": "pending",
"created": 1700058616285,
"identifiers": [],
"modified": 1700058616285,
"author": "*",
"responsible": "*",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Ms80pzAxBlM6YKHEa07/UBjpfHCINfSsFO7ZG99CXzr4SeaP1P+i7O/axAgxRLtI",
"tags": {}
}
},
{
"id": "78ed553b-5e42-492f-aa9d-ffef10fa9f27",
"rev": "1-0b4941bdedf275ec95d17ac4e7ee4ee3",
"status": "pending",
"created": 1700058616456,
"identifiers": [],
"modified": 1700058616456,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "KxVznl/7KnABMXlCoFqon5Cc0tZY5W5o13TnMgQLbDDbHdS5GxMgkRw4dsVYStdz",
"tags": {}
}
},
{
"id": "93695877-5aed-489f-8752-bb12701fa494",
"rev": "1-c6ed0e6b3a47ca2ec0b47b307a2efdfc",
"status": "pending",
"created": 1700058599261,
"identifiers": [],
"modified": 1700058599261,
"author": "*",
"responsible": "*",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "ujjYdFpdUBZ6o0LdGwLGRvXGKpBtfSsQ8S18pfBKYeFRfFljjeqlMnGmB0cxPKH8EuXaR48DgAXYm9B4eIR4mUAh0tyIa1ApORojqw2mIHhf1wIqSVYGkhNLFS4I5kd9z/ekQAtZvID6etagcECNf5UCu2cFa1pi0hrs10hgpgPrxzfQR9Z6v+ZlMQW7MmechtGKLZLLUhsl6kf8FA1Ctgkv5ob9X70xBZpGLKhRoBCbVYfA/uvt4rGgCClvMY6e/riLQydnyOVBg0AwQmu4FHvnvxbT9YnO1urskpUTXJwYQgWJBZ1x9VHA/E71hzeY//SRQoX0KXy8W3kRTa5IX9CsbNs89YpWo8+CZfYSgJljwWR32k6Egva7P9MpmtfoaCYav8LCYD5PvNMsonE6L0ZO2qESYXuc+I/6Mf8EMVBD6UV6E4wqN5Ku2B1cKOB6yMgorpfLB4dpDECAUtAXV7HEf1qUPSwtJMWqKkLDQIuUy1q5SQbSnX0rdPNwHbhZS9Y3M2krVxf6JR5nUkbyVQxL0k55LxfuTIZqB/Hg48/wVgZd7AcylXxrLJujLbDCsXPE23FNFuHFvtzK3cjxVUQp0FFctaCDKtWzov7+qt+88hKr8hmz64V46M68FwOVGNu+2LeoANLLuXub5vjUsCpUhSOryjmiwG28NG4Ec+BA/BBT7g9pV0nCau0nFyr6hjJycq/q83vLHSvjdmrZT8iUO/fcOfBD3EV4yPigx/ipjBwKy14ESAlQndSmKjAXJIMP6BjvNzJIBJ8wcMn1zSeoHkU77iNC6ndKwM2AlZZqzGhHWIIyO2SO+HYl6CaPDP97FVtTtveUmiCTIE3XCOfMqXDWin2x4vz1evIrsCNkT2zaiDfcCmgOAen9Aj0/Tc0MBIe2xTTIcJ2XJV3dbNb0bw4ynT9YFjRbyVt0PK4jWYiepSXLgenWrkVY7N1pp43FbE8FUincqxHWlFouyl76eU/zznQmvoNUDBQmTv9zur75PFYKpOXFevlxwBfB4pU/8jJ1fWI9cXcgY02jY94E058r9FGOGk0QsDPSZR27gQb+AjhLyalO2dBY/UpwkVCu4vesyGHuH1T1LnEAbAk8pOaHk524GOuxgpRVbPGfGOVmhucP9CFzrldhdtIUFFVHTQhqTWvbp+5j89LwLA==",
"tags": {}
}
}
],
"nextKeyPair": {
"startKey": "9d536e51-fd7b-48df-996d-9a9bdac182b9",
"startKeyDocId": "9d536e51-fd7b-48df-996d-9a9bdac182b9"
}
}

The filter method returns a PaginatedList, which contains up to limit Notifications in the rows field, as specified by the method parameter (1000 by default). If the PaginatedList has a non-null field startKeyDocId there are more notifications which can be retrieved with this filter: you can use this value to retrieve (part of) the remaining notifications.

const notificationsSecondPage = await api.notificationApi.filterBy(
afterDateFilter,
notificationsFirstPage.nextKeyPair.startKeyDocId,
10,
)
notificationsSecondPage
{
"rows": [
{
"id": "9d536e51-fd7b-48df-996d-9a9bdac182b9",
"rev": "1-6adc8fdc2eb932941c81170a16fa0fa6",
"status": "pending",
"created": 1700058616439,
"identifiers": [],
"modified": 1700058616439,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "UUMGXdg2roMmScp41sVWU8hcG+jnyFFHFXcKJigExgG5FwsmZLJ3QrPeEp0dUVy5",
"tags": {}
}
},
{
"id": "d38d71c3-1a8b-4821-8d95-6b813e5476ec",
"rev": "2-1291b4dbd45781f530ca1dd14d2440ed",
"status": "completed",
"created": 1700058596338,
"identifiers": [],
"modified": 1700058596338,
"author": "6ba80fc7-9fc4-4090-8678-3093dab9aad8",
"responsible": "a7cdd592-022d-496a-b2cf-3b8544aa899f",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "IKOM42RzR18NJz2XsQQb9GiHriTXqjSYVJPqgImoqSFdEUP0zJUaCFgSSqsMS3CR",
"tags": {}
}
},
{
"id": "dcca5e35-bb2a-4045-aa5e-abb5e1c99c11",
"rev": "1-d6b4120a7949fad0e388fd5f18524f53",
"status": "pending",
"created": 1700058616308,
"identifiers": [],
"modified": 1700058616308,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "3qnJT6LA7YSzZ9VB/TWxaIJa6NKNbDOkIiH4zhr4Nz65qp65td9Jh8Ixu8nCcsQG",
"tags": {}
}
},
{
"id": "f33d5d53-da65-418e-9c2f-f71c40d8b58d",
"rev": "1-758b5be031cf497ff489af4302a4e1f3",
"status": "pending",
"created": 1700058616356,
"identifiers": [],
"modified": 1700058616356,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "YL5LMosYA4tEmG1OOzXMQ6wNvacXD2jUIqkCg2ECvfZQcc+6bRC7rRHZiSNbUh+C",
"tags": {}
}
}
]
}

Retrieving all the Pending Notifications

A Practitioner can also retrieve all the Notifications assigned to him that have a pending status.

const pendingNotifications = await api.notificationApi.getPendingAfter()
pendingNotifications
[
{
"id": "0f4d17e0-000a-4293-8c01-a570098cf87f",
"rev": "1-c974724265430b245f93c739feed4e89",
"status": "pending",
"created": 1700058616254,
"identifiers": [],
"modified": 1700058616254,
"author": "*",
"responsible": "*",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "FQVyGnTJMOnnnEsz1UnaYs86BmuneifvT8e7i143/W70IPD8wHsCtReqpju6JK+i",
"tags": {}
}
},
{
"id": "1437f725-00ef-43aa-a82d-e7138d21af30",
"rev": "1-f9d714ebf39772895c324fe48731c697",
"status": "pending",
"created": 1700058616477,
"identifiers": [],
"modified": 1700058616477,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "mqAKgG/l8yCFp9zyI65k+6cp7HNpZKF0fBAedmGCWsaPmVDmdHuybQQdeO8rysM4",
"tags": {}
}
},
{
"id": "36854fcc-463d-462d-85cc-ed16d3aa7f8b",
"rev": "1-2a162788959b03d053262590640dbff0",
"status": "pending",
"created": 1700058616399,
"identifiers": [],
"modified": 1700058616399,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "WPls2VA7JBrldN4lp8uUE/AZded4tLV4J8QZ8RZRZ1lDMnE0UUjQcqt0WERVNjjI",
"tags": {}
}
},
{
"id": "3c8397c1-99f1-4e01-bda9-182be7797f6c",
"rev": "1-9c70c95a146d1cbe0df3ddead7f61a0d",
"status": "pending",
"created": 1700058616368,
"identifiers": [],
"modified": 1700058616368,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Eki9vHWNA+6hgEwqBSEx7syjAMekr0RyrMNwOgTWdevxw8zqqtd39XGKCSe76OmT",
"tags": {}
}
},
{
"id": "45b1f8b2-49b1-4f44-a502-81ee9ecb58f9",
"rev": "1-23fd600d74bb44725a15897ecab1b2a8",
"status": "pending",
"created": 1700058616420,
"identifiers": [],
"modified": 1700058616420,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "m8uADFLoThZDSV3hJFp3hNbQLYpDg93AuFG9s9EUfHwWEE/jeQCyy+rraV06Mzy+",
"tags": {}
}
},
{
"id": "4d6c0f6e-9e17-41d3-9023-caa0718ae386",
"rev": "1-f4e46c25156dd9c3480876a35ee8834b",
"status": "pending",
"created": 1700058616339,
"identifiers": [],
"modified": 1700058616339,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "36lZD5XT5MHfZdyrzO/FUoR9Y4voOhzu+dbM5dp835+zh8FkgtYCh1cWKJjpRqv9",
"tags": {}
}
},
{
"id": "59fc8317-7b69-46b6-9c9b-b8545cfb25b9",
"rev": "1-167e34e95b17ee9bd13dd6e732a1d84e",
"status": "pending",
"created": 1700058616384,
"identifiers": [],
"modified": 1700058616384,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "x9kkscGo+dUVhknoYwpjwOmEfW3MtV5326+AEk9hJNFOL2tTIy8XqTV6ushL6ORm",
"tags": {}
}
},
{
"id": "5b5cb4e7-ea0d-4ce1-8ed6-9c1b1523dafb",
"rev": "1-05a84d91b9b4d0ad3dc4c773d4608e58",
"status": "pending",
"created": 1700058616285,
"identifiers": [],
"modified": 1700058616285,
"author": "*",
"responsible": "*",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "Ms80pzAxBlM6YKHEa07/UBjpfHCINfSsFO7ZG99CXzr4SeaP1P+i7O/axAgxRLtI",
"tags": {}
}
},
{
"id": "78ed553b-5e42-492f-aa9d-ffef10fa9f27",
"rev": "1-0b4941bdedf275ec95d17ac4e7ee4ee3",
"status": "pending",
"created": 1700058616456,
"identifiers": [],
"modified": 1700058616456,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "KxVznl/7KnABMXlCoFqon5Cc0tZY5W5o13TnMgQLbDDbHdS5GxMgkRw4dsVYStdz",
"tags": {}
}
},
{
"id": "93695877-5aed-489f-8752-bb12701fa494",
"rev": "1-c6ed0e6b3a47ca2ec0b47b307a2efdfc",
"status": "pending",
"created": 1700058599261,
"identifiers": [],
"modified": 1700058599261,
"author": "*",
"responsible": "*",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "ujjYdFpdUBZ6o0LdGwLGRvXGKpBtfSsQ8S18pfBKYeFRfFljjeqlMnGmB0cxPKH8EuXaR48DgAXYm9B4eIR4mUAh0tyIa1ApORojqw2mIHhf1wIqSVYGkhNLFS4I5kd9z/ekQAtZvID6etagcECNf5UCu2cFa1pi0hrs10hgpgPrxzfQR9Z6v+ZlMQW7MmechtGKLZLLUhsl6kf8FA1Ctgkv5ob9X70xBZpGLKhRoBCbVYfA/uvt4rGgCClvMY6e/riLQydnyOVBg0AwQmu4FHvnvxbT9YnO1urskpUTXJwYQgWJBZ1x9VHA/E71hzeY//SRQoX0KXy8W3kRTa5IX9CsbNs89YpWo8+CZfYSgJljwWR32k6Egva7P9MpmtfoaCYav8LCYD5PvNMsonE6L0ZO2qESYXuc+I/6Mf8EMVBD6UV6E4wqN5Ku2B1cKOB6yMgorpfLB4dpDECAUtAXV7HEf1qUPSwtJMWqKkLDQIuUy1q5SQbSnX0rdPNwHbhZS9Y3M2krVxf6JR5nUkbyVQxL0k55LxfuTIZqB/Hg48/wVgZd7AcylXxrLJujLbDCsXPE23FNFuHFvtzK3cjxVUQp0FFctaCDKtWzov7+qt+88hKr8hmz64V46M68FwOVGNu+2LeoANLLuXub5vjUsCpUhSOryjmiwG28NG4Ec+BA/BBT7g9pV0nCau0nFyr6hjJycq/q83vLHSvjdmrZT8iUO/fcOfBD3EV4yPigx/ipjBwKy14ESAlQndSmKjAXJIMP6BjvNzJIBJ8wcMn1zSeoHkU77iNC6ndKwM2AlZZqzGhHWIIyO2SO+HYl6CaPDP97FVtTtveUmiCTIE3XCOfMqXDWin2x4vz1evIrsCNkT2zaiDfcCmgOAen9Aj0/Tc0MBIe2xTTIcJ2XJV3dbNb0bw4ynT9YFjRbyVt0PK4jWYiepSXLgenWrkVY7N1pp43FbE8FUincqxHWlFouyl76eU/zznQmvoNUDBQmTv9zur75PFYKpOXFevlxwBfB4pU/8jJ1fWI9cXcgY02jY94E058r9FGOGk0QsDPSZR27gQb+AjhLyalO2dBY/UpwkVCu4vesyGHuH1T1LnEAbAk8pOaHk524GOuxgpRVbPGfGOVmhucP9CFzrldhdtIUFFVHTQhqTWvbp+5j89LwLA==",
"tags": {}
}
},
{
"id": "9d536e51-fd7b-48df-996d-9a9bdac182b9",
"rev": "1-6adc8fdc2eb932941c81170a16fa0fa6",
"status": "pending",
"created": 1700058616439,
"identifiers": [],
"modified": 1700058616439,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "UUMGXdg2roMmScp41sVWU8hcG+jnyFFHFXcKJigExgG5FwsmZLJ3QrPeEp0dUVy5",
"tags": {}
}
},
{
"id": "dcca5e35-bb2a-4045-aa5e-abb5e1c99c11",
"rev": "1-d6b4120a7949fad0e388fd5f18524f53",
"status": "pending",
"created": 1700058616308,
"identifiers": [],
"modified": 1700058616308,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "3qnJT6LA7YSzZ9VB/TWxaIJa6NKNbDOkIiH4zhr4Nz65qp65td9Jh8Ixu8nCcsQG",
"tags": {}
}
},
{
"id": "f33d5d53-da65-418e-9c2f-f71c40d8b58d",
"rev": "1-758b5be031cf497ff489af4302a4e1f3",
"status": "pending",
"created": 1700058616356,
"identifiers": [],
"modified": 1700058616356,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "OTHER",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "YL5LMosYA4tEmG1OOzXMQ6wNvacXD2jUIqkCg2ECvfZQcc+6bRC7rRHZiSNbUh+C",
"tags": {}
}
}
]

Modifying a Notification

A Data Owner can modify a Notification.

const newNotification = await api.notificationApi.createOrModify(
new Notification({
type: NotificationTypeEnum.KeyPairUpdate,
}),
practitioner.id,
)

const notificationToModify = new Notification({
...newNotification,
status: MaintenanceTask.StatusEnum.Ongoing,
})

const modifiedNotification = await api.notificationApi.createOrModify(
notificationToModify,
practitioner.id,
)
modifiedNotification
{
"id": "5c091fb4-a375-4765-b4b5-27bc2750ed45",
"rev": "2-1623d59c505c850304df1ea75c5b2128",
"status": "ongoing",
"created": 1700058616589,
"identifiers": [],
"modified": 1700058616589,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "aQNDyu8V/SCou8VNk0lm0flwG8uGrE09JFrrsqSitXvHMKvpghQ/gGS86tXfB5rF",
"tags": {}
}
}
caution

Only the status, identifiers, and property fields can be modified.

Updating the Status of a Notification

The NotificationApi also provides a shortcut method to update the status of a Notification.

const notificationToUpdate = await api.notificationApi.createOrModify(
new Notification({
type: NotificationTypeEnum.KeyPairUpdate,
status: StatusEnum.Pending,
}),
practitioner.id,
)

const updatedNotification = await api.notificationApi.updateStatus(
notificationToUpdate,
StatusEnum.Ongoing,
)
updatedNotification
{
"id": "1b1a1323-e5c3-408e-b88e-47ba55b84c7d",
"rev": "2-96ad9536c315bffe2cb3f285376ab54c",
"status": "ongoing",
"created": 1700058616620,
"identifiers": [],
"modified": 1700058616620,
"author": "17e392da-8e36-4e4e-abd7-7eef3e434395",
"responsible": "3ed06450-17e5-47b6-ba4f-7a0a084df56b",
"properties": {},
"type": "KEY_PAIR_UPDATE",
"systemMetaData": {
"secretForeignKeys": [],
"cryptedForeignKeys": {},
"delegations": {},
"encryptionKeys": {},
"securityMetadata": {
"secureDelegations": {},
"keysEquivalences": {}
},
"encryptedSelf": "bdsEKC7slguI6j8L6yKR+fHJI9okNSDjT2Gyf6A5sPp+io3mysb2c4RHl+3B87+f",
"tags": {}
}
}

Deleting a Notification

Finally, a Data Owner that has access to a Notification can decide to delete it.

const notificationToDelete = await api.notificationApi.createOrModify(
new Notification({
type: NotificationTypeEnum.KeyPairUpdate,
}),
practitioner.id,
)

const deletedNotificationId = await api.notificationApi.delete(notificationToDelete.id)
deletedNotificationId
b7ed9db3-ab5d-42f5-8d3d-2dfd53789228