Boundary Details
This screen allows a user to select different boundary details required for the campaign creation. Here, we show the boundary types based on the hierarchy type which is present in the MDMS, MDMS file path : https://github.com/egovernments/egov-mdms-data/blob/UNIFIED-DEV/data/mz/health/hcm-admin-console/hierarchyConfig.json
If we want to fetch the hierarchy type from the MDMS, use the following API:
To fetch the hierarchy definition, this is mentioned in the setUpCampaign page: https://github.com/egovernments/DIGIT-Frontend/blob/campaign/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js
After calling the hierarchy, the response is stored in the session storage under the name:
After it is stored, we can use it in the "Selecting Boundaries" component to show the different boundary types present: The FilePath for it is the following: https://github.com/egovernments/DIGIT-Frontend/blob/campaign/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js The boundary type in the screen is shown upto the lowest hierarchy level which is also configured from the MDMS. The options in the hierarchy is shown using the following:
In the selection boundary screen, we show options according to parent boundary type using the above API. Some validations for this screen:
All the boundary types in the screen are mandatory.
Lower level boundary type is mandatory if a user has selected the above levels
After the boundaries are selected, the Generate API is called with a delay of 3 seconds when the user clicks on next, using the following hook: https://github.com/egovernments/DIGIT-Frontend/blob/campaign/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useGenerateIdCampaign.js
Handling boundary data API performance:
We have impemented Parallel API calls have been implemented for boundary data search to optimise the performance better. We have added all the API search from the loop and calling parallel calls at once and storing the respective data in respective boundaryType.
For the next time when we are making boundary search api calls, we are checking locally whether data is present otherwise calling the API search only for the required data to optimise it better.
All the above mentioned logic have been added in useParallelSearch.js hook.
API Details
boundary-service/boundary-relationships/_search
POST
Params tenantId=mz
hierarchyType=ADMIN
boundaryType=Provincia
parent=ADMIN_MO
/boundary-service/boundary-hierarchy-definition/_search
POST
{ "tenantId": "mz", "limit": 2, "offset": 0, "hierarchyType": "ADMIN" }