# GSoC 2017 - Patient Matching 2.0 - Final Presentation

**URL:** <https://talk.openmrs.org/t/gsoc-2017-patient-matching-2-0-final-presentation/13057>\
**Category:** GSoC\
**Tags:** gsoc2017, patient-matching, gsoc2017-finaleval\
**Created:** [August 25, 2017, 9:39am UTC](https://talk.openmrs.org/t/gsoc-2017-patient-matching-2-0-final-presentation/13057 "2017-08-25T09:39:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lahiruj](https://talk.openmrs.org/user_avatar/talk.openmrs.org/lahiruj/32/8199_2.png) [@lahiruj](https://talk.openmrs.org/u/lahiruj)\
**Post date:** [August 25, 2017, 9:39am UTC](https://talk.openmrs.org/t/gsoc-2017-patient-matching-2-0-final-presentation/13057/1 "2017-08-25T09:39:46Z")

</div>

## Patient Matching 2.0

Primary Mentor - @burkeBackup Mentor - @sgrannis

I would like to divide my whole project into two parts for the better understanding.

**1. Incremental Patient Matching**** 2. Merging Patients & Excluding non-matching Patients from the Patient-Matching Report**

According to my GSoC project my primary goal was number 1 whereas the secondary goal was number 2. I have completed both of them successfully. Allow me to give a description about these two parts.

* * *

## Incremental Patient Matching

To give a little introduction on what incremental patient matching is, it is a method of identifying duplicate patients very efficiently. In a real world scenario, the requirement would be to match thousands of patients with each other. Once this matching process continues it would be very time consuming since all of the patients are compared with each of them regardless of the fact that two or three new patients are added/updated. Incremental patient matching is used as a suggestion to save time.

Before showing how this has been done, I want to highlight few things related to this scenario.

> - By default the checkbox Incremental Match is checked. User can perform a patient match as an incremental or as a normal patient match where all the patients are compared with each of them.

> - A single report per a strategy. The report will be named as **_incremental-report-[strategy-name]_**

> - To perform an incremental patient match it is necessary to have an already generated report for that particular strategy. otherwise module will compare every patient to all the others.

> - Incremental patient matching will be performed only if a single strategy is selected.

Here is how the report generating user interface looks like after the changes

 ![](https://talk.openmrs.org/uploads/default/original/2X/f/f1152e455f5386ccc250eb699de57c2db22b7246.png)

* * *

**How this Works?**

**Run a report with the configuration name “test1”**

 ![](https://talk.openmrs.org/uploads/default/original/2X/1/16890b4b3cdb7d4b062876dc1ca6d89fb6cbc46f.png)A report will be created adding the _incremental-report_ text to the configuration name.

**This is how it looks like when a patient match is performed at the first time**

 ![](https://talk.openmrs.org/uploads/default/original/2X/1/113feec61c45e67af78ce8b71ae25c411dcabf2e.png)

**Add a patient which shows a match with an existing record**

 ![](https://talk.openmrs.org/uploads/default/original/2X/6/68a606bfffd64007e3a7adb7791b2ce8a0d904a5.png)

**Run the report again (Incremental patient matching)**

 ![](https://talk.openmrs.org/uploads/default/original/2X/a/a3b08c87f2c0da846999c75e5d91a8554298cead.png)

The same _incremental-report-test1_ report will be updated.

**New patient is added which do not exhibit any matching property with existing records**

 ![](https://talk.openmrs.org/uploads/default/original/2X/e/e6832b6deb4aa5a8535609ba93cfea5f5685b983.png)

Then there will be no changes in the report.

**Add another patient**

 ![](https://talk.openmrs.org/uploads/default/original/2X/b/b7dc173d1e76eccbf7ab9deabb3bcd16ddf0c356.png)

**Report will be updated as the following image**

 ![](https://talk.openmrs.org/uploads/default/original/2X/e/e83558b6282a289868c1afee042270a88e558240.png)

**Update an existing patient in a way that it will show matching properties with existing records**

 ![](https://talk.openmrs.org/uploads/default/original/2X/9/9b4e84a3d005113a3cca8463a95ff14957849591.png)The updated patient will be added to the **same group** in the report.

**Update an existing paitient in the patient-matching report in a way that it will no longer exhibit matching properties**

Here is a new report

 ![](https://talk.openmrs.org/uploads/default/original/2X/f/f04ed1152cb405dd67b00f40a73a5addbbaddc47.png)

I am going to do two operations. Update patient IDs 9 and 53. After running the report again as an incremental patient matching the report will be as following

 ![](https://talk.openmrs.org/uploads/default/original/2X/f/fe6270260bed24b9ef487879411fb086051efa97.png)

The group 1 has been updated and you can see that patient 9 is missing. The whole group 2 has been removed. After the patient 53 is updated it is pointless to have a single patient record in the report.

**NOTE :** Every changes happen to the **same** patient matching report

* * *

## Merging Patients & Excluding Non-Matching Patients

After doing the changes to the report this is how it looks like.

 ![](https://talk.openmrs.org/uploads/default/original/2X/a/aa9ed276d77ce3a5adc2508eb1f98a51579ccb6d.png)

There are two buttons, one is for merge patients and the other one is to exclude non-matching patients. Initially both the buttons are disabled and they will enabled once you select at least two patients from a group.

**Merging Patients** Suppose that patients 41 and 46 refer to the same person and 39 and 53 refer to the same person. If so, I will perform merging operation with them. (Should have to perform in two steps first merge 41 and 46 then 39 and 53) After performing that the report will looks like as follows

 ![](https://talk.openmrs.org/uploads/default/original/2X/8/824cab445c8eea43fe89296a067f81050a409ffe.png)

By re-running the report it will not generate those groups 2 and 3 again.

 ![](https://talk.openmrs.org/uploads/default/original/2X/8/8cf39f9ca1abb4b25839f48cf339895cf6b88aa7.png)

**Excluding Non-Matching Patients**

Let us do few things,

Suppose that patients 53 and 39 are referred to two different people. Then you can easily instruct the module that

> _these two records do not represent a single patient so don’t consider these two as a match when generating the report again._

 ![](https://talk.openmrs.org/uploads/default/original/2X/d/d7403a4a857e60980dd74fb092a87afe4f76d2fa.png)

After excluding those two and if the report is regenerated you can see that the whole group of patients 37, 39, and 53 has been removed.

 ![](https://talk.openmrs.org/uploads/default/original/2X/1/150566a86988218ebe99a9eb1b0002f88a215aa4.png)

If I do the same thing for patients 49 and 48 only those two records will be removed since there are other records which exhibit matching properties with themselves.

* * *

## Code Contribution

**Issues that I opened**

[PTM-82](https://issues.openmrs.org/browse/PTM-82) - Load patients for the incremental matching [PTM-83](https://issues.openmrs.org/browse/PTM-83) - Generate and save reports in incremental patient matching process [PTM-84](https://issues.openmrs.org/browse/PTM-84) - Perform patient match with two datasources [PTM-85](https://issues.openmrs.org/browse/PTM-85) - Option to select or deselect incremental patient matching [PTM-86](https://issues.openmrs.org/browse/PTM-86) - Update patient-matching report when patients in the report are updated [PTM-87](https://issues.openmrs.org/browse/PTM-87) : To merge patients in the patient matching report [PTM-88](https://issues.openmrs.org/browse/PTM-88) : To exclude non-matching patients from the report [PTM-89](https://issues.openmrs.org/browse/PTM-89) - Ignore voided patients when running patient match

All of the above issues are completed successfully.

Here are the commits related to each of the issue. (Note that all of the commits related to single issue has been squashed.)

PTM-82 - [https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/b3ffd77b394cf021b3b4552bda726100e39b6190](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/b3ffd77b394cf021b3b4552bda726100e39b6190) PTM-83 - [PTM-83: Save and update incremental patient matching report to the da… · lahirujayathilake/openmrs-module-patientmatching@7704534 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/7704534457797845ecf6896072a3c441494d8299) PTM-84 - [PTM-84: Functionality to support two datasources · lahirujayathilake/openmrs-module-patientmatching@c810245 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/c81024533508ac91f57a48c9b41beb2ebdc74595) PTM-85 - [PTM-85: Functionality to select or deselect incremental match · lahirujayathilake/openmrs-module-patientmatching@35172a9 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/35172a90f9ec061b9027d37f6757f53463ea1df6) PTM-86 - [PTM-86 : Remove matching pairs from the report when patients are updated · lahirujayathilake/openmrs-module-patientmatching@b624286 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/b624286e1ad362ecf283a942f6b4d4c1b9429b75) PTM-87 - [PTM-87 : Functionality to Merge Patients in the report · lahirujayathilake/openmrs-module-patientmatching@6ee57f1 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/6ee57f19ef62eea642b18d1642c938cd2033f8ab) PTM-88 - [PTM-88 : Functionality to exclude non-matching patients · lahirujayathilake/openmrs-module-patientmatching@b1f3fcc · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/b1f3fccf5151ee10f4d2282e62c88fa8b93dcca4) PTM-89 - [PTM-89 : Ignore voided patients when running a patient match · lahirujayathilake/openmrs-module-patientmatching@be4f391 · GitHub](https://github.com/Lahiru-J/openmrs-module-patientmatching/commit/be4f39153b976dc3493f7541ff3e590ba1ecb73c)

* * *

## Project Documentation Wiki

[Here](https://wiki.openmrs.org/display/projects/Patient+Matching+2.0+Project) is the link to project documentation wiki.

* * *

## Video Presentation

[![](https://img.youtube.com/vi/4icbmSikLzE/maxresdefault.jpg "GSoC 2017 Patient Matching 2.0 Final Presentation") ](https://www.youtube.com/watch?v=4icbmSikLzE)

* * *

## Experience

Throughout this summer I learned a lot. Whenever there were problems related to the project I had a great support from my mentor and the community. Participating in daily scrums showed me how good this OpenMRS community is. My mentors are the best. They gave me guidance at the first place, conducting many video conferences because of that I could carry out this project with a sound knowledge. @burke, @sgrannis thank you very much for your support throughout this summer. I feel really grateful to these mentors

Thanks everyone for conducting GSoC projects in a well organized manner 🙂

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [September 14, 2017, 12:18pm UTC](https://talk.openmrs.org/t/gsoc-2017-patient-matching-2-0-final-presentation/13057/2 "2017-09-14T12:18:38Z")

</div>

Thank you for your contributions @lahiruj :). Keep up your good work.
