# Detailed Estimates

## Overview

Estimate Service allows users to create estimates and forward them for approval to higher authorities across departments for technical, financial, and admin sanctions. For more technical information on this service, please refer to the [GitHub module README](https://github.com/egovernments/DIGIT-Works/tree/develop/backend/estimate-service) and the [docs](https://github.com/egovernments/DIGIT-Works/tree/develop/backend/estimate-service/docs) folder. The detailed estimate allows users to select a SOR (schedule of rates) item to add to the estimate and enter detailed measurements for the SOR item (if applicable).&#x20;

### Dependencies

* [Project](https://health.digit.org/platform/architecture/low-level-design/services/project)
* [MDMS](https://core.digit.org/platform/core-services/mdms-master-data-management-service)
* [Workflow](https://core.digit.org/platform/core-services/workflow-service)
* [Notification](https://core.digit.org/platform/core-services/sms-notification-service)
* [Localisation](https://core.digit.org/platform/core-services/localization-service)
* [Access Control](https://core.digit.org/platform/core-services/access-control-services)
* [User](https://core.digit.org/platform/core-services/user-services)
* [IDGen](https://core.digit.org/platform/core-services/id-generation-service)

## API Specifications

**Base Path:** /estimates/

### API Contract Link

{% embed url="<https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Works/master/backend/estimates/docs/Estimate-service-1.0.0.yaml>" %}
Estimates API specification
{% endembed %}

## Data Model

### DB Schema Diagram

<figure><img src="/files/OCdyEgTEaGpSQCOEzaYb" alt=""><figcaption></figcaption></figure>

## Estimate Flow Diagram

The diagram below shows the interaction between the estimate service and the persister, indexer. This does not follow the default pattern. Instead, enrichment of the payload for the indexer happens via a separate consumer and then the enriched payload is pushed to a topic. The indexer listens to this topic and sends it to ElasticSearch.&#x20;

<div align="left"><figure><img src="https://github.com/egovernments/DIGIT-Works/blob/master/backend/estimates/docs/diagrams/EstimateFlowDiagram.png?raw=true" alt=""><figcaption></figcaption></figure></div>

## Web Sequence Diagrams

{% tabs %}
{% tab title="Create Estimate" %}

<div data-full-width="true"><figure><img src="/files/PnLnyMZsQo5odt2QhZi9" alt=""><figcaption><p>Create</p></figcaption></figure></div>

<figure><img src="/files/IB4nCxlgEXI7LlPL6XTD" alt=""><figcaption><p>Validations</p></figcaption></figure>
{% endtab %}

{% tab title="Update Estimate" %}

<figure><img src="/files/XwZD3B6AhQuQ44NkJyF5" alt=""><figcaption><p>Detailed Estimate Update</p></figcaption></figure>
{% endtab %}

{% tab title="Search Estimate" %}

{% endtab %}
{% endtabs %}

### Revision Estimates

{% tabs %}
{% tab title="Create Revision Estimate" %}

<figure><img src="/files/kYipmGgcHCphjh5CPcWE" alt=""><figcaption><p>Revision Estimate create flow</p></figcaption></figure>

<figure><img src="/files/H8JL5LUhb7BZdh1n1nnl" alt=""><figcaption><p>Revision Estimate Validations</p></figcaption></figure>
{% endtab %}

{% tab title="Update Revision Estimate" %}

<figure><img src="/files/rCAAe5ORDe1djdsq7iVP" alt=""><figcaption><p>Update Revision Estimate Flow</p></figcaption></figure>

<figure><img src="/files/AV0IQFQccZvCWP23p7S0" alt=""><figcaption><p>Validaiton of Revision Estimate Validation</p></figcaption></figure>
{% endtab %}
{% endtabs %}

### Estimate Inbox

Estimate inbox uses the Inbox V2 service (from DIGIT core) which queries ES to retrieve details for the inbox. For more information on Inbox V2, please refer [here](https://digit-discuss.atlassian.net/wiki/spaces/DD/pages/2289271031/Event+based+inbox).&#x20;

{% hint style="info" %}
An inbox is needed when there are workflows enabled for the service.&#x20;
{% endhint %}

### Estimate PDF

The proposed sequence diagram is below.

![](/files/lAsDRKn9NIHDX7XRqo3E)

## Postman Collections

TBD

## Related Topics

* [Functional specifications - Estimates](/works/specifications/functional-specifications/estimates.md)
* [Estimates module service configuration](/works/setup/configure-works/service-configuration/estimate.md)
* [Estimates module UI configuration](/works/reference-implementations/muktasoft-v2.2/deployment/configuration/ui-configuration/modules/estimate.md) - for MuktaSoft
* [Estimates user stories](/works/reference-implementations/muktasoft-v2.2/specifications/functional-requirements/user-stories/jit-fs-integration.md) - for MuktaSoft
* [Employee user manual on using the Estimates module ](/works/reference-implementations/muktasoft-v2.2/implementation/training-resources/user-manual/web-application-user-manual/estimate.md)- for MuktaSoft


---

# 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/works/platform/architecture/low-level-design/services/detailed-estimates.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.
