> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/complaints-management/complaints-resolution-v2.10/deploy/setup/production-setup/deploy-complaints-management/data-validation-layers.md).

# Data Validation Layers

## Validation Layers

### 1. Excel-Level Validation (Client-Side)

Excel templates contain embedded validation rules that prevent incorrect or incomplete data from being entered at the source. Some of the validations are mentioned below.

* Regular expressions (regex)
* Mandatory field checks
* Drop-down values
* Unique value validations

### 2. MDMS Schema-Level Validation (Server-Side)

The following activities are executed at the server side once the Excel file is uploaded through Jupyter Notebook-

* The MDMS service validates the data against the predefined schemas.
* It validates for the following-
  * Mandatory fields
  * Data types
  * Enum validations
  * Pattern (regex) constraints
  * Cross-field and cross-sheet relationships
  * Foreign key references
  * Uniqueness at the schema level
* Invalid rows are rejected, and detailed error messages are returned.

### 3. API-Level Validation (Backend Service Validation)

Once the data passes schema validation, the loader sends it to the appropriate backend services (MDMS, Boundary Service, CRS Master APIs). These services perform the final checks and dependencies at the backend. A few of the validations are as below-

* Duplicate records in the database
* Boundary parent-child hierarchy validation
* Department to designation mapping
* Complaint to the department mapping
* System-level constraints that are defined(Example, invalid tenant ID)

Any failures at this layer are returned in the processed Excel file with appropriate error codes and descriptions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.digit.org/complaints-management/complaints-resolution-v2.10/deploy/setup/production-setup/deploy-complaints-management/data-validation-layers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
