From 60916ee73239f2dae834f239a5a425d8b17efeb1 Mon Sep 17 00:00:00 2001 From: SebaMutuku Date: Tue, 9 Apr 2024 15:11:19 +0300 Subject: [PATCH 1/6] Docs for P2P Sync --- docs/engineering/writing-fhir/p2p_sync.mdx | 57 +++++++++++++++++++++ static/img/{ => p2p-sync}/p2p.png | Bin 2 files changed, 57 insertions(+) create mode 100644 docs/engineering/writing-fhir/p2p_sync.mdx rename static/img/{ => p2p-sync}/p2p.png (100%) diff --git a/docs/engineering/writing-fhir/p2p_sync.mdx b/docs/engineering/writing-fhir/p2p_sync.mdx new file mode 100644 index 0000000000..5da69074dc --- /dev/null +++ b/docs/engineering/writing-fhir/p2p_sync.mdx @@ -0,0 +1,57 @@ +# Device P2P Sync configuration +FhirCore android supports Device to device data sharing via Point-to-Point syncing. + Add P2P library as one of your dependencies. For the example in FhirCore, we use ```p2p-lib = "XXX-SNAPSHOT``` in the libs.version.toml file. Once done, sync your application to update the added library + +### Enabling p2p sync configuration +This is done through two ways. +a. Navigation configurations + +```json + { + "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 configs +|Property | Description | Required | Default | +|--|--|:--:|:--:| +id | uniquieId of your p2p_sync block | yes | | +visible | Boolean to show whether this is to be shown | yes | `apps` | +display | title text that should be shown on the device | yes | | +menuIconConfig | The icon to be shown. This can be configured through ICON configuration. See widgets | No | | +actions | Action to be performed when once clicks on the display above. See actions parameters under questionnaire | yes | | + +NB: Remember, a WORKFLOW can be launched anywhere on the app through an action. Either by a text, actionable button or image icon hence the above config can be used anywhere else. + +You also need to define which resources to be synced. This configuration should be added as part of Application configuration file under config-types/application +b. ``` json + "deviceToDeviceSync": { + "resourcesToSync": [ + "Group", + "Patient", + "CarePlan", + "Task", + "Encounter", + "Observation", + "Condition", + "Questionnaire", + "QuestionnaireResponse", + "RelatedPerson", + "Flag", + "Immunization" + ] + } +``` +A sample workflow of P2P looks like ![P2P_SYNC](/img/p2p_sync/p2p.png), diff --git a/static/img/p2p.png b/static/img/p2p-sync/p2p.png similarity index 100% rename from static/img/p2p.png rename to static/img/p2p-sync/p2p.png From b03e61dc6e18d96a8038afec6cfc1186dd22b58c Mon Sep 17 00:00:00 2001 From: SebaMutuku Date: Tue, 9 Apr 2024 15:21:51 +0300 Subject: [PATCH 2/6] Update image correctly --- .../configuring}/p2p_sync.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) rename docs/engineering/{writing-fhir => android-app/configuring}/p2p_sync.mdx (93%) diff --git a/docs/engineering/writing-fhir/p2p_sync.mdx b/docs/engineering/android-app/configuring/p2p_sync.mdx similarity index 93% rename from docs/engineering/writing-fhir/p2p_sync.mdx rename to docs/engineering/android-app/configuring/p2p_sync.mdx index 5da69074dc..89f64d81c2 100644 --- a/docs/engineering/writing-fhir/p2p_sync.mdx +++ b/docs/engineering/android-app/configuring/p2p_sync.mdx @@ -35,8 +35,11 @@ actions | Action to be performed when once clicks on the display above. See act NB: Remember, a WORKFLOW can be launched anywhere on the app through an action. Either by a text, actionable button or image icon hence the above config can be used anywhere else. + +b. ### Resources to sync You also need to define which resources to be synced. This configuration should be added as part of Application configuration file under config-types/application -b. ``` json + +``` json "deviceToDeviceSync": { "resourcesToSync": [ "Group", @@ -54,4 +57,5 @@ b. ``` json ] } ``` -A sample workflow of P2P looks like ![P2P_SYNC](/img/p2p_sync/p2p.png), +This can be simplified by a sample workflow show on the image below. +![P2P_SYNC](/img/p2p-sync/p2p.png) From 24b30989c58ca7ea157ba8c816b8743aabd82b58 Mon Sep 17 00:00:00 2001 From: SebaMutuku Date: Tue, 9 Apr 2024 15:24:14 +0300 Subject: [PATCH 3/6] Update formatting --- docs/engineering/android-app/configuring/p2p_sync.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/engineering/android-app/configuring/p2p_sync.mdx b/docs/engineering/android-app/configuring/p2p_sync.mdx index 89f64d81c2..386183929c 100644 --- a/docs/engineering/android-app/configuring/p2p_sync.mdx +++ b/docs/engineering/android-app/configuring/p2p_sync.mdx @@ -4,7 +4,7 @@ FhirCore android supports Device to device data sharing via Point-to-Point synci ### Enabling p2p sync configuration This is done through two ways. -a. Navigation configurations +#### Navigation configurations ```json { @@ -36,7 +36,7 @@ actions | Action to be performed when once clicks on the display above. See act NB: Remember, a WORKFLOW can be launched anywhere on the app through an action. Either by a text, actionable button or image icon hence the above config can be used anywhere else. -b. ### Resources to sync +#### Resources to sync You also need to define which resources to be synced. This configuration should be added as part of Application configuration file under config-types/application ``` json From 0dec51fec27070c402bf915c16a4d8c889a7d45e Mon Sep 17 00:00:00 2001 From: pld Date: Mon, 15 Apr 2024 11:51:40 -0400 Subject: [PATCH 4/6] cleanup text and fix image location --- .../android-app/configuring/p2p_sync.mdx | 94 ++++++++++-------- static/img/{p2p-sync => }/p2p.png | Bin 2 files changed, 50 insertions(+), 44 deletions(-) rename static/img/{p2p-sync => }/p2p.png (100%) diff --git a/docs/engineering/android-app/configuring/p2p_sync.mdx b/docs/engineering/android-app/configuring/p2p_sync.mdx index 386183929c..2df474b446 100644 --- a/docs/engineering/android-app/configuring/p2p_sync.mdx +++ b/docs/engineering/android-app/configuring/p2p_sync.mdx @@ -1,61 +1,67 @@ -# Device P2P Sync configuration -FhirCore android supports Device to device data sharing via Point-to-Point syncing. - Add P2P library as one of your dependencies. For the example in FhirCore, we use ```p2p-lib = "XXX-SNAPSHOT``` in the libs.version.toml file. Once done, sync your application to update the added library +# P2P Sync -### Enabling p2p sync configuration -This is done through two ways. -#### Navigation configurations +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 enble P2P sync we need to make changes to enable viweing P2P UI elements and configure what to sync over P2P. + +### Navigation configurations ```json - { - "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" - } - ] - } +{ + "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 configs + +### Config properties of P2P sync + |Property | Description | Required | Default | |--|--|:--:|:--:| id | uniquieId of your p2p_sync block | yes | | visible | Boolean to show whether this is to be shown | yes | `apps` | -display | title text that should be shown on the device | yes | | -menuIconConfig | The icon to be shown. This can be configured through ICON configuration. See widgets | No | | +display | Title text that should be shown on the device | yes | | +menuIconConfig | The icon to show. This can be configured through ICON configuration. See widgets | No | | actions | Action to be performed when once clicks on the display above. See actions parameters under questionnaire | yes | | -NB: Remember, a WORKFLOW can be launched anywhere on the app through an action. Either by a text, actionable button or image icon hence the above config can be used anywhere else. - +:::info +A WORKFLOW can be launched anywhere on the app through an action. Either by a text link, actionable button, or image icon. +::: #### Resources to sync + You also need to define which resources to be synced. This configuration should be added as part of Application configuration file under config-types/application ``` json - "deviceToDeviceSync": { - "resourcesToSync": [ - "Group", - "Patient", - "CarePlan", - "Task", - "Encounter", - "Observation", - "Condition", - "Questionnaire", - "QuestionnaireResponse", - "RelatedPerson", - "Flag", - "Immunization" - ] - } +"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](/img/p2p-sync/p2p.png) +![P2P_SYNC](/img/p2p.png) diff --git a/static/img/p2p-sync/p2p.png b/static/img/p2p.png similarity index 100% rename from static/img/p2p-sync/p2p.png rename to static/img/p2p.png From bba5a606545e20f90ef69f0a5e4d3dc0eda407ca Mon Sep 17 00:00:00 2001 From: SebaMutuku Date: Tue, 14 May 2024 11:46:09 +0300 Subject: [PATCH 5/6] Add links to references --- docs/engineering/android-app/configuring/p2p_sync.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/engineering/android-app/configuring/p2p_sync.mdx b/docs/engineering/android-app/configuring/p2p_sync.mdx index 2df474b446..ba1ae7e4c3 100644 --- a/docs/engineering/android-app/configuring/p2p_sync.mdx +++ b/docs/engineering/android-app/configuring/p2p_sync.mdx @@ -4,7 +4,7 @@ OpenSRP supports device-to-device syncing through an additional library. To add ## Enabling P2P sync configuration -To enble P2P sync we need to make changes to enable viweing P2P UI elements and configure what to sync over P2P. +To enable P2P sync we need to make changes to enable viewing P2P UI elements and configure what to sync over P2P. ### Navigation configurations @@ -34,16 +34,16 @@ To enble P2P sync we need to make changes to enable viweing P2P UI elements and id | uniquieId of your p2p_sync block | yes | | visible | Boolean to show whether this is to be shown | yes | `apps` | display | Title text that should be shown on the device | yes | | -menuIconConfig | The icon to show. This can be configured through ICON configuration. See widgets | No | | +menuIconConfig | The icon to show. This can be configured through ICON configuration. [See here](https://docs.opensrp.io/engineering/android-app/configuring/config-types/widget#how-to-use-button-with-icon-and-copy-ability) | No | | actions | Action to be performed when once clicks on the display above. See actions parameters under questionnaire | yes | | :::info -A WORKFLOW can be launched anywhere on the app through an action. Either by a text link, actionable button, or image icon. +The P2P WORKFLOW can be launched anywhere on the app through text link, actionable button or image icon. An example is shown above where we can launch it through navigation configurations. ::: #### Resources to sync -You also need to define which resources to be synced. This configuration should be added as part of Application configuration file under config-types/application +You also need to define which resources to be synced. This configuration should be added as part of [Application configuration](https://docs.opensrp.io/engineering/android-app/configuring/config-types/application) ``` json "deviceToDeviceSync": { From 0a6197790e6632751b928cdced94cdda86ef0eb8 Mon Sep 17 00:00:00 2001 From: Elly Kitoto Date: Wed, 15 May 2024 09:07:56 +0300 Subject: [PATCH 6/6] Update p2p documentation --- docs/engineering/android-app/configuring/p2p_sync.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/engineering/android-app/configuring/p2p_sync.mdx b/docs/engineering/android-app/configuring/p2p_sync.mdx index ba1ae7e4c3..f2efb36702 100644 --- a/docs/engineering/android-app/configuring/p2p_sync.mdx +++ b/docs/engineering/android-app/configuring/p2p_sync.mdx @@ -38,7 +38,7 @@ menuIconConfig | The icon to show. This can be configured through ICON configura actions | Action to be performed when once clicks on the display above. See actions parameters under questionnaire | yes | | :::info -The P2P WORKFLOW can be launched anywhere on the app through text link, actionable button or image icon. An example is shown above where we can launch it through navigation configurations. +DEVICE_TO_DEVICE_SYNC application workflow can be triggered via configurable actions as indicated in the sample navigation configuration above. ::: #### Resources to sync