Sewerage Service KT document

KT For Sewerage Service:

Purpose of the project:

            This is one of the major application of the egov stack which helps municipal and citizens to handle sewerage services like creating sewerage connection, searching sewerage connection, sewerage connection, also creating property if it doesn't exist and creating and updating workflow where depending on different roles of the logged-in user he/she can perform various actions like editing or perform document verification and many more specified in workflow documentation and SMS & email notification sent to the owner for various actions performed in the workflow. 

Properties file section(Blueprint of application property of the sewerage service):

Port of application: server.port=8091

 Application context path : server.contextPath=/sw-services

 Application time zone: app.timezone=UTC

spring.datasource.driver-class-name=org.postgresql.Driver

spring.datasource.url=jdbc:postgresql://localhost:5432/rainmaker_new

spring.datasource.username=postgres

spring.datasource.password=postgres

↠mdms urls

egov.mdms.host=http://localhost:8094/

egov.mdms.search.endpoint=egov-mdms-service/v1/_search

↠ Kafka Server Configuration:

kafka.config.bootstrap.server.config=localhost:9092

spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer

spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer

spring.kafka.consumer.group-id=egov-sw-services

spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer

spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

↠ KAFKA CONSUMER CONFIGURATIONS

kafka.consumer.config.auto_commit=true

kafka.consumer.config.auto_commit_interval=100

kafka.consumer.config.session_timeout=15000

kafka.consumer.config.auto_offset_reset=earliest

spring.kafka.consumer.group-id=consumer

↠ KAFKA PRODUCER CONFIGURATIONS

kafka.producer.config.retries_config=0

kafka.producer.config.batch_size_config=16384

kafka.producer.config.linger_ms_config=1

kafka.producer.config.buffer_memory_config=33554432

↠KAFKA topic configuration for sewerage connection

egov.sewarageservice.createconnection=save-sw-connection

egov.sewarageservice.update connection=update-sw-connection

↠PROPERTY CREATE CONFIGURATIONS

egov.property.service.host=https://egov-micro-dev.egovernments.org

egov.property.createendpoint=property-services/property/_create

egov.property.searchendpoint=property-services/property/_search

↠billing service for demand generation and search configurations

egov.billing.service.host=http://localhost:8081/

egov.demand.createendpoint=billing-service/demand/_create

↠Idgen Config

egov.idgen.host=http://localhost:8088/

egov.idgen.path=egov-idgen/id/_generate

egov.idgen.scid.name=sewerageservice.connection.id

egov.idgen.scid.format=SW/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]

egov.idgen.scapid.name=sewerageservice.application.id

egov.idgen.scapid.format=SW_AP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]

↠ workflow url 

workflow.workDir.path=https://egov-micro-dev.egovernments.org/

workflow.context.path=https://egov-micro-dev.egovernments.org/

workflow.transition.path=egov-workflow-v2/egov-wf/process/_transition

workflow.business service.search.path=egov-workflow-v2/egov-wf/business service/_search

egov.sewerageservice.updatesewerageconnection.workflow.topic=update-sw-workflow

↠ workflow config

is.external.workflow.enabled=true

create.sw.workflow.name=NewSW1

↠Localization config

egov.localization.host=https://egov-micro-dev.egovernments.org/

egov.localization.workDir.path=localization/messages/v1

egov.localization.context.path=localization/messages/v1

egov.localization.search.endpoint=/_search

egov.localization.statelevel=true

notification.url = https://egov-micro-dev.egovernments.org/

notification.sms.enabled=true

egov.user.event.notification.enabled=true

kafka.topics.notification.sms=egov.core.notification.sms

notification.sms.link=citizen/egov-common/pay?consumerCode=$consumerCode&tenantId=$tenantId&businessService=SW

↠User config

egov.user.host=http://localhost:8081/

egov.user.context.path=/user/users

egov.user.search.path=/user/_search

egov.usr.events.create.topic=persist-user-events-async

↠ Sewerage Calculator Url 

egov.sw.calculation.host=http://localhost:8083/

egov.sw.calculation.endpoint=sw-calculator/sewerageCalculator/_calculate

egov.sw.estimate.endpoint=sw-calculator/sewerageCalculator/_estimate

↠Notification config

sw.mseva.app.link=https://play.google.com/store/apps/details?id=org.egovernment.mseva.citizen

sw.view.history.link=citizen/otpLogin?mobileNo=$mobileNo&redirectTo=wns/search-preview?applicationNumber=$applicationNumber&history=true&tenantId=$tenantId&service=SEWERAGE

