Boundary Management
Generate API for Boundary with Latitude and Longitude
Generation API for Boundary
API 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:
Flow
Client Initiates Request:
The client initiates a dataGenerate request to the Project Factory Service.
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.
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.
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 Filters 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).
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 Campaign SMC-
Handle Error:
Update status to failed, add error details, log the error, and produce a message to the update topic.
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 like.
Note:
Downloaded Template will have one ReadMe sheet, one Boundary Data Tab, and all other tabs on a number of unique districts(or whichever level configured).
Last updated