Implemented duplicate patients management. (#4502)
* Implemented duplicate patients management.
Identification and correction of duplicate patients involves the following:
1. Column "dupscore" in the patient_data table was created to contain a value representing
the likelihood that the patient duplicates any of the patients created earlier (that is,
with a lesser "pid" value). It may have any of the following values:
o -9, initially assigned, indicating that it needs to be computed.
o -1, indicating that the patient has been manually flagged as not duplicating a previous patient.
o A score in the range 0-40 computed by the SQL expression found in library/dupscore.inc.php.
A value of 12 or higher is considered to be very likely a duplicate.
2. The script library/dupscore.inc.php which provides the SQL expression needed for scoring.
3. The command-line tool contrib/util/dupscore.cli.php which should be run to initially
assign all patient_data.dupscore values, and may be run from time to time to update
or recompute them. See the source of that script for its usage syntax.
4. The web tool Administration -> Patient -> Manage Duplicates.
For each patient with a dupscore of 7 or higher, it shows below it all the corresponding
matching patients. Thus you see a collection of patient groups.
Within each group you can choose to mark the first patient as not a duplicate, or you can
merge it with one of the other patients. You do that by choosing "Merge and Keep" or
"Merge and Discard" for the other patient, which brings up the Merge Patients page to
complete the merge. That page describes in more detail what it will do.