> 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/v2.0/design/architecture/high-level-design/microplanning-architecture.md).

# Microplanning Architecture

## Overview

The Microplanning module enables the creation, validation, approval, and finalisation of microplans for health campaigns across multiple administrative boundaries. It supports population planning, facility mapping, resource estimation, and hierarchical approvals at sub-national and national levels. The system is designed to be scalable, secure, and configurable to support diverse campaign types and country contexts.

## Goals

* Support **end-to-end microplanning workflows** from setup to final approval
* Enable **role-based access and boundary-based governance**
* Ensure **data integrity and auditability** through validations and approval flows
* Integrate seamlessly with **registry systems** and the **Admin Console**
* Scale across **multiple countries, campaigns, and users**

## Service Architecture

The Microplanning module follows a **modular, service-oriented architecture**, aligned with DIGIT platform principles. Each service encapsulates a clear business responsibility and communicates via APIs and asynchronous events where required.

<figure><img src="https://3976166735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmb5VUHEnO0msarLMPz6q%2Fuploads%2FQinKly137CKHcUgYWtwl%2Fimage.png?alt=media&amp;token=50b5cfef-2f73-44cd-9915-641ced89eafa" alt=""><figcaption><p><em>Microplanning Service Architecture</em></p></figcaption></figure>

### Key Architectural Characteristics

* Stateless services
* Centralised registry consumption (Boundary, Facility, Vehicle)
* Event-driven processing for data ingestion
* Strong validation and approval layers
* Read-optimised views for dashboards and maps

## Services Overview  <a href="#overview-of-services" id="overview-of-services"></a>

#### 1. Plan Management Service

**Purpose:**\
Manages the lifecycle of microplans.

**Responsibilities:**

* Microplan creation and configuration
* Campaign boundary selection
* Assignment of users and roles
* Facility-to-catchment mapping
* Microplan assumptions and estimation formulas
* Validation, approval, and finalisation of microplans
* Exposure of finalised microplan data for Admin Console integration

#### 2. Census Management Service

**Purpose:**\
Manages population data used for microplanning.

**Responsibilities:**

* Storage and management of village-level population data
* Support for centrally uploaded and field-validated data
* Population data validation rules
* Approval and rejection workflows
* Maintenance of audit trails (comments, status history)

#### 3. Resource Generator Service

**Purpose:**\
Processes uploaded data files and generates system-ready records.

**Responsibilities:**

* Parse population and facility Excel/Geo files
* Validate file structure and data integrity
* Generate population entities and facility-boundary mappings
* Trigger downstream processing for estimation readiness

#### 4. Project Factory Service

**Purpose:**\
Provides template and configuration utilities.

**Responsibilities:**

* Generate population upload templates
* Generate facility upload templates
* Enforce campaign-specific configuration rules
* Ensure standardised data collection formats

## Service Interactions <a href="#service-interactions" id="service-interactions"></a>

* **Census Management**
  * Stores population data
  * Manages validation and approval workflows

<figure><img src="https://3976166735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmb5VUHEnO0msarLMPz6q%2Fuploads%2FBgYB7f3hk64o9IFIUgOb%2Fimage.png?alt=media&amp;token=c7a5bc34-38b2-4573-9911-4e832d5d5895" alt=""><figcaption><p><em>Census Management Service Interactions</em></p></figcaption></figure>

* **Plan Management**
  * Consumes approved population and facility mappings
  * Performs microplan estimation
  * Manages approval and finalisation workflows

<figure><img src="https://3976166735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmb5VUHEnO0msarLMPz6q%2Fuploads%2FILLjd5zGSKRGR2gRDKHg%2Fimage.png?alt=media&amp;token=fee14f5a-6df9-402c-8699-43cc80b89126" alt=""><figcaption><p><em>Plan Management Service Interactions</em></p></figcaption></figure>


---

# 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/v2.0/design/architecture/high-level-design/microplanning-architecture.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.
