Overview
Requisition number - A shared identifier common to all service requests that were authorized more or less simultaneously by a single author, representing the composite or group identifier. All services requests that were created as a part of a single episode of care will have the same requisition number.
Requirements
- Must be the same for all entities (service requests) related to the single episode of care
- Must be unique among all episodes of care
- Not a sequence - so no-one can generate new Requisition based on knowledge of the existing one
- Must be easy to read and pass a number to other person via any channel: orally, phone, sms
- Must contain only numbers and some letters that looks the same in Cyrillic and Latin alphabet and can be entered via the phone keypad: A, B, C, E, H, I, K, M, O, P, T, X
Solution
Requisition number has the following structure
0123-4567-89AB-CEIK - 4 blocks that contains 4 characters with total length 16characters
Implement a hashing function with episode of care ID and salt as an argument
- Salt is empty by default
- Get a digest (hex) of hashing on episode ID (it is proposed to use 8 bytes digest size)
- Convert digest into required character set
- Format result
This example shows how to get requisition
Output:
The proposed solution means that after new requisition number was generated we should check that it is unique in the DB.
If it is not unique - generate salt and and generate new requisition number with episode of care ID + salt
Repeat this until we get unique requisition number. Save salt to DB in order to generate the same requisition number for the same episode of care
Data model
Proposed storage structure
Attribute | Type | Nullable |
---|---|---|
episode_id | uuid | N |
requisition | string | N |
Open questions
- Read existing requisition from DB
or generate anyway based on episode and salt