ЕСОЗ - публічна документація
Human readable requisition number
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 encounter will have the same requisition number.
Requirements
Must be the same for all entities (service requests) related to the single encounter
Must be unique among all encounters
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 16 characters
Implement a hashing function with episode of care encounter ID and salt as an argument
Salt is empty by default
Get a digest (hex) of hashing on episode encounter 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 encounter.
Data model
Proposed storage structure
Attribute | Type | Nullable | Description |
---|---|---|---|
entity_id | uuid | N |
|
requisition | string | N |
|
entity_type | string | N | Enum:
|
Open questions
Read existing requisition from DB or generate anyway based on episode and salt
Related content
ЕСОЗ - публічна документація