Enforce Unique Patient ID

paradocs wrote on Sunday, September 04, 2011:

I would like to suggest a feature request
to optionally enforce a unique Patient IDs.
The priority is not high since the default
is a warning. The redundant ID can be corrected in:
Patient/Client -> Summary -> Edit Demographics

Still, since the above work around is cumbersome,
practices converting old record numbers and
creating new ID values will find this of value.
For example I find merit in picking a new ID in the
Medisoft ID format @@@@@@## of three letters
of the last name, three letters of the first name,
and two alpha-numeric places to ensure a unique
ID.

The suggested feature is to place a box in
Administration -> Globals -> Features
Add a check box line entitled:
Enforce Unique Patient IDs

Of course I can have the developed for myself
but I thought the community might comment.
Best Wishes  &  thanks for this great endeavor.
paradocs     David Marc Tan Creti, M. D.
Linux 2.6.33.2 i686 : Hiawatha v7.3 : MySQL 5.1.47-MariaDB : PHP 5.3.3
openemr 4.1 forked 08/27/2011

mdsupport wrote on Sunday, September 11, 2011:

Patient records have 3 identifiers - id, pid & pubpid.  First two are unique (enforced at database level). 
Is your question about pubpid ?

mdsupport wrote on Sunday, September 11, 2011:

Oops.  Reply was not complete. 

If you need unique pubpid, why not add a constraint for pubpid column from Admin -> Other -> database -> patient_data?

Also consider this - people change names.  So stick to the search box - you can still type 3 letters of last name and get the list.

paradocs wrote on Sunday, September 11, 2011:

Hi mdsupport
Thanks for the help.
OK then the variable is pubpid which
corresponds to  External ID:

I have set a field @@@@@@## in
Administration -> Globals -> Features
         ->   Mask for Patient IDs
        
I have set Administration -> Layouts
         -> Demographics
line 5 pubpid to Required and the
      options to N=New Patient Form
      and to     D=Dup Check
     
When I test out an External ID and
happen to pick a duplicate by bad
typing or just the luck of the draw -
then I do indeed get a warning.

The software problem is that it should
stop, make the filed red and let me
try again.  What is does is warn but
goes right ahead and makes the entry.
You can confirm this on a test site
and see the warning but all one can
do is dismiss the warning box.  The
code problem is that the warning box
comes after you have committed to create
the patient.

Am I missing a way to heed the warning
not not create a bad duplicate.

Yes I am versed in name changes as
48% of my practice is Hispanic and
many last names are compound. Other
marriage and legal name changes are also
not uncommon.  OpenEmr is wonderful
and has very advance look up even for
parts of name.  Still, I like the above
unchanging lllfff## format to search for
the name someone originally registered
under.  If they tell us that we have
a chance of finding someone who has
changed the first middle and last name.
Also a id of this form can be
easily associated with documents and
make possible a human readable guess
of the identity.

As for restraints, I use to use leathers
and straight jackets but now am limited
to Haldol and such.  Any help with
database restraints would be greatly
appreciated.

paradocs     David Marc Tan Creti, M. D.
Linux 2.6.33.2 i686 : Hiawatha v7.3
: MySQL 5.1.47-MariaDB : PHP 5.3.3
openemr 4.1 forked 08/27/2011

paradocs wrote on Sunday, September 11, 2011:

Hi all
I note by looking at the documentation for 4.0
Documentation/IPPF_Guides/Process 1-1-1 Creating a non-duplicate new OpenEMR record Ver 4-0.pdf’
especially box 7 that 4.1 has been changed to
show both a column for   ID   and   PID

Best Wishes,
paradocs     David Marc Tan Creti, M. D.
Linux 2.6.33.2 i686 : Hiawatha v7.3
: MySQL 5.1.47-MariaDB : PHP 5.3.3
openemr 4.1 forked 08/27/2011

mdsupport wrote on Monday, September 12, 2011:

Make sure you have taken care of known duplicates.  Then click the following

Administration -> Dther -> database -> patient_data (in the list of tables) -> Scroll to bottom of the page for the Indexes:  box
Default setting is

Create an index on 1 columns

Press GO button
In the Create a new index box
Select Index type to be UNIQUE
SelectField to be pubpid varchar(255)
Press SAVEbutton.

If the database does not find a duplicate, the constraint will be in place.

Now repeat your scenario to make sure you get the ugly error from the database.

Once again not a good policy but it will be enforced by the database without any exceptions.

All the best.