2.1 Rules 

Message\ValueNEWXXXXNNNN
Patient block (see 6 - Administration v2.0)YDRB3/4/5DRB3/4/5
Donor block (see 6 - Administration v2.0)YDRB3/4/5DRB3/4/5
Typing responseYDRB3/4/5DRB3/4/5
Sample responseYDRB3/4/5DRB3/4/5


2.2 How to read the new semantics if you know EMDIS

As previously indicated in Section 2.1, the OpenAPI specification forms an integral component of our updated documentation set. Henceforth, we will refer to this API documentation as "Swagger." You can access it via the following publicly available URL: https://apispecs.wmda.info/

At this address, both Search & Match API specifications and Connect API specifications can be found:

Since the communication is now split to communication with WMDA's Search & Match and messaging with other registries, each API request in this semantics document may be represented in two styles:

  1. Communication with S&M

    Most of the Patient API endpoints and all Search API endpoints consist of such messages.

  2. Messaging with other registries

    One Patient API and all Connect APIs are represented in this style.

    Certain API endpoints include only the patient ID field, while others include the Patient Embedded Block. Similarly for donors: donor ID vs. Donor Embedded Block. The embedded block is used in those cases where the details of the person are important to transmit to the partner registry. For example, when the donor status changes in the work on some request, the Donor Embedded Block is sent to inform of this change.

  3. Required fields
    Required fields are indicated with a red asterisk (*). Fields without (*) are considered optional. 

  4. Nested required fields
    Information for any "nested" required fields only need to be provided if another related piece of information is sent. Specifically, when a required field is the child of a parent-field that is not mandatory. This implies that the required child-field only becomes mandatory if the parent-field is sent.
    This design allows flexibility by only making certain fields mandatory in the context of other related information being sent.



Language note: Original EMDIS language uses Request/Result terminology when speaking about donor requests. In API terminology there are also similar words. A combination was made in creation of API endpoint. For example, when sending an Extended Typing Request as a donor request, the registry must make an API request to an endpoint that is called extendedTypingRequestRequest. To receive that response, the receiving registry must make a call to an API endpoint called extendedTypingRequestRetrieve. Then, for the donor registry to send the message Extended Typing Result, it must send an API request to an endpoint that is called extendedTypingResponseRequest. Respectively, the patient registry retrieves the response (result) from the endpoint extendedTypingResponseRetrieve.

Wherever suitable, we included EMDIS names of the messages in parentheses, e.g. 5.1 - Typing Request (TYP_REQ).

In contrast to the flat FML messages used in the EMDIS communication, the REST API based Match-Connect communication uses nested (multi-level) data structures. Furthermore, the field designations have been improved, e.g. the EMDIS field REQ_DATE is named as requestDate in the API model classes. 

EMDIS rules from the EMDIS Semantics are modified accordingly to the REST API based approach and are added to each message, where applicable.

A table showing recommended sets of API endpoints to be implemented is provided in appendix A. The set of APIs depends on your use of services.

2.3 API authentication


2.4 General technical design

2.4.1 Message Ordering/Sequencing

The general reasons behind message ordering are:

Message ordering will be realized by:

For the message ordering to work properly, there are different responsibilities of the different parties involved:

The sender is responsible for ensuring the desired order of calls to the Connect APIs.

If API calls are to be scheduled/batched, it is suggested that the sender maintains a queue of outgoing calls/messages so that the message sequence is persistent in the event of system failure.

Make sure the next message is sent only when the status of the previous one has been marked "OK" by SMC.

The central system provides a sequence number which is contained in the response body (general information) to each connect message and in the message retrieved by the receiving registry (meta block).

The sequence number is part of the meta block. The receiver has to check that the sequence number is correct (no numbers missing) and only process the messages if that is ok. Otherwise, go back to the central system and claim the missing message.

Pro:

2.4.2 Message collection - general flow

Messages can be collected via individual API calls against the different "retrieve" API endpoints, which can be described as a "pull model".

The pull model is described in the following steps:

1. Retrieving an overview of all messages that are ready for retrieval by the receiving registry

2. Pulling available messages from corresponding "retrieve" endpoints

After identifying which specific message(s) should be retrieved by using the availableMessages endpoint, the messages can be retrieved from the "retrieve" endpoints that correspond to the message type. In the request body, users can specify parameters such as the limit (number of messages to retrieve), "shouldPeek" and sequenceNumber.

Calling to a "retrieve" endpoint results in the retrieval of the requested messages. Users can process and display these messages in their application based on their type and content.

This pull model allows users to have control over the message type they retrieve, specifying limits and retrieving messages from a particular point in the sequence using "sequenceNumber"

3. Messages are (soft)deleted after retrieval

After retrieval messages are soft-deleted. This means that after retrieval, messages are marked as deleted for the end-user and no longer available in the "availableMessages" and their corresponding "Retrieve" endpoint. 

After soft-deletion, messages will be stored for an additional temporary period of 72 hours. During this timeframe, the data is still restorable. 


4. Restoring messages using the "recoverMessages" endpoint

To recover or "restore" a soft-deleted message, users can call to the "recoverMessages" endpoint. This endpoint allows users to bring back messages that were soft-deleted within a 72 hour timeframe.

This approach provides an additional safety measure for end users. In case a message was mistakenly deleted during the retrieval process, or if there is a need to recover soft-deleted data, this mechanism allows for data recovery without permanent loss.

