API Question: PID VS. PUUID

Hi!

Trying to understand the difference between the two patient Id’s: PID & PUUID - in the Standard OEMR API documentation.

I know that PID is created when I create a new patient, but the get patient and some other functions use PUUID & I’m not sure when/where that is created or how to access it.

Thanks!

Hi,

As you may know, UUID’s are used to uniquely identify records.

PID = Patient ID (by default it is an auto-increment field)
PUUID = Patient Universal Unique Identifier (Not autoincremental, alphanumeric)

check the topic (What is UUID?)

In OpenEMR, when a new patient is created, both PID and UUID’s are generated.
The UUID generated in OpenEMR is binary and is converted to PUUID which is a string representation. check openemr/src/FHIR/SMART/SmartLaunchController.php line 68 to see how the UUID is manipulated

There are different UUID’s in the system relating to different tables. PUUID is the UUID that uniquely identifies a patient in the patient table (patient_data).

There’s also another UUID which is generated when an encounter is created. That’s EUUID.

I hope this was helpful.

2 Likes

Sorry for bumping an old thread.

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?

Thanks!

If you run the sql_upgrade.php script after you do your import it will generate all of the UUIDs if they don’t exist in the system. Have you tried that?