# Notebook 1: Tenant & Common Masters

## Overview

Create tenants, branding, departments, designations, and complaint types (with SLA).

File: `1_TenantAndCommonMaster.ipynb`

Creates:

* Tenant (City/State) information
* Branding (logos, banners)
* Departments
* Designations
* Complaint Types with SLA

{% hint style="info" %}
You will typically use **root/state** credentials for **tenant + branding**, and **city** credentials for **common masters**.
{% endhint %}

## Steps

### Step 1: Open the notebook

* Open Jupyter and go to the `Notebooks` folder.
* Open `1_TenantAndCommonMaster.ipynb`.

![](/files/2SReLVy7LbfX6idrMLAR)

### Step 2: Run setup cells

* Run the first few cells to install and import the required modules
* Use `Shift + Enter` to run each cell
* Wait for each cell to complete before running the next

![](/files/DSwxOnkITuQWp5pkxVZs)

### Step 3: Authenticate

Fill the authentication form.

| Field      | Example                         |
| ---------- | ------------------------------- |
| Domain URL | `https://unified-dev.digit.org` |
| Username   | `MDMSADMIN`                     |
| Password   | `********`                      |
| User Type  | `EMPLOYEE`                      |
| Tenant ID  | `pg`                            |

![](/files/5NJeR2lHGSVdD7ZLfne2)

Click **Authenticate**.

Expected output:

```
AUTHENTICATION SUCCESSFUL!
Logged in as: MDMSADMIN
Tenant: pg
```

### Step 4: Upload tenant and branding

#### 4.1 Download the template

* Find the cell that says "Download Tenant Template"
* Run the cell (`Shift + Enter`)
* Downloaded file: `Tenant And Branding Master.xlsx`

![](/files/A660WKi98KCIbELOn9Vr)

#### 4.2 Open the Excel file

Open the downloaded file in Excel.

#### 4.3 Fill Sheet 1: Tenant Info

* Click on the "Tenant Info" tab at the bottom
* Fill the required columns

![](/files/3FXX3xKkakn2OnZv1euC)

<table><thead><tr><th width="207.81640625">Column</th><th>What to enter</th><th>Example</th></tr></thead><tbody><tr><td>Tenant Display Name*</td><td>City/ULB name</td><td><code>City A Municipal Corporation</code></td></tr><tr><td>Tenant Code*</td><td>Unique code (admin provided)</td><td><code>PG.CITYA</code></td></tr><tr><td>Tenant Type*</td><td><code>City</code> or <code>State</code></td><td><code>City</code></td></tr><tr><td>Logo File Path*</td><td>Public URL to logo image</td><td><code>https://example.com/logo.png</code></td></tr><tr><td>City Name</td><td>City name</td><td><code>City A</code></td></tr><tr><td>District Name</td><td>District name</td><td><code>District X</code></td></tr></tbody></table>

Rules:

* Do not leave mandatory fields empty (marked with \*)
* Tenant Code must be unique (usually provided by the admin)
* Logo URL must be a working, publicly accessible link

#### 4.4 Fill Sheet 2: Branding Details

* Click on the "Branding Details" tab
* Fill the required columns

![](/files/I38OM7xXsh2GMnmICY0K)

| Column             | What to enter          | Example                              |
| ------------------ | ---------------------- | ------------------------------------ |
| Logo URL\*         | Main logo link         | `https://example.com/logo.png`       |
| Logo URL (White)\* | White logo link        | `https://example.com/logo-white.png` |
| Banner URL         | Banner image link      | `https://example.com/banner.png`     |
| State Logo         | Root/state tenant logo | `https://example.com/state-logo.png` |

#### 4.5 Save the file

Save in Excel (`Ctrl + S` / `Cmd + S`).

#### 4.6 Upload the file

* Find the upload cell in the notebook
* Enter the **state tenant ID** (example: `pg`)
* Select your `Tenant And Branding Master.xlsx`
* Click **Save Config & Upload Tenant Master**