sw.connectiondetails.link=citizen/wns/connection-details?connectionNumber=$connectionNumber&tenantId=$tenantId&service=SEWERAGE

sw.application.pay.link=citizen/otpLogin?mobileNo=$mobileNo&redirectTo=egov-common/pay?consumerCode=$consumerCode&tenantId=$tenantId&businessService=SW.ONE_TIME_FEE

↠Pdf service

egov.pdfservice.host=http://pdf-service:8080/

sw.pdfservice.link=pdf-service/v1/_create?tenantId=$tenantId&key=$applicationkey

↠File Store Id

egov.filestore.host=http://egov-filestore:8080/

sw.fileStore.link=filestore/v1/files/url?tenantId=$tenantId&fileStoreIds=$fileStoreIds

sw.shortener.url=egov-url-shortening/shortener

sw.editnotification.topic=editnotificationsewerage

↠sla default value

sw.sla.default.value=1728000000

↠post for enrich file store id

sw.consume.filestoreids=sw-filestoreids-process

↠save file store Id

egov.sewerageservice.savefilestoreIds=save-sw-filestoreids

Kafka :

Before running the sewerage service we need to run the Kafka, for publishing and subscription.

Database and Flyway DB configuration : 

For database configuration, we need to specify database configuration to spring data source properties file. Flyway DB is used for database migration for that we need to specify flyway config in the application properties file.

Steps to point to local db to run sewerage service locally:

spring.datasource.driver-class-name=org.postgresql.Driver

spring.datasource.url=jdbc:postgresql://localhost:5432/rainmaker_new

spring.datasource.username=postgres

spring.datasource.password=postgres

↠ FLYWAY CONFIGURATIONS

flyway.url=jdbc:postgresql://localhost:5432/rainmaker_new

flyway.user=postgres

flyway.password=postgres

flyway.table=public50

flyway.baseline-on-migrate=true

flyway.outOfOrder=true

flyway.locations=db/migration/ddl

flyway.enabled=true

List other eGov microservices used in Sewerage service and how to configure the same? What other services need to run locally? 

  1. Property services

egov.property.service.host=https://egov-micro-dev.egovernments.org

egov.property.createendpoint=property-services/property/_create

egov.property.searchendpoint=property-services/property/_search

  1. MDMS service

egov.mdms.host=http://localhost:8094/

egov.mdms.search.endpoint=egov-mdms-service/v1/_search

  1. Workflow service

workflow.workDir.path=https://egov-micro-dev.egovernments.org/

workflow.context.path=https://egov-micro-dev.egovernments.org/

workflow.transition.path=egov-workflow-v2/egov-wf/process/_transition

workflow.businessservice.search.path=egov-workflow-v2/egov-wf/businessservice/_search

egov.sewerageservice.updatesewerageconnection.workflow.topic=update-sw-workflow

↠ workflow config

is.external.workflow.enabled=true

create.sw.workflow.name=NewSW1

  1. Localization service

egov.localization.host=https://egov-micro-dev.egovernments.org/

egov.localization.workDir.path=localization/messages/v1

egov.localization.context.path=localization/messages/v1

egov.localization.search.endpoint=/_search

egov.localization.statelevel=true

  1. User service

egov.user.host=http://localhost:8081/

egov.user.context.path=/user/users

egov.user.search.path=/user/_search

egov.usr.events.create.topic=persist-user-events-async

  1. Billing service

egov.billing.service.host=http://localhost:8081/

egov.demand.createendpoint=billing-service/demand/_create

  1. PDF service

egov.pdfservice.host=http://pdf-service:8080/

sw.pdfservice.link=pdf-service/v1/_create?tenantId=$tenantId&key=$applicationkey

  1. Filestore service

egov.filestore.host=http://egov-filestore:8080/

sw.fileStore.link=filestore/v1/files/url?tenantId=$tenantId&fileStoreIds=$fileStoreIds

sw.shortener.url=egov-url-shortening/shortener

sw.editnotification.topic=editnotificationsewerage

↠ KAFKA SERVER CONFIGURATIONS

kafka.config.bootstrap_server_config=localhost:9092

spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer

spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer

spring.kafka.consumer.group-id=egov-sw-services

spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer

spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

↠ KAFKA CONSUMER CONFIGURATIONS

kafka.consumer.config.auto_commit=true

kafka.consumer.config.auto_commit_interval=100

kafka.consumer.config.session_timeout=15000

