> 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/low-level-design/services/console-services/project-factory-campaign-manager.md).

# Project Factory - Campaign Manager

## Overview

This service is used to create a Project (Campaign), create required resource data, and create a mapping relation between them based on the boundary data.

Project Factory Flow

<figure><img src="https://docs.digit.org/~gitbook/image?url=https%3A%2F%2Fcontent.gitbook.com%2Fcontent%2FTXGfwWeUzCL8CsU9R0tT%2Fblobs%2FeypOjSDXyVWvcapwLdRO%2FScreenshot%25202024-03-02%2520at%25209.25.14%2520AM.png&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=4251d3eb&#x26;sv=2" alt=""><figcaption></figcaption></figure>

## **Dependencies**

1. Project
2. Facility
3. Product
4. HRMS
5. MDMS
6. Boundary
7. Localisation
8. Access Control
9. IdGen
10. Individual
11. User

## API Specification <a href="#api-specification" id="api-specification"></a>

Base Path: /project-factory/

API Contract [Link](https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Specs/hcm-workbench/Domain+Services/Health/project-factory.yaml)

{% embed url="<https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/health-campaign-services/refs/heads/console/health-services/project-factory/swagger.yml>" %}

## Data Model <a href="#data-model" id="data-model"></a>

#### DB Schema Diagram <a href="#db-schema-diagram" id="db-schema-diagram"></a>

Project Factory related tables

Table Details

<figure><img src="https://3976166735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmb5VUHEnO0msarLMPz6q%2Fuploads%2FYDTQMFZ7nZxZCGS0u4ia%2Fdb-diagram.png?alt=media&amp;token=e2e34020-0b56-43ed-99dc-edf01aabc8a7" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Campaign" %}

```dbml
Table eg_cm_campaign_details {
  id varchar(128) [primary key ,not null, unique]
  tenantid varchar(64) [not null ,note: 'Tenant identifier']
  campaignname varchar(250) [not null ,note: 'Name of the campaign']
  projecttype varchar(128) [not null ,note: 'Type of project']
  startdate bigint [note: 'Start date in epoch']
  enddate bigint [note: 'End date in epoch']
  campaigndetails jsonb [note: 'Campaign specific details']
  status varchar(128) [not null ,note: 'Status of the campaign']
  parentid varchar(128) [note: 'refering to the previous campaign id']
  action varchar(64) [not null ,note: 'Action type']
  campaignnumber varchar(128) [not null ,note: 'Campaign number']
  hierarchytype varchar(128) [not null ,note: 'Hierarchy type']
  boundarycode varchar(64) [note: 'Boundary code']
  projectid varchar(128) [note: 'Project identifier']
  createdby varchar(128) [not null ,note: 'Created by user ID']
  lastmodifiedby varchar(128) [note: 'Last modified by user ID']
  createdtime bigint [note: 'Creation timestamp']
  lastmodifiedtime bigint [note: 'Last modification timestamp']
  additionaldetails jsonb [note: 'Additional details']
}
```

{% endtab %}

{% tab title="Process" %}

```dbml
Table eg_cm_campaign_process {
  id varchar(128) [primary key, not null, unique]
  campaignid varchar(128) [not null,note: 'Foreign key to eg_cm_campaign_details.id']
  type varchar(128) [not null,note: 'Type of campaign process']
  status varchar(128) [not null,note: 'Status of the campaign process']
  details jsonb [note: 'Detailed information of the process']
  createdtime bigint [note: 'Creation timestamp']
  lastmodifiedtime bigint [note: 'Last modification timestamp']
  additionaldetails jsonb [note: 'Additional details']
}
Ref: eg_cm_campaign_process.campaignid > eg_cm_campaign_details.id // many-to-one
```

{% endtab %}

{% tab title="Generated Resource" %}

