Skip to main content

P2P Sync

OpenSRP supports device-to-device syncing through an additional library. To add the P2P library use p2p-lib = "XXX-SNAPSHOT in your libs.version.toml file. After this sync your application to update the added library.

Enabling P2P sync configuration

To enable P2P sync we need to make changes to enable viewing P2P UI elements and configure what to sync over P2P.

{
"id": "p2p_sync",
"visible": true,
"display": "Transfer Data",
"menuIconConfig": {
"type": "local",
"reference": "ic_p2p"
},
"actions": [
{
"trigger": "ON_CLICK",
"workflow": "DEVICE_TO_DEVICE_SYNC",
"id": "navigateToP2PScreen"
}
]
}

Config properties of P2P sync

PropertyDescriptionRequiredDefault
iduniquieId of your p2p_sync blockyes
visibleBoolean to show whether this is to be shownyesapps
displayTitle text that should be shown on the deviceyes
menuIconConfigThe icon to show. This can be configured through ICON configuration. See hereNo
actionsAction to be performed when once clicks on the display above. See actions parameters under questionnaireyes
info

DEVICE_TO_DEVICE_SYNC application workflow can be triggered via configurable actions as indicated in the sample navigation configuration above.

Resources to sync

You also need to define which resources to be synced. This configuration should be added as part of Application configuration

"deviceToDeviceSync": {
"resourcesToSync": [
"Group",
"Patient",
"CarePlan",
"Task",
"Encounter",
"Observation",
"Condition",
"Questionnaire",
"QuestionnaireResponse",
"RelatedPerson",
"Flag",
"Immunization"
]
}

This can be simplified by a sample workflow show on the image below. P2P_SYNC