Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #943

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 67 additions & 58 deletions utilities/project-factory/README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,93 @@
# ProjectFactory-Service
# ProjectFactory Service

The Project Factory Service is responsible for managing project-type campaigns, including creating, updating, searching, and creating campaigns.
The **ProjectFactory Service** is responsible for managing project-type campaigns, including creating, updating, searching, and generating campaign data.

### DB UML Diagram
## DB UML Diagram

![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)
![DB UML Diagram](https://github.com/egovernments/DIGIT-Frontend/assets/137176738/8c43998d-742b-4629-ae90-63ab2b18772b)
![DB UML Diagram](https://github.com/egovernments/DIGIT-Frontend/assets/137176738/3ff9609d-771a-4c6e-a769-54766e7111f7)

## Service Dependencies

### Service Dependencies
### Core Services

#### Core services
- `egov-localization`
- `egov-filestore`
- `egov-persister`
- `egov-mdms`
- `egov-idgen`
- `egov-boundaryservice-v2`

- egov-localization
- egov-filestore
- egov-persister
- egov-mdms
- egov-idgen
- egov-boundaryservice-v2
### Health Services

#### Health services
- health-project
- health-hrms
- health-facility
- `health-project`
- `health-hrms`
- `health-facility`

### Swagger API Contract
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)
### Caching

- `Redis` is now used to store cache for frequently accessed data to improve performance.

## Swagger API Contract

For the structure and visualization of APIs, refer to the [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

### 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.

### 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.
### Functionality

1. **Campaign Management**: Manages project-type campaigns, including creation, updating, searching, and data generation.
2. **Project Mapping**: Completes full project mapping with staff, facility, and resources along with proper target values during campaign creation.
3. **Data Creation**: Validates and creates resource details of types `facility`, `user`, and `boundary`.
4. **Data Generation**: Generates sheet data of types `facility`, `user`, and `boundary`.
5. **Validation**: Validates boundaries and resources during campaign creation and updating.

### Features

1. **Easy Campaign Creation**: Facilitates easy creation of campaigns.
2. **File Storage**: Uploads generated data sheets to `egov-filestore` and returns the file store ID for easy access.
3. **Localization Support**: Supports localization for multi-language adaptability.
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 parameters like status, date, and creator.
6. **Batch Processing**: Supports batch processing for creating and updating multiple campaigns simultaneously.
7. **Caching with Redis**: Improves performance by caching frequently accessed data.

### External Libraries Used
[xlsx](https://github.com/SheetJS/sheetjs):- For reading and writing Excel files.

[ajv](https://github.com/ajv-validator/ajv):- For JSON schema validation.
- **[xlsx](https://github.com/SheetJS/sheetjs)**: For reading and writing Excel files.
- **[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.

[lodash](https://github.com/lodash/lodash):- For utility functions like data manipulation and object iteration.
## Configuration

- **Persister Config**: [Link](https://github.com/egovernments/configs/blob/UNIFIED-UAT/health/egov-persister/project-factory-persister.yml)
- **Helm Chart Details**: [Link](https://github.com/egovernments/DIGIT-DevOps/blob/unified-env/deploy-as-code/helm/charts/health-services/project-factory/values.yaml)

### Configuration
## API Endpoints

- 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
- **`POST /project-factory/v1/project-type/create`**: Creates a new project-type campaign.
- **`PUT /project-factory/v1/project-type/update`**: Updates an existing project-type campaign.
- **`POST /project-factory/v1/project-type/search`**: Searches for project-type campaigns based on specified criteria.
- **`POST /project-factory/v1/data/_create`**: Creates or validates resource data (e.g., facility, user, boundary).
- **`POST /project-factory/v1/data/_search`**: Searches for resource data based on specified criteria.
- **`POST /project-factory/v1/data/_generate`**: Initiates the generation of new data based on provided parameters.
- **`GET /project-factory/v1/data/_download`**: Downloads resource data based on specified criteria.

- `/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

- **`start-campaign-mapping`**: Initiates the mapping process for campaigns.

### Kafka Consumers
## Kafka Producers

- start-campaign-mapping: This topic is used by the service to initiate the mapping process for campaigns.
- **`save-project-campaign-details`**: Saves project campaign details after creation.
- **`update-project-campaign-details`**: Updates project campaign details.
- **`create-resource-details`**: Creates resource details.
- **`update-resource-details`**: Updates resource details.
- **`create-resource-activity`**: Creates resource activity.
- **`create-generated-resource-details`**: Saves details for generated resources.
- **`update-generated-resource-details`**: Updates details for generated resources.

### Kafka Producers
## Redis Caching

- 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.
- **Purpose**: Enhances performance by caching frequently accessed data and reducing the load on the database.
- **Usage**: Commonly used to store temporary data like search results, and other frequently accessed resources.
Loading