From 1a3059bf21b74ce650b094fcfe8f4f4320e176b5 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Tue, 28 May 2024 12:15:40 +0530 Subject: [PATCH 1/4] Update README.md --- utilities/project-factory/README.md | 119 ++++++++++++---------------- 1 file changed, 50 insertions(+), 69 deletions(-) diff --git a/utilities/project-factory/README.md b/utilities/project-factory/README.md index f6357804441..43aa8039874 100644 --- a/utilities/project-factory/README.md +++ b/utilities/project-factory/README.md @@ -1,94 +1,75 @@ -# Backend For Frontend service +# ProjectFactory-Service - -# mukta-service +The Project Factory Service is responsible for managing project-type campaigns, including creating, updating, searching, and creating campaigns. -mukta-service service work in between multiple microservices. Earlier client used to directly call multiple microservice, but with introduction of this new service one can provide just few parameters ex:- applicationnumber, tenantId to this new service to get a complete required details. +### DB UML Diagram -## Introduction +![image](https://github.com/egovernments/DIGIT-Frontend/assets/137176738/8c43998d-742b-4629-ae90-63ab2b18772b) +![image](https://github.com/egovernments/DIGIT-Frontend/assets/137176738/3ff9609d-771a-4c6e-a769-54766e7111f7) -This repo is a **barebone minimalistic** starter-kit for TypeScript-based ExpressJS (https://expressjs.com/) app. - -## Simplicity - -In order to build and run the app, you have to execute only 2 NPM script commands. - -## Dependencies - -* ExpressJS -* ExpressJS Middlewares - * Compression - https://github.com/expressjs/compression - * Helmet - https://helmetjs.github.io/ -* TypeScript -* NPM (or) Yarn ### Service Dependencies +- egov-localization +- egov-filestore +- egov-persister +- egov-mdms +- egov-idgen -- egov-mdms-service -- contract -- estimate -- measurement -- muster-roll-service -- User-service -- Workflow-service +### Swagger API Contract +Please refer to the below Swagger API contarct for ProjectFactory service to understand the structure of APIs and to have visualization of all internal APIs [Swagger API contract](https://editor.swagger.io/?url=https://raw.githubusercontent.com/jagankumar-egov/DIGIT-Specs/hcm-workbench/Domain%20Services/Health/project-factory.yaml) ## Service Details -project-factory-service service is new service being added which can work in between existing microservices. With this service the existing API endpoints need not be exposed to frontend. - -For any new requirement one new endpoint with validations and logic for getting data from multiple microservice has to be added in the code. With separate endpoint for each pdf we can define access rules per pdf basis. Currently project-factory-service service has endpoint for following pdfs used in our system:- - -#### Configurations - -**Steps/guidelines for adding support for new API's:** - - -- Follow code of [existing supported PDFs](https://github.com/egovernments/utilities/tree/master/egov-pdf/src/routes) and create new endpoint with suitable search parameters for each api - -- Put parameters validations, module level validations ex:- application status,applicationtype and api error responses with proper error messages and error codes +### Funcatinality +1. ProjectFactory Service manages campaigns: creation, updating, searching, and data generation. +2. Project Mapping : In campaign creation full project mapping is done with staff, facility and resources along with proper target values. +3. Create Data: Validates and creates resource details of type facility,user and boundary. +4. Generate Data: Generates sheet data of type facility,user and boundary. +5. Boundary and Resource Validation: Validates boundaries and resources during campaign creation and updating. -- Add access to endpoint in MDMS for suitable roles +### Feature +1. Functionality to create campaigns easily. +2. Uploading generated datas sheets to filestore and return filestore id for easy access. +3. Supports localisation. +4. Customizable Delivery Rules: Allows defining delivery rules for projects based on specific criteria. +5. Search and Filtering: Enables searching and filtering campaigns based on various parameters like status, date, and creator. +6. Batch Processing: Supports batch processing for creating and updating multiple campaigns simultaneously. -### API Details -Currently below endpoints are in use for 'EMPLOYEE’ roles +### External Libraries Used +[xlsx](https://github.com/SheetJS/sheetjs):- For reading and writing Excel files. -###Flow Diagram -![Flow](https://github.com/egovernments/DIGIT-Works/blob/04689228d238592a34e832be2997a0f05ac956f8/utilities/project-factory/docs/flowdiagram.png?raw=true) +[ajv](https://github.com/ajv-validator/ajv):- For JSON schema validation. +[lodash](https://github.com/lodash/lodash):- For utility functions like data manipulation and object iteration. -## Install, Build, Run +### Configuration -Install node package dependencies: +- Persister config: [here](https://github.com/egovernments/configs/blob/UNIFIED-UAT/health/egov-persister/project-factory-persister.yml) +- Helm chart details: [here](https://github.com/egovernments/DIGIT-DevOps/blob/unified-env/deploy-as-code/helm/charts/health-services/project-factory/values.yaml) + +### API Endpoints -`$ npm install` - -Build: - -`$ npm run build` - -Run ExpressJS server: - -`$ npm start` - -## Recommendation - -Keep all TypeScript source files in the `src` folder. - -## Future Goals - -* Add more sample code like Routes, Controllers, and Views -* Add Webpack -* Add unit-test sample code for Jest +- `/project-factory/v1/project-type/create`: Creates a new project type campaign. +- `/project-factory/v1/project-type/update`: Updates an existing project type campaign. +- `/project-factory/v1/project-type/search`: Searches for project type campaigns based on specified criteria. +- `/project-factory/v1/data/_create`: Creates or validates resource data (e.g., facility, user, boundary). +- `/project-factory/v1/data/_search`: Searches for resource data based on specified criteria. +- `/project-factory/v1/data/_generate`: Initiates the generation of new data based on provided parameters. +- `/project-factory/v1/data/_download`: Downloads resource data based on specified criteria. ### Kafka Consumers -NA -### Kafka Producers -NA +- start-campaign-mapping: This topic is used by the service to initiate the mapping process for campaigns. -## License +### Kafka Producers -MIT © [jagankumar-egov](https://github.com/jagankumar-egov) +- save-project-campaign-details: This topic is used to save project campaign details after creation. +- update-project-campaign-details: This topic is used to update project campaign details. +- create-resource-details: This topic is used to create resource details. +- update-resource-details: This topic is used to update resource details. +- create-resource-activity: This topic is used to create resource activity creation. +- create-generated-resource-details: This topic is used to save details for generated resources. +- update-generated-resource-details: This topic is used to update details for generated resources. From 5e1c1fe0a04d98ed0c9ca8744f105f810a0b41d9 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Tue, 28 May 2024 12:19:52 +0530 Subject: [PATCH 2/4] Update README.md --- utilities/project-factory/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/project-factory/README.md b/utilities/project-factory/README.md index 43aa8039874..29f563dedbb 100644 --- a/utilities/project-factory/README.md +++ b/utilities/project-factory/README.md @@ -14,6 +14,9 @@ The Project Factory Service is responsible for managing project-type campaigns, - egov-persister - egov-mdms - egov-idgen +- health-project +- health-hrms +- health-facility ### Swagger API Contract Please refer to the below Swagger API contarct for ProjectFactory service to understand the structure of APIs and to have visualization of all internal APIs [Swagger API contract](https://editor.swagger.io/?url=https://raw.githubusercontent.com/jagankumar-egov/DIGIT-Specs/hcm-workbench/Domain%20Services/Health/project-factory.yaml) From 1169c5b20779be9675074df349de059269652c29 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Tue, 28 May 2024 12:21:06 +0530 Subject: [PATCH 3/4] Update utilities/project-factory/README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- utilities/project-factory/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/project-factory/README.md b/utilities/project-factory/README.md index 29f563dedbb..ba83a26ac07 100644 --- a/utilities/project-factory/README.md +++ b/utilities/project-factory/README.md @@ -19,7 +19,7 @@ The Project Factory Service is responsible for managing project-type campaigns, - health-facility ### Swagger API Contract -Please refer to the below Swagger API contarct for ProjectFactory service to understand the structure of APIs and to have visualization of all internal APIs [Swagger API contract](https://editor.swagger.io/?url=https://raw.githubusercontent.com/jagankumar-egov/DIGIT-Specs/hcm-workbench/Domain%20Services/Health/project-factory.yaml) +Please refer to the below Swagger API contract, for ProjectFactory service to understand the structure of APIs and to have visualization of all internal APIs [Swagger API contract](https://editor.swagger.io/?url=https://raw.githubusercontent.com/jagankumar-egov/DIGIT-Specs/hcm-workbench/Domain%20Services/Health/project-factory.yaml) ## Service Details From 97980691e6d5d468d74d371737fad374640de455 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Tue, 28 May 2024 12:34:50 +0530 Subject: [PATCH 4/4] Update README.md --- utilities/project-factory/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utilities/project-factory/README.md b/utilities/project-factory/README.md index ba83a26ac07..40aee6d33bc 100644 --- a/utilities/project-factory/README.md +++ b/utilities/project-factory/README.md @@ -9,11 +9,17 @@ The Project Factory Service is responsible for managing project-type campaigns, ### Service Dependencies + +#### Core services + - egov-localization - egov-filestore - egov-persister - egov-mdms - egov-idgen +- egov-boundaryservice-v2 + +#### Health services - health-project - health-hrms - health-facility