Users should be aware that the functionality to restore messages is limited to 72 hours. After this window, the soft-deleted messages are permanently removed from the system. Also see: Chapter 2.4.7 Message storage retention policies.

2.4.3 "shouldPeek" function

The "shouldPeek" function, which is specified as a parameter for every "Retrieve" endpoint, allows users to preview messages without marking them as retrieved or soft-deleted. It serves as a testing utility to inspect messages without altering their status within the system.

This function is valuable for debugging and ensuring the proper functionality of the message retrieval process.

It is crucial to emphasize that the "shouldPeek" function should only be used for testing purposes to ensure proper functioning of the intended message-flow.

2.4.4 RESTful best practices

In the development of Match Connect, we have adhered to RESTful best practices to ensure optimal performance and maintainability. 

The design-choices for Match Connect prioritize simplicity, scalability and standardization. 

Justification for some of these decisions are further explained below:



2.4.5 Generic message flow for Connect messages

For all user generated connect messages from a patient registry to a donor registry or vice versa the generic message flow consists of the message sent (e.g. a Sample Request) and a corresponding Message Response (6.2). The detailed message flow for such a message including the generic response message is shown below. The generic response message will be omitted in request message flows in chapter 5, for better readability. 

For further details on the message response itself see chapter 6.2.

The message flow below also shows the direct answer to an API call (for simplicity only 200 and 400 are shown).

The flow includes the routine, asychronous check for pending messages that has to be implemented by each participating registry in the Connect system, see 2.4.2.


participant "Patient Registry" as PR

control "Match-Connect" as MC

control "Search & Match\nService" as SM

participant "Donor Registry" as DR

skinparam SequenceMessageAlign center

skinparam dpi 92

== Sending a user generated message ==
PR -[#dodgerblue]> DR : Send 'Message A'

group details
note left DR: routine asychronous check for pending messages
DR -[#green]> MC : Call /availableMessages to check for not-picked up messages
activate MC #FFBBBB
MC -> DR : 200 OK - Array of messages not yet delivered (**emtpy**)
MC -> DR : 400 Bad Request
deactivate MC

PR -[#green]> MC : Call respective Request-API to send 'Message A'
activate MC #FFBBBB
MC -> PR : 200 OK
MC -> PR : 400 Bad Request
deactivate MC
 
DR -[#green]> MC : Call /availableMessages to check for not-picked up messages
activate MC #FFBBBB
MC -> DR : 200 OK - Array of messages not yet delivered (**'Message A'**)
MC -> DR : 400 Bad Request
deactivate MC
 
DR -[#green]> MC : Call respective Response-API to picked up 'Message A'
activate MC #FFBBBB
MC -> DR : 200 OK
MC -> DR : 400 Bad Request
deactivate MC 
end
== Providing the generic response ==
DR -[#dodgerblue]> PR : Message response (ack, reject, warning to 'Message A') \nshould always include messageId of referring message

group details
PR -[#green]> MC : Call /availableMessages to check for not-picked up messages
activate MC #FFBBBB
MC -> PR : 200 OK - Array of messages not yet delivered (**emtpy**)
MC -> PR : 400 Bad Request
deactivate MC

DR -[#green]> MC : Call /messageResponse API to send the generic response to 'Message A'
activate MC #FFBBBB
MC -> DR : 200 OK
MC -> DR : 400 Bad Request
deactivate MC
 
PR -[#green]> MC : Call /availableMessages to check for not-picked up messages
activate MC #FFBBBB
MC -> PR : 200 OK - Array of messages not yet delivered (**generic response to 'Message A'**)
MC -> PR : 400 Bad Request
deactivate MC
 
PR -[#green]> MC : Call /messageResponseRetrieve API to pick up the generic response to 'Message A'
activate MC #FFBBBB
MC -> PR : 200 OK
MC -> PR : 400 Bad Request
deactivate MC
 
end


2.4.6 Automatically generated and manually curated Swagger

The use of both an automatically generated and manually curated Swagger serves a dual purpose.

The automatically generated Swagger (https://connect-api.wmda.info/swagger/index.html) reflects the implementation of the API endpoints in its current state with accurate details on the sub-schemas. This representation ensures that implementers have access to the most up-to-date information.

The manually curated Swagger (https://apispecs.wmda.info/?urls.primaryName=Connect%20API) plays a crucial role in communication to stakeholders. This representation reflects a broader overview of the relevant endpoints and provides insights into planned future endpoints. This curated version therefore also acts as a guide to provide a clearer understanding of the future development of Match Connect.

Together, these two approaches provide important information about technical accuracy and communication about the development of Match Connect.

2.4.7 Message storage retention policies

Messages sent using the Connect API have the following retention policies applied: 

Message stateRetention time
In MatchConnect system, but not yet retrieved90 days after being received by sending organisation
In MatchConnect system, retrieved72 hours after retrieval. During this time the message can be recovered and retrieved again. 

Messages in the MatchConnect system are stored in encrypted format. Only administrators with access to the message storage and with the proper decryption key are able to read the contents of messages. Additional infrastructure level encryption is also applied. 

The MatchConnect system has redundancies and backups in place that decrease the likelihood of the system going down or messages getting lost. If the system would undergo a fatal crash, the system can be restored from a backup. Message sequence numbers would be restored to the state of the last backup. This may be 1 hour at most.