[SOLVED] Consistency in use of numeric IDs and UUIDs for Patient in RefApp

I have noticed that coming to the patient dashboard from searching for a patient the uuid is used in the url http://localhost:8080/openmrs/coreapps/clinicianfacing/patient.page?patientId=a3c66fd9-8e7a-43c6-8010-cccd0b6a17de yet the links to the page are like:

  1. Start Visit (numeric id): javascript:visit.showQuickVisitCreationDialog(1752)
  2. Merge Visits (uuid): http://localhost:8080/openmrs/coreapps/mergeVisits.page?patientId=a3c66fd9-8e7a-43c6-8010-cccd0b6a17de
  3. Chart Search (both numeric id and uuid)- http://localhost:8080/openmrs/chartsearch/chartsearch.page?patientId=1752&returnUrl=%2Fopenmrs%2Fcoreapps%2Fclinicianfacing%2Fpatient.page%3FpatientId%3Da3c66fd9-8e7a-43c6-8010-cccd0b6a17de%26

What is the recommended value to use and why?

Either id or uuid should work i guess but using id will break down into some number-format exception issues i guess for some fragments which can be avoided by using uuid; i don’t actually remember when i last got into this when working on chartsearch which used id before it evolved to use uuid and still as you have probably noticed; consistence is a great consideration

@k_joseph please elaborate on what number format exception issues you have run into - what caused them etc? Would the UUID provide slower performance in queries and searches?

Going forward you should always prefer to use UUIDs in links.

The reason is that this allows screens to be written in either server side Java code, or client side JavaScript that uses REST (and thus requires UUIDs).

Technology-wise, the client side approach will become more important over time.

-Darius (by phone)

+1 to UUIDs. Ids were originally used because UUIDS didn’t exist, and it is a bit of messy mix now, but UUIDs should be preferred going forward.