Portal self registering new patient with existing email in openemr db

I tried to test the portal for self registering and there were 2 hiccups:

1- when an email exists in the db for another patient ( Likely family member since they may share phone numbers and email addresses) it gives an error and prompts patient to call office….How to negate that?..…In this area why no emphasis on record ID number like any relational db ? or am I missing something and I did not understand, I worked before on solutions in FileMaker Pro and I know that a record number is unique to every record created and it is the one that defines it, even if I delete a record that number goes from the next one… So if I create a new patient1 it gets tagged with 000000001, and patient2 000000002, then if I delete patient2 and create patient3 it gets 000000003 and the ID for patient2 cannot be used again, that will minimize duplicates significantly and you still keep checking 3 modifiers but the ID of the record is the one number that defines it…here I noticed the ID number changes with deleted and created records…is there any rational behind that I am missing?

2- if patient is cash and does not have insurance and I get to the insurance step and put “Self” it continues with the steps but when I finish the last step it gives an error yet it does get the info in the db…also what do I need to do to negate it since patient will think it did not go through and will definitely call to know…minimizing calls with auto registering is an objective.

Unless I am missing something I think this is a fundamental flaw in the design of openemr, if I am wrong please correct me.
ABC of relational database is having a unique record ID when created and if that record is deleted that ID goes with it for ever and cannot be used again…I could not find from the early interaction with openemr what is the record id of patient’s ?
if I create a patient it gives it record ID 1 if I delete it then create a new patient it gives it ID 1???
That is a flaw in the design, I looked at the magnificent schema of openemr which is HUGE and COMPLEX design but how could that basic principle being omitted?
Again please correct me if I am wrong , I must be missing something…but may be that is the reason why we are scrambling for record id’s from phone numbers or emails which should not be used except as modifiers to check reference to the main ID ( unique for each record, Patient records could be PAT000000001 and goes incremental by 1, provider records PROV000001, meds records MED000000001 so on so forth, if record is deleted that ID goes for good from db)

OpenEMR from the beginning was designed to not delete patient records. As a matter of US law HIPAA and state record retention laws requires data retention of patient records for long periods of time (6+ years). OpenEMR I believe was designed around these requirements initially.

If you want to change how the pid value is generated, submit a pull request to make it an auto_incremented column. You’d need to make sure your DDL sets the initial auto increment to be the current max value of the table + 1. I personally am not impacted by this as the pid is always unique for me as I don’t delete patient records since my legal jurisdiction prevents it.

A couple of years ago we introduced the uuid as a unique internal database identifier to represent each patient in the way you are describing. However, since most of OpenEMR table structure predates this uuid, it is only starting to trickle into other tables as a unique foreign key.

That said the internal database identifier really has no relation to public facing medical record number (MRN) which can be the generated pid, or from what I recall allows a user entered MRN in the ‘pubpid’ field.

Hope that helps.

1 Like

Ah, so THAT’s what that UUID is I’ve been seeing! Thanks for the education, @adunsulag !
Just to confirm your recollection, yes, from the user’s point of view, a patient record is numbered in one of two ways: the default record number is the patient’s ‘pid’, and that is also what is used internally to identify patient records. If you’d prefer you can set an external ID in Admin/ Features/ Mask for Patient IDs which is stored in the patient_data table as ‘pubpid’. However, even if a ‘pubpid’ is set, the ‘pid’ is still used internally.

1 Like

Thank you for the your candid reply. I recall when I was working on my emr solution in FileMaker to get certified with CCHIT way back then that you can delete a record but you have to keep a trail of it in a log , so if you are asked legally to produce it, you have it, even if it is deleted, but with it goes its ID ( I gave up on the solution when I hit the wall of X12 xml mapping with its convoluted path, I still have the schema but was too much for one person to do), thank you again for the explanation.

Thank you , the internal machinery of making sure each record is unique is at work and no need for any extra steps…just I would like to know if a record is deleted is it retained in a log and if so , where?

Hi @Mohammad -
In older versions of OpenEMR an admin had direct access through the main menu to the OpenEMR logs. These did indeed record activities such as deleting records, and they were incredibly useful to have.

Unfortunately, that menu access was removed… I think around OpenEMR v5.something? And I think the only way one can see that stuff now is to get into the EMR’s server. But I don’t normally go there, so I can’t help with that.

Best- Harley

So if I have it standalone on my local server where would I expect to find those deleted records or the tool to handle them?
Prior to V5 where was this direct access to the logs leads to?

I think the logs are still accessible from the Admin → System → Logs feature. There’s an option to search on patient deleted events.

Thank you, actually the log captured the deleted record, but does it capture only the event of deletion or it keeps the deleted record in case I need to furnish it for whatever reasons? if the latter …where?

While I was working on a different “bug” where I was unable to delete a patient that I posted in another thread I was happy to find this in the deleter.php

So any deleted patient record is flagged as deleted but to keep the ONC requirements it is not actually deleted…… there is my answer…great feature, hat is tipped to openemr…!!