Boundary Management Through GeoJson

Overview

Base URL: project-factory/v1/

Endpoint: /data/_generate

Method: POST

Request Structure

Body Parameters:

  • RequestInfo: Object containing RequestInfo

  • Query Parameters:

    • tenantId: Tenant

    • type: Type of Resource (e.g., boundaryManagement)

    • forceUpdate: Boolean type (either true or false)

    • hierarchyType: Name of Boundary Hierarchy

    • campaignId: default (Mandatory)

Response Structure

Success Response:

In this API the filestore ID will be the ID the geoJson file which will be:

Flow

  1. Client Initiates Request:

    • The client initiates a dataGenerate request to the Project Factory Service.

  2. Validation of Request:

    • Schema Validation: Validate against generateRequestSchema.

    • Tenant ID Validation: Ensure tenantId matches in query and RequestInfo.userInfo.

    • Force Update: Default to "false" if missing.

    • Hierarchy Type Validation: Validate hierarchyType for the tenantId.

  3. Processing of Generate Request:

    • Fetch Data from DB:

      • Retrieve data using getResponseFromDb(request).

    • Modify Response Data:

      • Modify the fetched data with getModifiedResponse(responseData).

    • Generate New Entry:

      • Create a new entry with getNewEntryResponse(request).

    • Expire Old Data:

      • Update the status of old data to expired using getOldEntryResponse(modifiedResponse, request).

    • Persist Data Changes:

      • Call updateAndPersistGenerateRequest(newEntryResponse, oldEntryResponse, responseData, request).

        • Purpose:

          • If forceUpdate is true and data exists: Mark existing data as expired and create new data.

          • No data exists or force update is true: Generate new data.

          • If forceUpdate is false and data exists: Return the old data.

  4. Boundary Data Processing:

    • Generate new Boundary Data:

      • Fetch Boundary Relationships.

      • If no boundary is found, generate an empty boundary sheet.

      • Fetch Filters from CampaignId and generate Boundary Data based on those filters.

        • If the filter is null, it will generate the whole Boundary Data.

    • After the Boundary Sheet has been generated, append the ReadMeSheet.

    • Generate different tabs based on any boundary level configured (here District).

  5. Generating Different Boundary Templates based on Campaign Type

  • Fetch configurable columns from mdms present for each campaign type from schema - (HCM-ADMIN-CONSOLE.adminSchema).

  • Here is a sample data from the given schema having configurable columns for the SMC campaign:

  1. Handle Error:

    • Update status to failed, add error details, log the error, and produce a message to the update topic.

  2. Downloading the generated boundary template through /data/_generate API:

    • One can get the filestoreId through the /data/_download API which will fetch from db using the id from the response of /data/_generate API.

After successful generation, the sheet you will get from filestoreId will be:

Boundary Generation Data

Note: The downloaded template will have one ReadMe sheet, one Boundary Data tab, and all other tabs on a number of unique districts (or whichever level is configured).

Last updated

Was this helpful?