# Naming Standards

### Audience

* Data Modelers
* Database Administrators
* Database Developers
* Application Developers

A simple and consistent naming convention for database objects, when followed rigorously, can help database application developers greatly.

### Common Naming Standards

Common standards are followed

* **Singular names for the entities**
* **Object name length to be less than 30 chars**
* **Lowercase object names separated by an underscore (\_)**
* **Only defined abbreviations are used**
* **No prefix or suffix to the table names**
* **Each table is defined as an alias, this alias is used in constraints and index names**

### Database Naming Standards

The database names will follow the below naming convention **mosip\_(abbreviated value of the module name)**

**Ex: mosip\_prereg**

### Schema Naming Standards

The schema name is named after the DB name, by default, without mosip\_. If there is more than one schema in a DB, then a proper single-word name is assigned, either a full word or an abbreviated word. **Ex: prereg**

### Table Naming Standards

* The table name can have one or two words that describe the contents of the table separated by an underscore (\_).
* Table name should always be in the singular.
* An alias for each table is defined, this alias can be used in various other places like reference keys, indexes, constraints, etc.

### Index Naming Standards

Indexes are named as idx\_(table-alias)\_(column-abbreviation)

### Key Naming Standards (Primary, Unique, Foreign Keys)

**Primary Key:** Each table should have a primary key, the key should be named “pk\_table-alias\_column-name”. If it is a composite key, then in place of the column name any meaningful name can be provided.

**Unique Key:** If a surrogate is used as PK then create a unique key, on fields that uniquely define a business key. The naming of the unique key should be “uk\_table-alias\_column-names”.

**Foreign Key:** For any references from a table with the other tables, creating a foreign key is mandatory. This helps maintain referential integrity. A foreign key can be named as fk\_\_table-alias1\_table-alias2

### Attribute Standards

Standardize the attribute implementation-defined the following common datatypes used across the MOSIP system. The datatype sizes are defined to consider multi-language storage support, which may vary based on the implementation.

| Attribute             | Attribute Description                                | Type              | Size |
| --------------------- | ---------------------------------------------------- | ----------------- | ---- |
| vid                   | Virtual ID                                           | character varying | 36   |
| uin                   | Unique Identification Number-Encrypted               | character varying | 500  |
| reg\_id               | Registration ID                                      | character varying | 39   |
| \_code                | Code                                                 | character varying | 64   |
| \_descr               | Description                                          | character varying | 256  |
| \_type                | Type                                                 | character varying | 128  |
| \_name                | Name                                                 | character varying | 128  |
| \_id                  | Identification Code / Number                         | character varying | 36   |
| \_addr\_line          | address line                                         | character varying | 256  |
| \_loc\_line           | location line                                        | character varying | 128  |
| country               | country                                              | character varying | 64   |
| pin                   | pin                                                  | character varying | 16   |
| \_comment / \_remarks | Comments / remarks captured as part of a transaction | character varying | 1024 |
| count                 |                                                      | smallint          |      |
| \_by                  |                                                      | character varying | 256  |
| ref\_id               | Reference id                                         | character varying | 64   |
| ref\_id\_type         | Reference ID Type                                    | character varying | 64   |
| is\_active            |                                                      | boolean           |      |
| cr\_by                |                                                      | character varying | 256  |
| cr\_dtimes            |                                                      | timestamp         |      |
| upd\_by               |                                                      | character varying | 256  |
| upd\_dtimes           |                                                      | timestamp         |      |
| is\_deleted           |                                                      | boolean           |      |
| del\_dtimes           |                                                      | timestamp         |      |

### Acronyms

The following acronyms are used in the data model

| Abbreviation | Description                 | Abbreviation | Description                    |   |
| ------------ | --------------------------- | ------------ | ------------------------------ | - |
| ack          | Acknowledgement             | active       | Active                         |   |
| addr         | Address                     | autn         | Authentication                 |   |
| bio          | Biometric                   | cd           | Code                           |   |
| cr           | Created                     | del          | Deleted                        |   |
| demo         | Demographic                 | descr        | Description                    |   |
| dob          | Date of Birth               | dt           | Date                           |   |
| dtime        | Date Time                   | dtimes       | Date Timestamp                 |   |
| expiry       | Expiry                      | fk           | Foreign Key                    |   |
| ibio         | Individual Biometric        | id           | Identifier                     |   |
| ida          | Identity and authentication | idem         | Individual Demographic         |   |
| idsvr        | ID Issuance Server          | idsw         | ID Issuance Software           |   |
| Idx          | Index                       | ins          | Insert                         |   |
| ip           | IP Address                  | lang         | Language                       |   |
| last         | Last                        | lh           | Left Hand                      |   |
| lst          | List                        | mref         | Master Reference               |   |
| msg          | Message                     | mstr         | Master                         |   |
| ntv          | Native                      | nxt          | Next                           |   |
| otp          | One Time Password           | parent       | Parent                         |   |
| pct          | Percentage                  | pk           | Primary Key                    |   |
| pkt          | Packet                      | preid        | Pre ID Issuance                |   |
| prev         | Previous                    | pwd          | Password                       |   |
| rcvd         | Received                    | regn         | Registration                   |   |
| remark       | Remarks                     | rh           | Right Hand                     |   |
| seq          | Sequence                    | status       | Status                         |   |
| tkn          | Token                       | total        | Total                          |   |
| trn          | Transaction                 | ttyp         | Transaction Type               |   |
| typ          | Type                        | uin          | Unique Identification Number   |   |
| upd          | Update                      | usrl         | User Login                     |   |
| vid          | Virtual ID                  | wfl          | Workflow                       |   |
| audit        | Audit                       | dtimesz      | Date Timestamp with Time Zone. |   |
| kernel       | Kernel                      | reg          | Registration                   |   |
| regprc       | Registration Processor      | prereg       | Pre Registration               |   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mosip.io/1.1.5/architecture/data-architecture/data-model-naming-standards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
