What’s the difference between the patient id and the internal patient id?

Home > Synergy > Hints and tips > Reports


Nothing !
I consider “internal patient id”, “internal id”, and “patient id” to be exact synonyms.

You don’t mean “patient number” by either of these two terms do you ?


Well, “patient id” (aka “internal patient id”, or “patient.patient_id”) is almost totally internal to the system, never normally being shown and only really being seen in reports queries and raw data such as CSVs.

There is also the “patient number” which is what shows on the screen in clinic, and on printouts etc. In reports this is known as Patient.Patient_Number or Patient.External_No (the latter is an older alias, to be avoided). This is the real world patient number.

It is not technically an “ID” since it is not a guaranteed unique identifier, and as such is not used internally to link tables. In fact it need not even be a number. This is allowed because some other systems allow non-numeric patient numbers, so we must support them too. The patient number is more like a name than an ID, similar to the NHS number field. We store it and display it and can look up by it, but it has no special significance. The internal ID has very special significance internally but no real world meaning. It must be unique and numeric only, for database reasons, hence the need for 2 “numbers”, one internal, one external, and a lot of confusion.

People tend to call the “external” patient number the patient id when in fact it isn’t. Anything used as a patient identifier can be considered an “ID” I suppose, including their name, but you won’t hear us using “ID” for anything other than an internal database unique ID.

Patient Number and Patient ID may coincidentally have the same value, or be +/- 1, but that is not always true. Since adding a patient makes both a new number and a new ID, they tend to be the same for new patients. This is also why patient numbers tend to be impractically long, because the internal ids are that long. They need not be the same at all, they just are for historical reasons. We could in theory change the patient numbers in a database, leaving the IDs unchanged. In fact you can change anything at all about a patient and they will still be the same patient – as long as their ID stays the same.

LogoRik Smithies: endspan

en English