CommunicationRequest + Messaging
Communication
One of the most important points that exist in PSI is the communication between entities and patients. Since HAPI FHIR allows us to record communications and we have a communication mediator, it has been decided to implement in the FHIR mediator the functionality to record the communication and request the communication mediator to send a message. To make this call friendly, these two steps (register and send a message) will be performed in a single request. The requester will make the same request as the one he would send to HAPI FHIR and once it reaches the mediator, the mediator will perform the appropriate steps to send the request.
To make this communication possible, the FHIR Communication resource is used.
Points to consider:
The sender and the recipient have the same medium in the telecom (see how to indicate the medium in the telecom https://psi.atlassian.net/l/cp/7K9JAGBD).Ā
The project and the medium exist in the communication mediator (see https://psi.atlassian.net/l/cp/udjD7cdr).
Once this is done, when a POST request is sent with this information, the service will send the request to the communication service to send the message and will save this communication in the database.
Ā
Reminders
There are times when we want to schedule messages to be sent on a specific date. We call these messages reminders. FHIR provides the CommunicationRequest resource to record this information. In addition to being stored, we also want these reminders to be carried out. To do this, we again make use of the FHIR mediator to implement this functionality.
The only thing to do is to create a POST request of a CommunicationRequest to OpenHIM and the FHIR mediator will be in charge of processing it.
Points to consider:
The sender and the recipient have the same medium in the telecom (see how to indicate the medium in the telecom https://psi.atlassian.net/l/cp/7K9JAGBD).Ā
The project and the medium exist in the communication mediator (see https://psi.atlassian.net/l/cp/udjD7cdr).
The CommunicationRequest status=active.
How it works
A special endpoint sendMessages has been created for the FHIR mediator. This call performs a search for CommunicationRequests that have the status=active and as occurenceDateTime the same as the current date, hour, and minute.
Each one extracts the medium to know the type of communication. It also makes a query of the sender and receipt in the HAPI FHIR server to extract the telecoms that have the same communication medium. That is why it is important in organizations and patients to specify in the telecom its medum and telecom {{medium}}|{{telecom}} (e.g whatsapp|+2500000).
Once you have this information you prepare the request with the appropriate payload to send it to openHIM and let the communication mediator take care of it. Once the message has been sent, the mediator creates a Communication resource in HAPI FHIR indicating the result of this communication.