> 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/health/design/architecture/low-level-design/services/health-services/complaints-service.md).

# Complaints Service

## Overview

The **Complaints Service** manages complaint and grievance workflows in HCM. It lets citizens raise complaints, track progress, and receive status updates as the complaint moves through the workflow.

#### Core entities

The service uses the following core entities:

* **PGREntity** — Top-level wrapper for the complaint service payload and workflow data.
* **Service** — Complaint details, including the complaint owner.
* **Workflow** — Action, comments, documents, and workflow metadata for each transition.
* **Citizen** — User record for the person filing the complaint or the person represented.
* **Address** — Location details linked to the complaint.
* **Notification** — SMS or event notification sent when the complaint status changes.

## Dependencies

* egov-user
* egov-localization
* egov-idgen
* egov-mdms
* egov-persister
* egov-notification-sms
* egov-notification-mail
* egov-hrms
* egov-workflow-v2
* egov-url-shortening

## Configurable Properties

<table><thead><tr><th width="187.00390625">Environment variable</th><th width="396.70703125">Description</th><th>Value</th></tr></thead><tbody><tr><td><code>pgr.complain.idle.time</code></td><td>Time after which the citizen cannot reopen the complaint.</td><td><code>864000000</code></td></tr><tr><td><code>pgr.default.offset</code></td><td>Default offset for search requests.</td><td><code>0</code></td></tr><tr><td><code>pgr.default.limit</code></td><td>Default limit for search requests.</td><td><code>100</code></td></tr><tr><td><code>pgr.search.max.limit</code></td><td>Maximum records returned by a search request.</td><td><code>200</code></td></tr><tr><td><code>notification.sms.enabled</code></td><td>Enables or disables SMS notifications.</td><td><code>true</code></td></tr><tr><td><code>egov.user.event.notification.enabled</code></td><td>Enables or disables event notifications.</td><td><code>true</code></td></tr></tbody></table>

## API Details

{% embed url="<https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/municipal-services/master/docs/pgr-services.yml>" %}

**Base path:** `/pgr-services/v2/[API endpoint]`

### Endpoints

* **Create complaint** — `POST /_create`\
  Creates a new complaint in the system.
* **Update complaint** — `POST /_update`\
  Updates complaint details and performs workflow actions.
* **Search complaints** — `POST /_search`\
  Searches complaints using supported filter parameters. Default offset and limit apply when omitted.
* **Count complaints** — `POST /_search`\
  Returns the total number of complaints matching the search criteria.

### Event topics

#### Kafka consumers

* None

#### Kafka producers

* `save-pgr-request` — Creates a new complaint.
* `update-pgr-request` — Updates an existing complaint.

{% hint style="info" %}

### Changes in HCM v2.1

HCM v2.1 did not change APIs, business logic, database schema, or Kafka topics.

* Tracer dependency bumped from `2.9.0-SNAPSHOT` to `2.9.1-SNAPSHOT` (`9df5d1c`).
* The OpenTelemetry artefacts shipped by the 2.9.1 tracer line (`opentelemetry-instrumentation-bom-alpha`, `opentelemetry-spring-boot-starter`) are **excluded** from the tracer dependency (`6381637`), so pgr-services opts out of the tracer's OTel auto-instrumentation.
* The per-service `DataAccessExceptionHandler` (HCMPRE-1870 DB-error masking) rolled out to other health services in v2.1 was **not** added to pgr-services in this window.
  {% endhint %}


---

# 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/health/design/architecture/low-level-design/services/health-services/complaints-service.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.
