How to generate uuid used in DataSet

I have a task that requires me to add a patient_identifier within EncounterServiceTest-initialData.xml.

How do I generate a uuid for a patient_identifier ?

Is this be of help UUIDs - Documentation - OpenMRS Wiki

Thanks @sharif for providing the documentation, have gone through the resource and got to understand the concept of uuid.

However, my requirement is not yet addressed I want to add a patient_identifier in the DataSet as mentioned in the post and am looking for away to get a uuid for the data.

One of the many ways is to simply ask Mr Google with text like: online uuid generator


Personally, I often just use this search: uuid at DuckDuckGo and copy the UUID. Hit refresh and get another.


Most programming languages and database engines include a Version 4 UUID generator, which is what you want.

If you just need one or a set of UUIDs for a one time need and have internet access, then @dkayiwa’s approach will work.

I thought it was Mother Google. :wink:


And if you don’t have internet access, most *Nix variants have a uuidgen command (on Windows you need to install the Platform SDK to get access to the uuidgen utility).

1 Like

At first, I thought the uuids used in our DataSets are stored somewhere in kind of a doc.

Have asked Mr Google and he delivered exactly what I wanted.

@ibacher the tool works like magic, imagine generating 3000 uuid’s at once and my requirement needed one. Does it mean each of the generated uuid’s will never be generated again even when not used?

Little did I know that Google has many uuids than I can consume!

I personally call him Dr Google!

Thanks @ibacher @burke @dkayiwa! I have learnt how to fish than just going a way with one fish.

With Version 4 UUIDs (which are the randomly generated ones created by whatever technique you use) there’s no guarantee that they are absolutely unique, but the probability of a collision is so low as to be negligible for practical purposes. Per this site “if you were to generate 1 billion UUIDs per second for 85 years you have a 50% chance of creating a duplicate”. So for your 3000 UUID use-case it should be perfectly fine.

1 Like

If you are using a proper Version 4 UUID generator (random UUID), then you can generate 1 billion UUIDs per second for the rest of your life and there’s an extremely small chance you might create one duplicate. :slight_smile:

You mean you call her Dr. Google. :slight_smile:

1 Like

The tool is too smart!

Sorry, that was a slip of the keyboard. Instead of delivering the text her it stubbornly delivered the opposite.

I personally call him Dr Google!

Yes! (The rest of the text is just to supply the 10 characters requirement. Otherwise all I wanted to type was a YES response :slightly_smiling_face:)


@kdaud can also be helpful , its what i normally use

1 Like