Below is the design of the module. The final module would evolve around this design.
The module should trigger each time a patient is saved in OpenMRS and should send a PAM message in the background to a HIE endpoint.
We might want to send PAM profiles in real time, hence each time a new patient is created, his/her PAM profile needs to be sent out. (We would not want to perform any bulk data import/export.)
Basically we want to extend the functionality of the ‘create patient’ option, by sending the PAM profile of the patient being created.
This however gives us little control over sending profiles.
We can therefore have an ‘Enable PAM’ option in our module. (See screenshot below)
So each time a new patient is created, and ‘PAM profile option’ is enabled in our module, then the profile should be sent.
Regarding the option to allow messages to be queued and retried if OpenMRS has no Internet connection, we will display the patients whose PAM profiles are in queue.
Here we will add a scheduled task to attempt to resend queued profiles on a certain time period.
Preferably we can have options to resend the PAM profile or retire the profiles. (See screenshot below)