# Patient Identifier Configuration — MRN and PHN ## Overview Open HMIS assigns each patient two distinct identifiers: | Identifier | Stands For | Scope | Authority | |---|---|---|---| | **MRN** | Medical Record Number | Institution-local | Configured by the hospital | | **PHN** | Personal Health Number | National | Sri Lanka Ministry of Health | Both identifiers are configurable through **Administration → Manage Institutions → Preferences → Application Options**. --- ## Medical Record Number (MRN) ### What Is an MRN? The MRN is a unique identifier assigned by the hospital at the point of registration. It is local to your institution — it is not shared with other hospitals or the national registry. The MRN appears on patient wristbands, printed bills, lab reports, prescription labels, and all clinical documents. ### MRN Generation Strategies Go to **Administration → Manage Institutions → Preferences → Application Options** and search for **MRN** to see all related settings. #### Strategy Selection The `MRN Generation Strategy` option controls how each new MRN is produced: | Strategy Value | Format Produced | Example | |---|---|---| | `SEQUENTIAL` | Pure sequential number | `000423` | | `SEQUENTIAL_YEAR` | Year + sequential | `2026-000423` | | `SEQUENTIAL_DEPT` | Department code + sequential | `OPD-000423` | | `SEQUENTIAL_SITE` | Site code + sequential | `CLB-000423` | | `SEQUENTIAL_INSTITUTION` | Institution code + sequential | `RHM-000423` | | `RANDOM_ALPHANUMERIC` | Random characters of fixed length | `B7KX3M` | | `CUSTOM_PREFIX_SEQUENTIAL` | Your chosen text + sequential | `MAIN-000423` | #### Prefix Components Each prefix component is independently toggled on or off: | Configuration Key | Type | Description | |---|---|---| | `MRN Include Year Prefix` | Boolean | Prepend the registration year (e.g. `2026`) | | `MRN Year Format` | Enum (YYYY / YY) | Four-digit or two-digit year | | `MRN Include Department Code` | Boolean | Prepend the registering department's short code | | `MRN Include Institution Code` | Boolean | Prepend the registering institution's short code | | `MRN Include Site Code` | Boolean | Prepend the registering site's short code | | `MRN Custom Prefix` | Short text | Any static text prefix (e.g. hospital abbreviation) | | `MRN Delimiter` | Short text | Separator between components (e.g. `-`, `/`, or blank) | **Example:** With `MRN Custom Prefix = RH`, `MRN Include Year Prefix = true`, `MRN Year Format = YY`, `MRN Delimiter = -`, and a sequential count of 1523, the MRN produced is `RH-26-001523`. #### Sequential Number Options | Configuration Key | Type | Description | |---|---|---| | `MRN Sequential Digit Count` | Integer (4–10) | Zero-padded width of the sequential component | | `MRN Sequential Scope` | Enum | `GLOBAL` / `PER_INSTITUTION` / `PER_DEPARTMENT` / `PER_YEAR` | | `MRN Reset Sequence Annually` | Boolean | Restart from 1 each calendar year (useful with Year prefix) | > **Warning:** If you change `MRN Sequential Scope` after patients are already registered, the sequential counter resets. This may cause duplicates. Change scope only during initial setup. #### Check Digit (Optional) A check digit is a calculated trailing character that allows staff to detect typing errors at the point of data entry. When enabled, the system automatically appends it to every generated MRN and validates it when an MRN is entered manually. | Configuration Key | Type | Description | |---|---|---| | `MRN Check Digit Enabled` | Boolean | Append a check digit to every MRN | | `MRN Check Digit Algorithm` | Enum | `LUHN` / `VERHOEFF` / `DAMM` | **Algorithm comparison:** | Algorithm | Detects Single-Digit Errors | Detects Transpositions | Complexity | |---|---|---|---| | Luhn | Yes | Most | Simple | | Verhoeff | Yes | All | Complex | | Damm | Yes | All | Moderate | Luhn is the default and is suitable for most deployments. Choose Verhoeff or Damm if your clinical environment requires the highest possible error detection (e.g. laboratory or blood bank). #### Auto-Generation | Configuration Key | Type | Description | |---|---|---| | `MRN Auto-generate on Registration` | Boolean | When `true`, MRN is assigned the moment a patient record is saved. When `false`, staff may type an externally assigned MRN during registration. | --- ## Personal Health Number (PHN) ### What Is a PHN? The PHN is a **lifelong, nationally unique identifier** issued in accordance with the **Sri Lanka National Digital Health Guidelines and Standards (NDHGS)** published by the Ministry of Health. It enables patient records to be linked across different hospitals and health institutions throughout the country. The PHN is stored in the `Patient.phn` field and is printed on patient registration cards and clinical documents. ### PHN Standards Sri Lanka has two active PHN standard versions. The system supports both. > **Default:** The system ships with `PHN Standard Version = V2` (National Digital Health Guidelines and Standards). This is the current standard mandated by the Ministry of Health. Change to `V1` only if the HIU specifically instructs you to use the older format. #### Version 1 — National eHealth Guidelines and Standards (NeGS) Format: **`PPPP`** + **`NNNNNNNNNN`** + **`C`** | Component | Length | Type | Description | |---|---|---|---| | POI (Point of Issue) | 4 | Numeric | Identifies the issuing institution | | Sequential number | 10 | Numeric | Monotonically increasing, scoped to the POI | | Check digit | 1 | Numeric | Modified Luhn (Regenstrief) check digit | **Total length: 15 characters** Example: POI `1042`, sequence `0000001523`, check digit `7` → PHN `104200000015237` #### Version 2 — National Digital Health Guidelines and Standards (NDHGS) Format: **`PPPP`** + **`RRRRRRRRRR`** + **`C`** | Component | Length | Type | Description | |---|---|---|---| | POI (Point of Issue) | 4 | Alphanumeric | Identifies the issuing institution | | Random segment | 10 | Alphanumeric | Randomly generated; supplied by the Ministry per POI | | Check digit | 1 | Alphanumeric | Modified Luhn (Regenstrief) check digit — supports letters | **Total length: 15 characters** Key constraints for Version 2: - Each POI is limited to **1 million unique numbers**. The system enforces this limit and will warn administrators when the POI approaches capacity. - Before assigning a new PHN, the system verifies the candidate does not already exist in the patient database (up to 10 attempts before raising an alert). #### Modified Luhn (Regenstrief) Check Digit The standard Luhn algorithm only handles numeric characters. Version 2 PHNs are alphanumeric, so the system uses the **Regenstrief modification** which converts each character to a numeric value via its ASCII code (minus 48) before applying the standard Luhn doubling-and-summing procedure. This allows check-digit calculation and validation on identifiers that contain letters. #### Version 1 — Worked Example Institution POI: `1042` Sequential count for that POI: `1523` Zero-padded to 10 digits: `0000001523` Concatenated before check digit: `10420000001523` Modified Luhn check digit calculated: `7` **Final PHN: `104200000015237`** #### Version 2 — Worked Example Institution POI: `H04B` (alphanumeric) 10-character random segment generated: `3KX7MQ2P9R` Concatenated before check digit: `H04B3KX7MQ2P9R` Modified Luhn (Regenstrief) check digit calculated: `5` **Final PHN: `H04B3KX7MQ2P9R5`** The system verifies `H04B3KX7MQ2P9R5` is not already stored in any patient record before assigning it. If a collision is found, a new random segment is generated (up to 10 attempts). --- ### PHN Configuration Keys Go to **Administration → Manage Institutions → Preferences → Application Options** and search for **PHN**. | Configuration Key | Type | Default | Description | |---|---|---|---| | `PHN Standard Version` | Enum | **`V2`** | `V1` / `V2` / `EXTERNAL` / `NONE` | | `PHN Auto-generate on Registration` | Boolean | `true` | Assign a PHN automatically when a new patient is saved | | `PHN POI Number Scope` | Enum | `GLOBAL` | `GLOBAL` — single POI for all registrations; `PER_INSTITUTION` — each institution uses its own POI (from Institution master) | | `PHN POI Number` | Short text | _(empty)_ | The 4-character POI code (used when scope is `GLOBAL`) — obtain from the Sri Lanka HIU | | `PHN Sequential Start` | Integer | `1` | Starting sequential number for Version 1 | ### Externally Provided PHN Some patients arrive with a PHN already assigned at another facility. Set `PHN Standard Version = EXTERNAL` and `PHN Auto-generate on Registration = false`. When staff enter a PHN manually during registration, the system: 1. **Validates the format** — checks length, character set, and check digit 2. **Checks for duplicates** — queries all existing patient records for the same PHN 3. **Offers deterministic matching** — if a match is found, the system displays the existing patient record and asks staff whether to: - Link the new visit to the existing patient (recommended — avoids duplicates) - Proceed as a new registration (creates a separate record) This workflow prevents the most common source of duplicate patient records in multi-facility environments. ### Setting `PHN Standard Version = NONE` When set to `NONE`, the PHN field is hidden from registration screens and no PHN is generated or validated. Use this setting only for deployments that do not participate in the Sri Lanka national eHealth programme. --- ## Where Identifiers Appear | Location | MRN | PHN | |---|---|---| | Patient registration form | Input / display | Input / display | | Patient search results | Column | Column | | OPD bill header | Yes | Yes | | Inward (BHT) cover sheet | Yes | Yes | | Lab report header | Yes | Yes | | Prescription label | Yes | Optional | | Patient wristband | Yes | Yes | | Patient card / registration card | Yes | Yes | --- ## Patient Search Using Identifiers From any patient search panel (OPD registration, inward admission, pharmacy, etc.): - Type the **MRN** in the patient search field to retrieve the patient directly - Type the **PHN** in the patient search field to retrieve the patient directly - Partial MRN and partial PHN searches are supported --- ## Frequently Asked Questions **Can a patient have both an MRN and a PHN?** Yes. These are independent fields. A patient always receives an MRN at registration. Whether a PHN is also assigned depends on your configuration. **What happens if PHN generation fails (all 10 random attempts collide)?** The system logs an alert and does not assign a PHN. The patient record is saved without a PHN, and an administrator notification is raised. Staff must retry manually from the patient detail page once the issue is investigated. **Can I change an MRN after it has been assigned?** The MRN field can be edited by a user with the appropriate privilege (`Edit Patient MRN`). However, changing an MRN that is already printed on physical records (wristbands, lab tubes) can cause clinical risk. Change MRNs only after careful consideration and a clear relabelling workflow. **What is a POI number and where do I get it?** The Point of Issue (POI) number is assigned by the Sri Lanka Health Information Unit (HIU) of the Ministry of Health. Contact the HIU to obtain your institution's POI before enabling PHN generation. Entering an unofficial or self-assigned POI produces PHNs that will not be recognised by the national registry. **We have multiple institutions under one deployment. Do they each get a separate POI?** That depends on your arrangement with the HIU. If each institution has its own POI, set `PHN POI Number Scope = PER_INSTITUTION` and configure the POI on each institution record in **Administration → Manage Institutions**. If the entire deployment shares one POI, set `PHN POI Number Scope = GLOBAL` and enter the POI in `PHN POI Number`. **Does Version 2 PHN generation require an internet connection?** No. Version 2 uses local random generation within the system. The Ministry assigns a block of valid random seeds to each POI; the system uses those seeds offline. --- ## Related Articles - [Patient Identifiers — MRN and PHN (End User Guide)](../Patient-Identifiers-MRN-and-PHN) - [System Configuration Guide](System-Configuration-Guide.md) - [Application Options Reference](Application-Options-Reference.md) - [Add a New Patient](../Add-new-patient.md) - [Add New Institution](../Add-New-Institution.md)