```dbml
Table eg_cm_generated_resource_details {
  id varchar(128) [primary key,not null, unique]
  filestoreid varchar(128) [note: 'File store ID']
  status varchar(128) [not null,note: 'Status of the resource']
  type varchar(128) [not null,note: 'Type of resource']
  tenantid varchar(128) [not null,note: 'Tenant identifier']
  count bigint [note: 'Count of resources']
  createdby varchar(128) [note: 'Created by user ID']
  createdtime bigint [note: 'Creation timestamp']
  lastmodifiedby varchar(128) [note: 'Last modified by user ID']
  lastmodifiedtime bigint [note: 'Last modification timestamp']
  additionaldetails jsonb [note: 'Additional details']
  hierarchytype varchar(128) [not null,note: 'Hierarchy type']
  campaignid varchar(128) [note: 'Foreign key to eg_cm_campaign_details.id']
}
Ref: eg_cm_generated_resource_details.campaignid > eg_cm_campaign_details.id // many-to-one

```

{% endtab %}

{% tab title="Resource Activity" %}

```dbml
Table eg_cm_resource_activity {
  id varchar(128) [primary key,not null, unique]
  retrycount int [note: 'Number of retry attempts']
  type varchar(64) [not null,note: 'Type of activity']
  url varchar(128) [not null,note: 'URL for the activity']
  requestpayload jsonb [note: 'Request payload']
  tenantid varchar(128) [not null,note: 'Tenant identifier']
  responsepayload jsonb [note: 'Response payload']
  status bigint [note: 'Status code']
  createdby varchar(128) [note: 'Created by user ID']
  createdtime bigint [note: 'Creation timestamp']
  lastmodifiedby varchar(128) [note: 'Last modified by user ID']
  lastmodifiedtime bigint [note: 'Last modification timestamp']
  additionaldetails jsonb [note: 'Additional details']
  resourcedetailsid varchar(128) [not null,note: 'Foreign key to eg_cm_resource_details.id']
}
Ref: eg_cm_resource_activity.resourcedetailsid > eg_cm_resource_details.id // many-to-one

```

{% endtab %}

{% tab title="Resource Details" %}

```dbml


Table eg_cm_resource_details {
  id varchar(128) [primary key,not null, unique]
  status varchar(128) [note: 'Status of the resource']
  tenantid varchar(128) [not null,note: 'Tenant identifier']
  filestoreid varchar(128) [note: 'File store ID']
  processedfilestoreid varchar(128) [note: 'Processed file store ID']
  action varchar(128) [not null,note: 'Action type']
  type varchar(64) [not null,note: 'Type of resource']
  createdby varchar(128) [note: 'Created by user ID']
  createdtime bigint [note: 'Creation timestamp']
  lastmodifiedby varchar(128) [note: 'Last modified by user ID']
  lastmodifiedtime bigint [note: 'Last modification timestamp']
  additionaldetails jsonb [note: 'Additional details']
  campaignid varchar(128) [note: 'Foreign key to eg_cm_campaign_details.id']
}

Ref: eg_cm_resource_details.campaignid > eg_cm_campaign_details.id // many-to-one


```

{% endtab %}
{% endtabs %}

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Create Campaign</strong></mark></td><td><a href="/health/v2.0/design/architecture/low-level-design/services/console-services/project-factory-campaign-manager/create-campaign.md">Create Campaign</a></td></tr><tr><td><mark style="color:blue;"><strong>Update Campaign</strong></mark></td><td><a href="/health/v2.0/design/architecture/low-level-design/services/console-services/project-factory-campaign-manager/update-campaign.md">Update Campaign</a></td></tr><tr><td><mark style="color:blue;"><strong>Manage Resources</strong></mark></td><td><a href="/health/v2.0/design/architecture/low-level-design/services/console-services/project-factory-campaign-manager/manage-resources.md">Manage Resources</a></td></tr></tbody></table>

## Web Sequence Diagrams <a href="#web-sequence-diagrams" id="web-sequence-diagrams"></a>

{% tabs %}
{% tab title="Data Create API" %}

<figure><img src="https://content.gitbook.com/content/mb5VUHEnO0msarLMPz6q/blobs/CtvOqRKElugaOH5vjWhc/image.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Generate Data API" %}

<figure><img src="https://content.gitbook.com/content/mb5VUHEnO0msarLMPz6q/blobs/eLoUnskAVFwkq2Yt8h1j/image.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Process Create Campaign API" %}

<figure><img src="https://content.gitbook.com/content/mb5VUHEnO0msarLMPz6q/blobs/kuP9XNnoE48qJXac18uU/image.png" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# 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/low-level-design/services/console-services/project-factory-campaign-manager.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.
