Third-Culture-Software / bhima

A hospital information management application for rural Congolese hospitals
https://docs.bhi.ma/
GNU General Public License v2.0
218 stars 104 forks source link

(design) Barcodes for Entities using Partial UUIDs #1079

Closed jniles closed 7 years ago

jniles commented 7 years ago

In bhima, we provide both globally unique identifiers and human readable identifiers (#1069) in a one-to-one mapping, to allow efficient lookups of data by both users and code. These are being re-examined to provide a better and more uniform user experience in #1069.

A fast, efficient way to store and retrieve information is via barcodes (#1066). We cannot use either UUIDs or human readable ids for barcodes because:

  1. UUIDs are 32 characters long and are therefore impractical.
  2. Human Readable IDs do not have a size constraint on them and will grow logarithmically in size.

Proposal An acceptable compromise might be to store only a subset of the characters of the UUID. Coupled with the Human-Readable prefix, we can have a standard way creating barcodes.

The barcodes will consist of:

${Human Readable Prefix}${First 12 characters of the UUID}

for a total of 14 characters to be rendered. All dashes are stripped from the UUID before conversion. All barcodes will be rendered in CODE128.

Example Given the Patient Invoice LUK12 with UUID 007a20fa-d01c-4c68-ad0d-67a7f3b4fa06 in the current system, our barcode would be IV007a20fad01c.

Note that by only using partial UUIDs, we may run into a duplication. This is not a problem for rendering the barcode, but all modules scanning the barcode should be sure to return a Barcode Unreadable error if there are more than one match - the user will have to put in the Human Readable ID to have a completely unique match.

jniles commented 7 years ago

Superseded by https://github.com/Vanga-Hospital/bhima-2.X/issues/9.