How unique are uuids and branch uuids?
Are they unique across all EpiCollect5 so that all uuids and branch uuids are different?
Are they unique across all EpiCollect5 so that all uuids are different and all branch uuids are different.
Are they unique within a project so that all uuids within a project are different, but made duplicate across projects? Similar for branch uuids?
I need to write an application to download from 4 different projects, one with branch entries, and would like to shortcut and use the uuid (or branch uuid) as a key in a database table to track the downloads.
Nevermind, I should have thought it through a little more. Instead of a short cut, I’ll make the key to the table be a combination of the client id, the uuid, and the branch uuid (or blank).
They are using, I think, 128 bit UUIDs. These are by design unique. There is no central way that they are managed. They are algorithmic, with a one in a billion chance of a single UUID being generated twice.
Therefore, there is no point combining the UUID with anything, as the difference of generation between UUIDs inside a branch, are no different to UUIDs between branches.
Epicollect5 uses UUIDv4
UUID version 4 (UUIDv4) is a universally unique identifier generated using random numbers. This means that each UUIDv4 is unique with a very high probability.
There are a total of 2^122 possible UUIDv4s, which is a very large number. To put it in perspective, if you were to generate 1 billion UUIDv4s per second, it would take you approximately 86 years to generate all of them.
The probability of generating two identical UUIDv4s is extremely low. It is estimated that the probability of generating a duplicate UUIDv4 is 1 in 340 undecillion (3.4 × 10^38). This is equivalent to the probability of flipping a coin and getting heads 38 times in a row.
In practice, UUIDv4s are unique enough for most applications. They are often used to generate unique identifiers for objects in databases, distributed systems, and other software applications.
Here are some examples of where UUIDv4s are used:
- To generate unique identifiers for database records
- To generate unique identifiers for files and directories
- To generate unique identifiers for users and devices in distributed systems
- To generate unique identifiers for sessions and transactions
- To generate unique identifiers for messages in messaging systems
Overall, UUIDv4s are a very reliable way to generate unique identifiers. They are highly unlikely to collide, even in large and complex systems.