![](/files/SGUjG0XYG5BhXLtyZPYH)

Run the loading cells (Cells 103, 104, and 105).

Expected output:

```
[SUMMARY] Created: 2 tenants
[SUCCESS] Tenants uploaded successfully!
[SUCCESS] State Branding uploaded successfully!
1 COMPLETED!
```

![](/files/3Rpw3fL27vvN4XSGPSyW)

### Step 5: Upload departments, designations, and complaint types

#### 5.1 What this phase creates

| Master          | Examples                                |
| --------------- | --------------------------------------- |
| Departments     | Water, Sanitation, Electricity          |
| Designations    | Engineer, Manager, Supervisor           |
| Complaint Types | Water not coming, Garbage not collected |

#### 5.2 Download the template

* Find the Common Master section in the notebook
* Run the download cell
* Download and open `Common and Complaint Master.xlsx`

#### 5.3 Fill Sheet 1: Departments & Designations

* Click on the "Department & Designation" tab

![](/files/rq8DyljOlBQvr4MXkKYZ)

Example:

| Department Name  | Designation Name |
| ---------------- | ---------------- |
| WATER DEPARTMENT | engineer         |
| WATER DEPARTMENT | manager          |
| WATER DEPARTMENT | supervisor       |
| SANITATION       | engineer         |
| SANITATION       | supervisor       |
| ELECTRICITY      | technician       |

Rules:

* You can add multiple designations for one department
* Department names must match exactly across sheets
* Do not leave empty rows between entries

#### 5.4 Fill Sheet 2: Complaint Types

* Click on the "Complaint Type" tab
* Fill in these columns:

![](/files/qE1OQfDrnubhtpMRsRiP)

Example:

| Complaint Type | Complaint Sub Type | Department Name  | Resolution Time (Hours)\* | Search Words             |
| -------------- | ------------------ | ---------------- | ------------------------- | ------------------------ |
| Water Issues   | Tap broken         | WATER DEPARTMENT | 24                        | water,tap,broken         |
| Water Issues   | No water supply    | WATER DEPARTMENT | 12                        | water,supply,no water    |
| Garbage        | Not collected      | SANITATION       | 8                         | garbage,waste,collection |
| Street Light   | Not working        | ELECTRICITY      | 48                        | light,street,bulb        |

Rules:

* Department Name must match Sheet 1 exactly
* Resolution Time is in hours (numeric value)
* Search Words help citizens find complaints (use commas to separate)

#### 5.5 Save the file

Save in Excel (`Ctrl + S` / `Cmd + S`).

#### 5.6 Upload and process

* Enter the **target city tenant ID** (example: `pg.citya`)
* Select `Common and Complaint Master.xlsx`

![](/files/8493G4YUPHtPiVBK69I3)

* Run the processing cells

![](/files/PGR0fals566ALZboEtDg)

#### 5.7 Check results

Expected output:

```
Departments Created: 3
Designations Created: 6
Complaint Types Created: 4
```

![](/files/2ZMMbSgbZULyHfolAZu4)

### Step 6: Handle errors (if any)

If some master failed:

![](/files/b4VZA66NPVtA49W6vKZO)

* Download the processed file.
* Open it and filter to `FAILED` rows.
* Read the error message.

| \_STATUS | \_ERROR\_MESSAGE |
| -------- | ---------------- |
| FAILED   | INVALID SLA      |

![](/files/cAQIRCGnNaeZNWAvaMr8)

* Fix the data in the failed rows.
* Delete the status columns:
  * \_STATUS
  * \_STATUS\_CODE
  * \_ERROR\_MESSAGE
* Save and re-upload.

The system will skip already-successful rows.


---

# 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.digit.org/complaints-management/complaints-resolution-v2.10/deploy/setup/production-setup/deploy-complaints-management/alternative-approach/notebook-1-tenant-and-common-masters.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.
