Getting valid UUID generated from imported demographic data

Hi Everyone! New to OpenEMR and am excited to see what it can do.

I’m trying to import some data using a CSV table using myphpadmin. On the latest build of OpenEMR.
I’m stuck at the UUID generation bit. Importing raw data isn’t an issue, but getting the system to generate a valid 16 character binary uuid is where i’m stuck at.

Has anyone else successfully imported demographic/drug data from a different platform into OpenEMR?


1 Like

Hey @Mel,

welcome to OpenEMR. Hope you find this application useful.

STEP 1: to deal with the UUID situation in the drugs table, just increment the UUID field/column in your CSV and import the data into the table. The system will automatically convert the UUID field.

STEP 2: After importing the CSV file, headover to your browser and enter https://link_to_openemr/sql_patch.php. This should automatically fix any UUID inconsistencies in the database.

This is not related to your question but it may help people who would want to upload drug information.
These are the tables involved in setting up drugs correctly.

  1. drugs
  2. drug_templates
  3. prices
  4. drug_inventory

Let me know if this helps.

1 Like

Hie @kkappiah!

Thanks so much for replying and for the warm welcome! I’m actually importing demographics to the patient_data table. The pid column can be populated with an ascending series, but I’m having problems with the uuid generation.

Patient data that’s entered via openemr is automatically assigned a 16char binary uuid from what I can see, but data that is manually imported direct into the table via myphpadmin doesn’t seem to have that uuid generated.

I’ve done some searching and there are talks of using a script to generate that uuid. It’s here that I’m lost. I’ve tried the update uuid() command, but it fails to generate the same 16char binary uuid the system assigns by default.

Hi @Mel ,

the same approach as outlined above would work for the patient_data as well.

use the same ascending series for the pid in the UUID field.

After successfully importing the data, then run this script


You should see the number of UUID mappings at the end of the page.


Hi @kkappiah!

Thanks a lot for the clarification. That sorted out the UUID issue.

I ran into another problem while making modifications to the Demographics form. My imported data lacks some of the entries that the default Demographics form has, thus the mods.
I made the changes using the layout editor option to the Demographics form, mostly just changing entries to UNUSED, and some modifications to the ID(?) Column, Label(?) Column, and the Descriptions.

I’m stuck with a new Query error upon registering and calling up existing patients.

## Query Error

ERROR: query failed: select pid, id, lname, fname, mname, suffix, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS from patient_data where pid = '1' order by lname ASC, fname ASC

Error: Unknown column 'suffix' in 'field list'

/var/www/localhost/htdocs/openemr/library/ at 817:sqlStatement
/var/www/localhost/htdocs/openemr/library/ at 859:getPatientPID(Array)
/var/www/localhost/htdocs/openemr/src/OeUI/OemrUI.php at 84:getPatientFullNameAsString(1)
/var/www/localhost/htdocs/openemr/interface/patient_file/summary/demographics.php at 336:__construct(Array)

I tried running the sql_patch and sql_upgrade scripts, but the problem persisted. Now I have no idea how to revert to the default layout XD


Hello @Mel ,

running sql_patch and sql_upgrade scripts would not fix the problem you’re facing.

Never mess with the default ID’s that ship with OpenEMR. Most of them are referenced in the codebase which will lead to similar errors.

I dont know the version you’re on but the error indicates that ‘suffix’ has been removed/changed/not present in the patient_data table.

Revert the field you changed back to suffix and that should solve your problem

1 Like