Target Upload API
Base URL: project-factory/v1/
Endpoint: /data/_create
Method: POST
Request Structure:
Body Parameters:
RequestInfo: Object Containing RequestInfo
ResourceDetails: Details of a given Resource
type: Type of resource to create (e.g., boundarywithTarget)
tenantId: Tenant
fileStoreId: FileStoreId of Target Upload Sheet
action: Action to perform (e.g., validate for target upload)
hierarchyType: Name of Boundary Hierarchy
campaignId: CampaignId
additionalDetails: Additional details (optional)
Response Structure:
Success Response:
ResponseInfo: Object Containing ResponseInfo
ResourceDetails: Details of the created resource
Flow:
Client Initiates Request:
The client sends a POST request to /data/_create endpoint with action: validate.
Validation of Request:
Resource Details Validation:
Check if request.body.ResourceDetails exists and is not empty.
Throw a validation error if missing or empty with the message "ResourceDetails is missing or empty or null".
Schema Validation:
Validate request.body.ResourceDetails against createRequestSchema.
Hierarchy Type Validation:
Validate hierarchyType in request.body.ResourceDetails using validateHierarchyType function.
Tenant ID Validation:
Ensure that request.body.ResourceDetails.tenantId matches request.body.RequestInfo.userInfo.tenantId.
Throw a validation error if they do not match with the message "tenantId is not matching with userInfo".
Different Tab Headers Validation:
Validate whether headers are according to the template across all tabs of different districts.
Target Sheet Validation:
All validations will be on Sheets other than the ReadMe Sheet and Boundary Data Sheet.
Immediate validations:
District Tabs Validation:
Validate whether all district tabs are present in the Target Sheet uploaded.
Empty Sheet Validation:
Throw a validation error if any Target Sheet is empty.
Root (District) level boundary validation:
Throw a validation error if the root column (District) is empty in any row.
Validations for each row:
Boundary Codes Validation:
Check for missing or empty boundary codes in any row of any sheet.
Check for boundary code columns to be of type string.
Check for the presence of more than one boundary code in a given row of a given Target Sheet.
Check for duplicacy of the boundary code within the given Target Sheet.
Boundary Targets Validation:
Ensure that Target values are not missing and are positive numbers less than 1 Million.
The documentation details APIs for creating, searching, generating, and downloading data, including request/response structures, flows, and error handling.
Endpoint: /data/_create
Method: POST
Body Parameters:
RequestInfo: Object containing request information.
Resource Details: Object containing the details of the resource to be created or validated.
type: Type of resource (boundary, facility, user, boundaryWithTarget).
tenantId: Tenant identifier.
fileStoreId: File store identifier.
action: Action type (create or validate).
hierarchyType: Type of hierarchy.
campaignId: Campaign identifier.
additionalDetails: Additional details object (optional).
Success Response:
- ResponseInfo: Object containing response information.
- ResourceDetails: Array containing the detail objects of the created or validated resource.
Client Initiates Request: The client sends a createData request to the Project Factory service.
Validation of Request: The Project Factory service validates the request schema and the provided resource details.
Processing the Request:
If action is 'create':
Enrich resource details, set status to "data-accepted", and persist in the database.
Further creation process happens in the background.
After successful creation, set the status to 'completed' and persist resource details in the database.
If action is 'validate':
Enrich resource details, set the status to "validation-started", and persist in the database.
Further creation process happens in the background.
If file data is invalid, set the status to 'invalid' and persist in the database.
After successful creation, set the status to 'completed' and persist resource details in the database.
Fail case: If validation or creation fails, set the status to 'failed' and persist in the database with the error cause in additional details.
Response: The Project Factory service sends the response back to the client containing the resource details and status.
The getSheetData function retrieves and processes data from an Excel sheet, validating the structure according to the configuration provided in createAndSearchConfig. The key part of this process is the parseArrayConfig.parseLogic configuration, which specifies how to parse and validate the columns in the sheet. Here's a detailed explanation of how the function works, including the parsing logic:
The parseArrayConfig.parseLogic configuration specifies how each column in the sheet should be processed. Here's how the parsing logic works:
Each column configuration specifies:
sheetColumn
: The column letter in the sheet.
sheetColumnName
: The expected name of the column in the sheet.
resultantPath
: The path where the value will be stored in the resultant JSON.
type
: The expected type of the value (e.g., string, number, boolean).
conversionCondition
: Optional conditions for converting values.
During the validation step, the function checks that the first-row value matches the expected column name.
When mapping the rows to JSON, the function uses the resultantPath
to place the values in the correct location in the JSON object. It converts values according to the specified type
and conversionCondition
.
For a column configuration with type: "boolean"
and conversionCondition
, the function would convert "Permanent" to true and "Temporary" to an empty string.
In summary, the getSheetData function retrieves and processes data from an Excel sheet, validating the structure and content according to the createAndSearchConfig configuration. The parseArrayConfig.parseLogic configuration specifies how each column should be validated and processed into the resultant JSON format.
Endpoint: /data/_search
Method: POST
RequestInfo: Object containing request information.
SearchCriteria: Object containing search criteria.
id: (Optional) ID of the resource.
tenantId: Tenant identifier.
type: (Optional) Type of the resource (boundary, facility, user, boundaryWithTarget).
status: (Optional) Status of the resource.
ResponseInfo: Object containing response information.
ResourceDetails: Array containing the details object of the searched resource.
Client Request: The client sends a POST request to /data/_search.
Request Content: Includes RequestInfo and SearchCriteria.
Validation: The server validates request structure and content.
Response Creation: The server creates a response with info and resource details.
Response Dispatch: Sends response back to client.
Error Handling: If errors occur, generate an error response and send it.
Endpoint: /data/_generate
Method: POST
RequestInfo: Object containing request information.
Query Parameters:
type: Type of the resource for which data needs to be generated.
tenantId: Tenant identifier.
hierarchyType: Type of hierarchy.
forceUpdate: (Optional) Boolean indicating whether to force update existing data.
ResponseInfo: Object containing response information.
GeneratedResource: Array containing the details object of the generated resource.
Client Request: The client sends a POST request to /v1/data/_generate.
Request Validation: Aftern receiving the request, the server validates the request structure and parameters.
Generate Data Process:
Validation: The server validates the generated request.
Data Processing:
Fetch Data: Fetches existing data from the database.
Modify Data: Modify the retrieved data as necessary.
Generate New ID: Generates a new random ID and sets the file store ID to null.
Expire Old Data: Marks existing data status as expired.
Generate New Data: Generates new data based on the request parameters.
Update and Persist: Updates and persists the generated request along with the new data.
Force Update Logic:
If the forceUpdate parameter is set to true:
Search and Update: Searches for existing data of the specified type and updates the existing data information.
If the forceUpdate parameter is not provided or set to false:
Fetch Existing Data: Retrieves already persisted data from the database of the specified type.
Response Creation: After processing the request, the server creates a response containing the details of the generated resource.
Response Dispatch: The server sends the generated response back to the client.
Error Handling: If errors occur, generate an error response and send it.
Fetch Required Columns from MDMS:
Use callMdmsData
to get type schema columns in the correct order.
Define Headers:
MDMS schema required columns are headers and ensures column orders.
Localise Headers:
Use getLocalizedHeaders
with localizationMap
.
Localise Sheet Name:
Use getLocalizedName
with localizationMap
and generate a sheet.
To add a new column to the Generated sheet, follow these steps:
Search Schema Details
Locate the type schema from the HCM-ADMIN-CONSOLE.adminSchema
schema in the workbench.
Identify Column Type
Determine the column type based on the properties defined in the schema:
stringProperties
for string-based columns.
numberProperties
for numeric-based columns.
enumProperties
for enumerated columns.
Define New Column
Add the new column to the schema under the appropriate properties section:
String Column: Include attributes such as name
, type
, maxLength
, minLength
, isUnique
, isRequired
, description
, and orderNumber
.
Number Column: Include attributes such as name
, type
, maximum
, minimum
, isRequired
, description
, orderNumber
, and errorMessage
.
Enum Column: Include attributes such as name
, enum
, isRequired
, description
, and orderNumber
.
Ensure Column Uniqueness
Ensure that the isUnique
property is correctly set for string columns to enforce uniqueness.
Column Visibility (Future Implementation)
Note that hideColumn
and freezeColumn
features will be implemented in the next version.
This process is sufficient for validating the new column in the generated sheet.
If there's a need to reflect the column in APIs, follow these additional steps:
Update createAndSearch.ts
File
Modify the createAndSearch.ts
file under the defined type parseLogic
object.
Integrate the new column into the appropriate data structures used for API operations.
Example :
sheetColumn: A
sheetColumnName: HCM_ADMIN_CONSOLE_FACILITY_CODE
resultantPath: id
type: string
Mapping: Data from column A (HCM_ADMIN_CONSOLE_FACILITY_CODE) in the sheet will be mapped to id
in the API data.
By following these steps, you can successfully add and validate a new column in the generated sheet and ensure its reflection in the associated APIs.
General Rules
Locked Headers: The headers in the templates for each data type (user, facility, target) are locked and cannot be changed.
Sheet Protection: Certain sheets within the templates will have specific locked areas to ensure data integrity.
README Sheet: Each type of template includes a README sheet which is read-only and locked.
Target Template
Editable Columns: You can only modify the 'Target' column. All other columns are locked and cannot be edited.
Facility Template
Adding Rows: You are allowed to add new rows to create new facilities.
Editable Columns: You can modify the "Boundary Code" and 'Usage' columns.
Locked Sheets: The boundary data sheet within the facility template is locked and cannot be modified.
Dropdown Columns: The following columns are dropdowns:
Facility Type
Facility Status
Facility Usage
Facility Usage: Facility usage can be 'Active' or 'Inactive'. Active facilities are used in the campaign and require a boundary code to map.
User Template
Adding Rows: You are allowed to add new rows.
Locked Sheets: The boundary data sheet within the user template is locked and cannot be modified.
Dropdown Columns: The following columns are dropdowns:
Role
Employment Type
Data for Dropdowns
The data for the dropdown columns comes from the mdms
(Master Data Management System) under the adminSchema
master.
Endpoint: /data/_download
Method: POST
RequestInfo: Object containing request information.
Type: (Optional) Type of the resource being downloaded.
TenantId: Tenant identifier.
HierarchyType: Type of hierarchy.
Id: (Optional) ID of the resource being downloaded.
Filters: (Optional) Additional filters for the download request.
ResponseInfo: Object containing response information.
ResourceDetails: Array containing the details object of the downloaded resource.
Client Request: The client sends a POST request to download data.
Request Validation: Upon receiving the request, the server validates the request structure and parameters.
Data Download Process:
Validation: Validate the download request.
Fetch Data: Fetch existing data of the specified type from the data host service.
Processing: Process the retrieved data as necessary.
Response Creation: After processing the request, the server creates a response containing the details of the latest resource, ensuring that only one result is fetched.
Response Dispatch: The server sends the generated response back to the client.
Error Handling: If errors occur during the process, an error response is generated and sent.
Project-factory assists users in generating the seed data essential for the campaign creation process in DIGIT HCM and in establishing relationships between all resources. The Project Factory Service manages project-type campaigns by handling the creation, updating, searching, and campaign setup processes. This documentation details the available APIs, their endpoints, request and response structures, and internal processing flows.
Knowledge of JavaScript (preferably ES6).
Knowledge of Git or any version control system.
Knowledge of RESTful web services.
Knowledge of the Kafka and Postgres.
Knowledge of eGov-mdms service, eGov-persister, eGov-idgen, eGov-indexer, and eGov-user will be helpful.
project-factory/v1/
TO DO add other information
Swagger :
Configure the role CAMPAIGN_MANAGER for project-factory in the ‘ACCESSCONTROL-ROLES’ module.
Configure the action id(s) with the corresponding role code ‘ACCESSCONTROL-ROLEACTIONS’ module.
For Project Factory Service Role-Action mappings are as follows in the Dev environment.
Additional APIs being used are:
Configure all the MDMS data for project factory service as done in the QA environment.
Data to configure :
Attribute Config
Boundary Schema
Delivery Config
Facility Schema
Gender Config
Mail Config
Operator Config
Product Type
User Schema
Refer to the following:
https://github.com/egovernments/egov-mdms-data/tree/UNIFIED-QA/data/mz/health/hcm-admin-console
Make sure the id format is configured in the ‘IdFormat.json’ file of the ‘common-masters’ module.
Below is what is currently configured in the QA environment.
Environment variables Below are the variables that should be configured well before deployment of the project factory service build image.
Add these ‘db-host’,’db-name’,’db-url’,’domain’ and all the digit core platform services configurations (Idgen ,persister, filestore, etc.) in respective environments yaml file.
Add project factory service related environment variables’ value like the way it's done in the QA environment yaml file. (Search for project-factory)
Heath-hrms, health-project, health-individual and facility should have specified heap and memory limits as mentioned below
Make sure to add the DB(Postgres and flyway) username & password in the respective environment secret yaml file the way it's done here.
Make sure to add the digit core services related secrets are configured in the respective environment secret file the way it's done here.
Click here for localisation details.
Click here to get the Postman Collection
The documentation details the API endpoints for creating, updating, and searching project type campaigns. It includes request and response structures, validation steps, and flow diagrams.
POST /project-type/create
RequestInfo: Object containing RequestInfo.
CampaignDetails: Object containing the details of the campaign to be created.
tenantId: Tenant identifier.
hierarchyType: Type of hierarchy.
action: Action type (create
or draft
).
boundaries: Array of boundaries.
resources: Array of resources.
projectType: Type of the project.
deliveryRules: Array of delivery rules.
Additional request info
ResponseInfo: Object containing ResponseInfo.
CampaignDetails: The created campaign details.
The client initiates a createCampaign request to the Project Factory Service.
If the action is 'create':
The Project Factory Service validates the request schema.
It also validates the uniqueness of the campaign name in the database.
If the campaign name exists, an error is thrown.
If the action is 'draft':
The Project Factory Service validates the request schema.
It also validates the uniqueness of the campaign name in the database.
If the campaign name exists, an error is thrown.
For both 'create' and 'draft' actions:
The Project Factory Service validates the request for hierarchy type and boundaries with the Boundary Service.
If the action is 'create':
The Project Factory Service validates the request for data resources.
It enriches the CampaignDetails and sets the status to 'creating'.
The CampaignDetails are persisted in the database.
For each resource data, the Project Factory Service creates resources through the /project-factory/v1/data/_create
API.
It enriches boundaries for project creation and creates projects for each boundary with the Health Project Service.
The enriched CampaignDetails are persisted in the database.
The CampaignDetails object is sent to a Kafka topic for project mappings.
If the campaign status is not "created", project mappings are performed through the /project-factory/v1/project-type/createCampaign
API and the status is updated to 'created'.
If the campaign status is already 'created', an error is thrown, and the status is updated to 'failed'.
If the action is 'draft':
The CampaignDetails are enriched, and the status is set to 'drafted;.
The enriched CampaignDetails are persisted in the database.
The Project Factory Service sends the response back to the client.
POST /project-type/update
RequestInfo: Object containing RequestInfo.
CampaignDetails: Object containing the details of the campaign to be updated.
id: Unique identifier of the campaign.
tenantId: Tenant identifier.
hierarchyType: Type of hierarchy.
action: Action type (create
or draft
).
boundaries: Array of boundaries.
resources: Array of resources.
projectType: Type of the project.
deliveryRules: Array of delivery rules.
ResponseInfo: Object containing ResponseInfo.
CampaignDetails: The updated campaign details.
The ProjectFactoryService receives an updateCampaign request from the Client.
The received request schema is validated to ensure it matches the expected format.
The system checks if the campaign specified in the request exists in the database.
If boundaries are different from campaign in db, call:
Facility template generate
User template generate
Target template generate
If delivery conditions are different, call:
Target template generate
If the campaign exists, the system checks its status in the database.
If the campaign status is 'drafted':
Validate Boundaries: Validate the request for hierarchyType and boundaries.
Enrich Campaign Details: Enrich the campaign details and set the status to 'updating'.
Update Campaign Details: Update the campaign details in the database.
Update Resource Data: Update each resource data associated with the campaign through the /project-factory/v1/data/_update
API.
Enrich Boundaries: Enrich the boundaries for the project update.
Update Projects: Update projects associated with each boundary.
Persist Changes: Persist the updated campaign details in the database.
Send to Kafka Topic: Send the updated CampaignDetails object to the Kafka topic for project mappings.
Listen to Kafka: Listen for updates from the Kafka topic to get the updated CampaignDetails object for project mappings.
If the campaign status is not 'created':
Do project mapping through /project-factory/v1/project-type/createCampaign
API.
Enrich the CampaignDetails and set the status to 'created'.
Update the CampaignDetail in the database.
If the campaign status is 'created':
Throw an error indicating that the project is already mapped for this campaign.
Enrich the CampaignDetails and set the status to 'failed'.
Update the CampaignDetail in the database.
If the campaign status is not 'drafted', the system throws an error indicating that only drafted campaigns can be updated.
The ProjectFactoryService sends a response to the Client based on the outcome of the update operation.
POST /project-type/search
RequestInfo: Object containing RequestInfo.
CampaignDetails: Object containing the search criteria for campaigns.
tenantId: Tenant identifier.
ids: Array of campaign IDs to search for.
startDate: The start date for the search.
endDate: End date for the search.
projectType: Type of the project.
campaignName: Name of the campaign.
status: Status of the campaign.
createdBy: Creator of the campaign.
campaignNumber: Number of the campaign.
campaignsIncludeDates: Flag to include campaigns based on dates.
pagination: Object containing pagination settings.
limit: Maximum number of results to return.
offset: Offset for paginated results.
sortOrder: Sort order for results (asc/desc).
sortBy: Field to sort results by.
ResponseInfo: Object containing ResponseInfo details.
CampaignDetails: Array containing details of matching campaigns.
totalCount: Total number of matching campaigns.
The client sends a searchCampaign request to the Project Factory Service.
The Project Factory Service validates the request schema and search criteria.
The Project Factory Service constructs a search query based on the provided criteria.
It checks if there are specific search fields like start date, end date, campaign name, etc.
Depending on the campaignsIncludeDates
flag, the service adjusts the search conditions accordingly.
If campaignsIncludeDates
is true:
It shows only those campaigns whose start date is on or before the provided start date and whose end date is on or after the provided end date.
If campaignsIncludeDates
is false:
It shows only those campaigns whose start date is on or after the provided start date and whose end date is on or before the provided end date.
The service executes the constructed query to retrieve matching campaign details from the database.
The Project Factory Service sends the response back to the client.
The response contains the matching campaign details along with the total count, if applicable.
POST /project-type/getProcessTrack
campaignId: Unique ID of the campaign.
Success Response:
ResponseInfo: Object containing ResponseInfo details.
processTrack: Array containing process tracks of the matching campaign.
Client Initiates Request
The client sends a request to retrieve process tracks for a specific campaign by providing the campaignId
.
Validation of Request
The Project Factory Service validates the provided campaignId
to ensure it meets the expected format and constraints.
Fetch Process Tracks
The Project Factory Service constructs a query to fetch process tracks associated with the provided campaignId
.
The service executes the query against the database to retrieve the process tracks.
Response
The Project Factory Service formats the retrieved process tracks and packages them into the response.
The response includes the ResponseInfo
and an array of processTrack
details.
Send Response to Client
The Project Factory Service sends the response back to the client containing the process track details for the specified campaign.
processTrackTypes
(Steps)This defines various types of process tracks, each representing a specific stage or action in the campaign creation process. These types can be used to categorize and identify different steps or activities within the campaign workflow. Here's what each type represents:
validation: Represents the validation stage of the campaign creation process, where data or conditions are checked for correctness.
triggerResourceCreation: Indicates the step where resources are created based on triggers or conditions.
facilityCreation: Refers to the creation of facilities or resources required for the campaign.
staffCreation: Involves the creation of staff members necessary for the campaign.
targetAndDeliveryRulesCreation: Represents the creation of rules related to targets and delivery mechanisms (project creation step).
confirmingResourceCreation: Involves confirming that resources have been successfully created.
prepareResourceForMapping: The stage where resources are prepared for mapping to projects.
validateMappingResource: Represents the validation of resources after they have been mapped.
staffMapping: Involves mapping staff to projects.
resourceMapping: Represents the mapping of various resources to projects.
facilityMapping: Refers to mapping facilities to projects.
campaignCreation: Represents the creation of the campaign itself (final step).
error: Indicates that an error occurred during the campaign creation process.
processTrackStatuses
This object defines different statuses that a process track can have, reflecting the state or progress of a particular step in the campaign creation process. Here are the statuses and their meanings:
inprogress: Indicates that the process or task within the campaign creation process is currently ongoing and has not yet been completed.
completed: Represents that the process or task within the campaign creation process has been successfully finished.
toBeCompleted: Refers to processes or tasks within the campaign creation process that are scheduled or pending completion in the future.
failed: Signifies that the process or task within the campaign creation process encountered an error or failed to execute as intended.
Generate API for Boundary
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., boundary)
forceUpdate: Boolean type (either true or false)
hierarchyType: Name of Boundary Hierarchy
campaignId: CampaignId
Response Structure:
Success Response:
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
Based on environment variable enableDynamicTemplateFor (which will have campaign types for which u want boundary target columns to be dynamic based on the number of unique delivery conditions and not default from mdms ). i.e. ( if SMC is configured then it will have target columns based on unique delivery conditions).
Otherwise it will 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.
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).
Boundary Bulk Upload Overview:
This documentation outlines the process and components of bulk uploading boundaries for a campaign. It covers the proper format of the Excel sheet, unique code generation, functions for boundary entity creation, boundary relationship creation, localisation, and API details.
The Excel sheet should be formatted as follows:
Unique codes are auto-generated for each boundary level as follows:
If there are two districts (boundaries at the same level) with the same name (for example, BLR) under different parent-level boundary, the names will be updated to BLR, BLR-01, and so on.
Purpose:
Generate auto-generated boundary codes based on boundary list, child-parent mapping, element codes map, count map, and request information.
Parameters:
boundaryList
: List of boundary data.
childParentMap
: Map of child-parent relationships.
elementCodesMap
: Map of boundaries to its corresponding auto generated unique codes.
countMap
: Map of counts for each boundaries.
request
: HTTP request object.
Returns:
Updated element codes map.
Steps:
Initialise Column Data:
Initialise an array to store column data.
Extract Unique Elements:
Iterate through each row of the boundary list.
Extract unique elements from each column.
Generate Boundary Codes:
Iterate over columns to generate boundary codes.
Check if the element code exists in the element codes map.
If not, generate a new code based on parent-child mapping and sequence.
Store the code of the element in the element codes map.
Default Code Generation:
Generate default code if parent code is not found.
Updated Element Codes Map
Return Updated Boundary Data - Auto-Generated Code Map.
Boundary entities are created chunk-wise, with each chunk consisting of 200 codes.
Purpose:
To create new boundary entities in the system from provided boundary codes.
Steps:
Convert Boundary Map:
Change the boundary map to a list of objects with key
and value
.
Prepare Request:
Set up the request details and initialise lists for boundaries and existing codes.
Chunk Boundary Codes:
Divide the boundary codes into smaller groups.
Fetch Existing Boundaries:
Check the system for existing boundary codes and collect them.
Identify New Boundaries:
Determine which boundary codes are new and add them to the list of boundaries to create.
Create New Boundaries:
If there are new boundaries, send them to the system in groups and log the results.
Handle Existing Boundaries:
Log a message if all boundaries already exist.
Error Handling:
Manage any errors that occur and provide a relevant error message.
Create Boundary Relationship
Purpose:
To create boundary relationships in the system from provided boundary codes and their parent-child mappings.
Steps:
Convert Boundary Map:
Transform the boundary map to a list of {key, value}
objects.
Initialise Request:
Prepare the request details and activity messages array.
Fetch Existing Relationships:
Retrieve existing boundary relationships and extract their codes.
Identify and Create Relationships:
For each boundary code, check if it exists. If not:
Prepare the boundary relationship data.
Confirm the parent boundary creation.
Create the boundary relationship.
Handle Existing Relationships:
If all relationships already exist, log a validation error.
Attach Activity Messages:
Add activity messages to the request body.
Error Handling:
Catch, log, and handle errors appropriately.
Boundary codes are localised to their corresponding names as specified in the uploaded Excel sheet.
To add more boundaries after the initial upload, use an Excel sheet that includes existing boundary codes. New boundaries without codes will be created in the same way as the first upload.
API request for boundary bulk upload:
Note: Ensure the API endpoint, headers, and payload are customised as per your environment and requirements.
It validates the request for project type code from .
Validate Project Type: It validates the request for project type code from .
Country | Província | Distrito | Posto Administrativo | Localidade | Aldeia |
---|
Boundary | Code |
---|
API EndPoints
Roles
/project-factory/v1/project-type/create
CAMPAIGN_MANAGER
/project-factory/v1/project-type/update
CAMPAIGN_MANAGER
/project-factory/v1/project-type/search
CAMPAIGN_MANAGER
/project-factory/v1/data/_create
CAMPAIGN_MANAGER
/project-factory/v1/data/_search
CAMPAIGN_MANAGER
/project-factory/v1/data/_generate
CAMPAIGN_MANAGER
/project-factory/v1/data/_download
CAMPAIGN_MANAGER
API EndPoints
Roles
/boundary-service/boundary-hierarchy-definition/_search
CAMPAIGN_MANAGER
boundary-service/boundary-relationships/_search
CAMPAIGN_MANAGER
/product/variant/v1/_search
CAMPAIGN_MANAGER
/product/v1/_search
CAMPAIGN_MANAGER
/product/v1/_create
CAMPAIGN_MANAGER
/product/variant/v1/_create
CAMPAIGN_MANAGER
INDIA |
INDIA | KARNATAKA |
INDIA | KARNATAKA | BLR |
INDIA | KARNATAKA | BLR | KORAMANGALA |
INDIA | KARNATAKA | BLR | KORAMANGALA | 3RD BLOCK |
INDIA | KARNATAKA | BLR | KORAMANGALA | 3RD BLOCK | EGOV |
INDIA | BIHAR |
INDIA | BIHAR | PATNA |
INDIA | ADMIN_IN |
KARNATAKA | ADMIN_IN_01_KARNATAKA |
BLR | ADMIN_IN_01_01_BLR |
KORAMANGALA | ADMIN_IN_01_01_01_KORMANGALA |
BIHAR | ADMIN_IN_02_BIHAR |
PATNA | ADMIN_IN_02_01_PATNA |