# Merge Patient data from Multiple Installations Project

**URL:** <https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024>\
**Category:** GSoC\
**Tags:** gsoc2018\
**Created:** [May 13, 2018, 2:31pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024 "2018-05-13T14:31:17Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 3, 2018, 11:56am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/41 "2018-06-03T11:56:49Z")

</div>

Still about dependencies, I don’t know why some thing small still troubles me 🤭  
and I’m not sure of the **java --version** the module should depend on. I’m currently running java **1.8**.   
 I’m confused on how to tell maven on which version of java it should compile and build the module. Taking a step to solve my blocker, I modified my [properties](https://github.com/samuelmale/openmrs-module-mergepatientdata/blob/master/pom.xml#L75-L78) of my POM. But still get this [error](https://pastebin.com/4FPR2Uty).

cc @ssmusoke , @wyclif , @dkayiwa

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 3, 2018, 12:39pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/42 "2018-06-03T12:39:43Z")

</div>

Resolved. Looks like I didn’t have the compiler plugin 😄

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 3, 2018, 3:02pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/43 "2018-06-03T15:02:54Z")

</div>

> [@samuel34](#):
>
> Resolved. Looks like I didn’t have the compiler plugin

After fixing the above, I have again run into some other compilation error.   
It looks like this [import](https://github.com/samuelmale/openmrs-module-mergepatientdata/blob/master/omod/src/main/java/org/openmrs/module/mergepatientdata/extension/html/AdminList.java#L16) can’t be resolved by eclipse. On compiling the module with maven, I got this [error](https://pastebin.com/vzuXSSub).   
Could I be missing some dependency. Here is my [POM](https://github.com/samuelmale/openmrs-module-mergepatientdata/blob/master/omod/pom.xml)  
CC: @ssmusoke , @dkayiwa , @mksd

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 4, 2018, 9:37am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/44 "2018-06-04T09:37:25Z")

</div>

Could anyone be in position to help me with my blocker?

cc: @dkayiwa , @ssmusoke , @wyclif

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 4, 2018, 10:36am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/45 "2018-06-04T10:36:14Z")

</div>

The repo is here

> **[samuelmale/openmrs-module-mergepatientdata](https://github.com/samuelmale/openmrs-module-mergepatientdata)**
>
> openmrs-module-mergepatientdata - OpenMRS module that is a solution to un consistent internet connections to some OpenMRS implementations using the current OpenMRS SYNC module. It merges patient da...

cc: @mksd

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [June 4, 2018, 11:04am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/46 "2018-06-04T11:04:33Z")

</div>

Add this dependency: [https://github.com/openmrs/openmrs-module-xforms/blob/master/omod/pom.xml#L80-L85](https://github.com/openmrs/openmrs-module-xforms/blob/master/omod/pom.xml#L80-L85)

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [June 4, 2018, 11:05am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/47 "2018-06-04T11:05:19Z")

</div>

@samuel34 this specific error is related to a missing dependency on Legacy UI (OMOD I presume) when you depend on Core \>= 2.x.

However your POM configuration is not ok: don’t depend on the Ref App distro. Just make sure to depend on the smaller set of necessary dependencies, module by module.

Since this is a time consuming b\*\*\*ch to go through, I went through it quickly, and I also formatted your POMs while I was at it:

- [pom.xml](https://gist.github.com/mks-d/a9f617df2740657f5c6b7f0bf445b894)
- [api/pom.xml](https://gist.github.com/mks-d/4bdc85bd9eac2347ae6390566218e0e0)
- [omod/pom.xml](https://gist.github.com/mks-d/bd3cfd866e7c479b51f0db18190dc1c8)

So just copy/paste the raw content from the above Gists and all should be ok.

This in the OMOD POM specifically solved the compilation error:

```xml
<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>legacyui-omod</artifactId>
  <version>${legacyuiVersion}</version>
  <scope>provided</scope>
</dependency>

```

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 4, 2018, 12:12pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/48 "2018-06-04T12:12:28Z")

</div>

Thanks @mksd and @dkayiwa . You saved lots of my time 😉

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 25, 2018, 1:01pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/49 "2018-06-25T13:01:11Z")

</div>

Week 6 status update.

> **[Week 6](http://malesamuel34.blogspot.com/2018/06/week-6.html)**
>
> Hi folks, Like I said in the preceding week my machine was down. Actually I purchased another machine. I'm struggling with my dev environm...

cc: @ssmusoke

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 11:26am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/50 "2018-06-29T11:26:40Z")

</div>

Hi ,

I’m getting a challenge to merge the Patient data due to failure of PatientIdentifier Validation. I’m not so sure of how the [Check Digit Algorithm](https://wiki.openmrs.org/display/docs/Check+Digit+Algorithm) works but what I want is to modify the a PatientIdentifier by appending something like ‘#MPD’ on the Existing PatientIdentifier. This would help to differentiate original Patients from those that were merged/imported.

Any thoughts on this

cc: @ssmusoke, @dkayiwa

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 11:51am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/52 "2018-06-29T11:51:26Z")

</div>

Was this really for me @ssmusoke ! If so the link you provided can’t be accessed.

---

<div class="post-metadata">

**Author:** ![ssmusoke](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ssmusoke/32/8020_2.png) [@ssmusoke](https://talk.openmrs.org/u/ssmusoke)\
**Post date:** [June 29, 2018, 11:53am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/53 "2018-06-29T11:53:05Z")

</div>

Why are you changing the value of the identifier? How does the current sync module do it?

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 3:01pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/54 "2018-06-29T15:01:38Z")

</div>

According to the Testing I have done, if sync2 hits upon such incidence( Trying to add a Resource to a Parent with another existing Resource having the same Identifier) sync2 deletes the old Resource and replaces it with new one. Could this be recommended? @ssmusoke, @dkayiwa

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 3:16pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/55 "2018-06-29T15:16:26Z")

</div>

I think its deleted by the FHIR request,

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 3:21pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/56 "2018-06-29T15:21:19Z")

</div>

Should I also copy/borrow that ideology from sync2?

cc: @ssmusoke, @dkayiwa

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [June 29, 2018, 3:49pm UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/57 "2018-06-29T15:49:10Z")

</div>

> [@samuel34](#):
>
> I’m getting a challenge to merge the Patient data due to failure of PatientIdentifier Validation

Apart from this, the module can now export and import data using default config. Just gonna implement customized configuration and auditing.

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [July 2, 2018, 6:10am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/58 "2018-07-02T06:10:27Z")

</div>

Seventh week update

> **[week 7](http://malesamuel34.blogspot.com/2018/07/week-7.html)**
>
> Hi folks, Its now seven weeks down the road since I begun working on the  Merge Patient Data  Module. I think I have been slow with progr...

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [July 2, 2018, 7:18am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/59 "2018-07-02T07:18:28Z")

</div>

I’m planning to persist Audits, but instead of creating more two tables, does it make sense to serialize these fields and store the as texts in just columns in on table

> <https://gist.github.com/samuelmale/0544f4de54f8df7decc1aa7564c6adf2#file-auditmessage-java-L15-L16>

@ssmusoke

---

<div class="post-metadata">

**Author:** ![ssmusoke](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ssmusoke/32/8020_2.png) [@ssmusoke](https://talk.openmrs.org/u/ssmusoke)\
**Post date:** [July 2, 2018, 7:25am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/60 "2018-07-02T07:25:20Z")

</div>

@samuel34 I would like to see a high level design on the whole approach as currently it is not clear to me

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [July 2, 2018, 7:48am UTC](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024/61 "2018-07-02T07:48:00Z")

</div>

During a given operation(Export/Import), its very possible to hit errors.

Eg,

- When you try to export data from an Openmrs instance without the required Resource in the DB, this Operation won’t be successful coz there is nothing export
- When you have wrong config, the Operation won’t be successful.
- When you try to merge duplicate Resources, the Operation won’t be successful
- etc…

For a good User Experience, we will need an assessment of what really transpired, why given resources failed to sync, How many Resources where Merged etc…

Audit Domain.

Adding on other Attributes like, `Id, Operation, TimeStamp,Status` etc… I have

```
private List<String> resources;//This store all Resources involved in a given operation(Export/Import)

private HashMap<String, List<String>> failureDetails;//Stroes Error messages which are determined by resource name(Key)

```

Remember we can work with many Resources in one Operation so the above Map maps Error messages to their Resources.

Now peristing these Requires me to have 3 table.

1. audit\_message
2. resource
3. error\_message

But since these Resource names when serialized form a small String and `failureDetails ` are a form relatively long string but no that long, I don’t think I should create all these tables but rather serialize these two fields to something like a json String and store each into its column rather than rendering tables 😄

@ssmusoke

[Previous page](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024.md?page=2)

[Next page](https://talk.openmrs.org/t/merge-patient-data-from-multiple-installations-project/18024.md?page=4)
