UNICEF Thailand Primero Interoperability Phases 1 & 2
Repository to manage OpenFn jobs to integrate the UNICEF Primero and Thailand MoPH HIS and Child Shield systems for secure case referrals exchange.
Note! Commits to ‘master’ branch will deploy automatically to live integration on OpenFn.org.
(1) Functional Requirements
The Interoperability Solution enables Primero case workers to consult historical patient information stored in the MOPH HIS system by fetching the information and sending it to Primero for display. The solution has also been extended to fetch risk model data and home service questionnaire data for better case understanding and management.
Workflow 1: Primero –> Child Shield
- Description: Syncing Primero cases to Child Shield for daily reporting.
An automated workflow has been configured to fetch primero cases and then either create or update the cases’ intervention status and additional data in Child Shield, for both existing and previously closed cases without this information.
Workflow 2: HIS/Child Shield –> Primero
- Description: On-demand sync of HIS and Child Shield risk data to inform case plans.
When a case worker refreshes case data in Primero by using the Primero Sync
button, any available forms (E.g. home service questionnaire, physical check assessment and risk data) for this person saved under the HIS or Child Shield systems are synced back to Primero.
(2) System APIs
APIs implemented:
-
Primero: API v2 The API uses
Basic authentication
for login and therecord_id
for upserting cases. -
MOPH systems: API endpoint
Sample Data:
- When a record is found: sample record
- When no records are found: no record found
OpenFn language-packages (API adaptors) implemented:
(3) Data & Workflows
The business process flow diagram can be found here. The Technical workflow diagrams describing the integration logic can be found here:
Workflow 1: Primero –> Child Shield
The various integration jobs for this workflow are listed below, and illustrated in the Functional Workflow (Figure 1) below.
Get Primero Cases from HIS
fetches patient information from HIS based onnational_id
received in Primero sync notification.Get Translations from Primero
fetches field translations in Primero and posts them to the OpenFn InboxMap data & sync to ChildShield
maps translated case data & syncs with Child Shield by either creating or updating intervention.
Figure 1 - Functional Workflow 1: Primero –> Child Shield
Workflow 2: HIS/Child Shield –> Primero
The various integration jobs for this workflow are listed below, and illustrated in the Functional Workflow (Figure 2) below.
Get Patient Data from HIS
fetches additional patient information such as risk data and home service information from HIS based onnational_id
received in Primero sync notification.Sync Data to Cases in Primero
sends the fetched HIS patient information to be displayed in Primero along with status information to re-enable the Sync button.Upsert Failed Cases with Failed Sync Status
re-enables the Sync button in Primero without updating the case, in a situation where no matching patient is found in HIS. If any other error occured during the HIS sync, it will send fail status to re-enable the sync button with aSync failed
message.Send Primero Failure Status
re-enables the Sync button in Primero and updates the case, in a situation where a matching patient record was found in HIS but the sync failed.
Figure 2 - Functional Workflow 2: HIS/Child Shield –> Primero
(4) Flow Triggers
Trigger Type: Event
For both flows, HIS <> Primero sync is launched when OpenFn receives a sync request notification from Primero.
Integration Assumptions
- This integration was configured according to the mapping specifications finalized in January 2023.
- Every case will have a
National Id
that will be used to search for patient records in the HIS. - The “sync” transaction will be initiated (1) automatically after create of new cases, and (2) whenever a user clicks the
Sync
button in Primero.
(5) Data Element Mappings & Transformations
- For Flow 1, See this sheet for the integration mapping specifications.
- For Flow 2, See these sheets for the integration mapping specifications.
Note
- If data synced from HIS is edited in Primero, it will be overwritten with the original value (or blank if there was no value in HIS) at the next sync.
Physical examination
subforms are uniquely identified byintervention ID + patient cid
.Unexpected pregnancy
subforms are uniquely identified bydate
and position of subform in list of pregnancy subforms.- The
Child Shield
Forms that are updated in Flow 2 are:- Child’s Quality of Life Questionnaire (CQ1)
- Child’s Quality of Life Questionnaire (CQ2 - AUQUEI1)
- Caregiver Survey form - PSu1 and PSu2 file
- Parent-Child Conflict Tactics Scale (CC-CTSPC-R)
- Risk Model
(6) Change Management
System administrators are responsible for identifying if changes may impact the OpenFn integration.
- If login credentials are changed for either system, the relevant Credential must be updated in OpenFn.org.
- If system changes are made to any of the fields referenced in the field mappings, the OpenFn jobs should be reviewed and tested to confirm no impact on the integration.
- If the list of available Forms in either system changes, then the mapping should be reviewed in the mapping document to confirm no updates are required in the OpenFn jobs.
- The Flow 2 jobs are confirgured to detect exact keyword matches of the relevant fields in the Child Shield API response. Changes to any of these field names, as well as structure of the JSON response can cause the Primero updates to fail entirely or result in those modified fields not being updated in Primero.
(7) Administration
Provisioning, Hosting, & Maintenance
This integration is hosted on OpenFn.org with Primero SaaS. OpenFn will provide ongoing maintenance support.
Error handling
The sync can have 3 statutes in Primero:
- Synced: the data transfer was successful and HIS data is displayed in Primero
- Not found: the
national ID
was not found in HIS, no data is added to Primero - Failed: an error occured during the process, no data is added to Primero
Support
Primero system administrators will be responsible for ongoing integration monitoring and management.
Primero System Administrators: Mohan Masarangi Magar mmmagar@unicef.org, Panat Jongsamakkeethaworn pjong@unicef.org, and Nakul Pannoy npannoy@unicef.org
MOPH System Administrators: Kumpha Brohmsena king.nkp@gmail.com, Watcharawan Teerawat pinklotus1818@hotmail.com, Choorug Lao-Akra choorug@yahoo.co.uk
Contact support@openfn.org with any questions or troubleshooting support.
Training Materials
- Open Function - Thailand Primero IO Flow 1 Training for Administrators (English/Thai) slides
- Open Function - Thailand Primero IO Training for Administrators Video
- Primero End User Training - English
- Open Function - Thailand Primero IO Flow 2 Training for Administrators (English)
- OpenFn Administation - End user Training (with Thai translation)
Support Checklist
- OpenFn Admin users & access levels confirmed
- OpenFn Admin training
- Support POCs identified for each connected system