kafka.consumer.config.auto_offset_reset=earliest

spring.kafka.consumer.group-id=consumer
↠ KAFKA PRODUCER CONFIGURATIONS

kafka.producer.config.retries_config=0

kafka.producer.config.batch_size_config=16384

kafka.producer.config.linger_ms_config=1

kafka.producer.config.buffer_memory_config=33554432
Dependency on another microservices : 

Microservices

Dependency

Mdms service

Loading all  master data 

Idgen service

Generating the application no and connection no

Persister service

Persisting the data

SW calculator service

For fee estimation and meter reading creation

Workflow service

For next state and notification

Property registry service

For property search and validation

User service

For searching the user (used in app notification)

Localization service

For SMS and notification

Validation : 

Action

Validation

Initiate 

Action should not be empty

For all action

Property should not be empty

For all action

Usage type should not be empty

For all action

Check for duplicate document

For all action except initiate

Water connection id should not be null

For all action if documents are present

Document id should not be null

For all action

Property id should not be null

Approve for connection

Road type should not be empty

Approve for connection

Road cutting area should not be null

Activate connection

Connection type should not be null

Activate connection

The water source should not be null

Activate connection

Connection execution date should not be null

Activate connection

Road cutting area should not be null

Topic configuration : 

Topic

Use

save-sw-connection

For saving the application and Notification

update-sw-connection

For updating the application and Notification

save-sw-filestoreids

For saving the filestore ids

update-sw-workflow

For saving the states of application and Notification

editnotificationsewerage

For Edit notification

sw-filestoreids-process

For consuming sewerage application and saving the file store id

    MDMS Configuration

    For Sewerage services, all master data files are in sw-services-calculation.    

File Name

Link

Purpose

Documents.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/Documents.json

Master data for documents to be provided.

billingPeriod.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/billingPeriod.json

Master Data for billing period.

connectionCategory.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/connectionCategory.json

Master data for connection category

connectionType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/connectionType.json

Master data for connection type.

ownerType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/ownerType.json

Master data for owner type.

ownershipType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/ownershipType.json

Master data for ownership type.

usageType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/usageType.json

Master data for usageType.

CalculationAttribute.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/CalculationAttribute.json

Master data for calculation attribute.

FeeSlab.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/FeeSlab.json

Master data for fee slab.

Interest.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/Interest.json

Master data for interest.

Penalty.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/Penalty.json

Master data for penalty.

PipeSize.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/PipeSize.json

Master data for pipe size.

PlotSizeSlab.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/PlotSizeSlab.json

Master data for plot size.

PropertyUsageType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/PropertyUsageType.json

Master data for property usage type.

Rebate.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/Rebate.json

Master data for rebate

RoadType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/RoadType.json

Master data for road type

SCBillingSlab.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/sw-services-calculation/SCBillingSlab.json

Master data for billing slab

Other Config Files : 

Service

File

Description

Persister

https://github.com/egovernments/configs/blob/master/egov-persister/sewerage-persist.yml  

For saving sewerage object we need to configure this persister file.

For more details please go to the technical documentation of persister.

Indexer

https://github.com/egovernments/configs/blob/master/egov-indexer/sewerage-service.yml

For indexing, the all data of sewerage in elastic search database specify this file under indexer config. 

Searcher

https://github.com/egovernments/configs/blob/master/egov-searcher/bill-genie.yml

For bill search of sewerage connection specify the config to this file for sewerage.

API Documentation

Please find the API documentation for the sewerage service. This documentation has all models info and all API for water services.

https://app.swaggerhub.com/apis/egov-foundation/Water-Sewerage-1.0/1.0.0?loggedInWithGitHub=true#/Connection

Configuration details about persister, indexers, and searcher :

For defining the configuration about all please refer to the perspective microservices technical documentation.

Persister config -> https://github.com/egovernments/configs/blob/master/egov-persister/sewerage-persist.yml

Indexer Config -> https://github.com/egovernments/configs/blob/master/egov-indexer/sewerage-service.yml

Searcher Config ->

https://github.com/egovernments/configs/blob/master/egov-searcher/bill-genie.yml

Workflow Configuration :

{ "BusinessServices": [ { "tenantId": "pb", "businessService": "NewSW1", "business": "sw-services", "businessServiceSla": 259200000, "states": [ { "sla": null, "state": null, "applicationStatus": null, "docUploadRequired": false, "isStartState": true, "isTerminateState": false, "isStateUpdatable": false, "actions": [ { "action": "INITIATE", "nextState": "INITIATED", "roles": [ "CITIZEN", "SW_CEMP" ] } ] }, { "sla": null, "state": "INITIATED", "applicationStatus": "INITIATED", "docUploadRequired": false, "isStartState": false, "isTerminateState": false, "isStateUpdatable": true, "actions": [ { "action": "SUBMIT_APPLICATION", "nextState": "PENDING_FOR_DOCUMENT_VERIFICATION", "roles": [ "CITIZEN", "SW_CEMP" ] } ] }, { "sla": null, "state": "PENDING_FOR_CITIZEN_ACTION", "applicationStatus": "PENDING_FOR_CITIZEN_ACTION", "docUploadRequired": false, "isStartState": false, "isTerminateState": false, "isStateUpdatable": true, "actions": [ { "action": "RESUBMIT_APPLICATION", "nextState": "PENDING_FOR_DOCUMENT_VERIFICATION", "roles": [ "CITIZEN", "SW_CEMP" ] } ] }, { "sla": null, "state": "PENDING_FOR_DOCUMENT_VERIFICATION", "applicationStatus": "PENDING_FOR_DOCUMENT_VERIFICATION", "docUploadRequired": false, "isStartState": false, "isTerminateState": false, "isStateUpdatable": true, "actions": [ { "action": "VERIFY_AND_FORWARD", "nextState": "PENDING_FOR_FIELD_INSPECTION", "roles": [ "SW_DOC_VERIFIER" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "SW_DOC_VERIFIER" ] }, { "action": "SEND_BACK_TO_CITIZEN", "nextState": "PENDING_FOR_CITIZEN_ACTION", "roles": [ "SW_DOC_VERIFIER" ] } ] }, { "sla": null, "state": "REJECTED", "applicationStatus": "REJECTED", "isStateUpdatable": false, "docUploadRequired": false, "isStartState": false, "isTerminateState": true }, { "sla": 86400000, "state": "PENDING_FOR_FIELD_INSPECTION", "applicationStatus": "PENDING_FOR_FIELD_INSPECTION", "docUploadRequired": false, "isStartState": false, "isStateUpdatable": true, "isTerminateState": false, "actions": [ { "action": "VERIFY_AND_FORWARD", "nextState": "PENDING_APPROVAL_FOR_CONNECTION", "roles": [ "SW_FIELD_INSPECTOR" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "SW_FIELD_INSPECTOR" ] }, { "action": "SEND_BACK_FOR_DOCUMENT_VERIFICATION", "nextState": "PENDING_FOR_DOCUMENT_VERIFICATION", "roles": [ "SW_FIELD_INSPECTOR" ] } ] }, { "sla": 43200000, "state": "PENDING_APPROVAL_FOR_CONNECTION", "applicationStatus": "PENDING_APPROVAL_FOR_CONNECTION", "docUploadRequired": false, "isStartState": false, "isStateUpdatable": true, "isTerminateState": false, "actions": [ { "action": "APPROVE_FOR_CONNECTION", "nextState": "PENDING_FOR_PAYMENT", "roles": [ "SW_APPROVER" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "SW_APPROVER" ] }, { "action": "SEND_BACK_FOR_FIELD_INSPECTION", "nextState": "PENDING_FOR_FIELD_INSPECTION", "roles": [ "SW_APPROVER" ] } ] }, { "sla": 43200000, "state": "PENDING_FOR_PAYMENT", "applicationStatus": "PENDING_FOR_PAYMENT", "docUploadRequired": false, "isStartState": false, "isTerminateState": false, "isStateUpdatable": false, "actions": [ { "action": "PAY", "nextState": "PENDING_FOR_CONNECTION_ACTIVATION", "roles": [ "CITIZEN", "SW_CEMP" ] } ] }, { "sla": null, "state": "PENDING_FOR_CONNECTION_ACTIVATION", "applicationStatus": "PENDING_FOR_CONNECTION_ACTIVATION", "isStateUpdatable": true, "docUploadRequired": false, "isStartState": false, "isTerminateState": false, "actions": [ { "action": "ACTIVATE_CONNECTION", "nextState": "CONNECTION_ACTIVATED", "roles": [ "SW_CLERK" ] } ] }, { "sla": null, "state": "CONNECTION_ACTIVATED", "applicationStatus": "CONNECTION_ACTIVATED", "isStateUpdatable": false, "docUploadRequired": false, "isStartState": false, "isTerminateState": true } ] } ] }