Water service KT document

KT Document For Water Service : 

Description : 

This is the egov application, which helps and gives flexibility to municipal and citizen to handle the water service like apply for water connection, search water connection. The application will go on different stages that state can verify by given roles, If that role can take the action then the application will go to the next state. Based on the state,  citizens will get a notification (SMS and in-app ). Citizens also can pay for application fees or employees can collect the fee for the application.

Application.properties entries :

Port of application: server.port=8090

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

 Application time zone: app.timezone=UTC

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

 Database URL : spring.datasource.url=jdbc:postgresql://localhost:5432/ws_services

 Database username : spring.datasource.username=postgres

 Database password : spring.datasource.password=postgres

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

Property search url :

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

Mdms host url : 

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

Mdms search url :

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

Kafka application port : kafka.config.bootstrap_server_config=localhost:9092

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

Kafka consumer key deserializer : 

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

Kafka consumer group id : spring.kafka.consumer.group-id=egov-ws-services

Kafka producer key deserializer : 

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

Kafka producer value deserializer : 

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

Kafka Topic:

Save water connection topic : egov.waterservice.createwaterconnection=save-ws-connection

Update water connection topic : 

egov.waterservice.updatewaterconnection=update-ws-connection

Update workflow topic : 

egov.waterservice.updatewaterconnection.workflow.topic=update-ws-workflow

Pagination config :

Maximum connection search limit : egov.waterservice.pagination.max.limit=500

Default limit : egov.waterservice.pagination.default.limit=50

Offset : egov.waterservice.pagination.default.offset=0

Flyway config :

Database host url : flyway.url=jdbc:postgresql://localhost:5432/ws_services

Database username : flyway.user=postgres

Database password : flyway.password=postgres

Flyway table for maintaining the migration : flyway.table=public_new_102

Flyway migration enable or not : flyway.baseline-on-migrate=false

Flyway script order : flyway.outOfOrder=false

Flyway file location for scripts file : flyway.locations=db/migration/ddl

Flyway is enable or not : flyway.enabled=false

Idgen Config

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

Idgen id generation url : egov.idgen.path=egov-idgen/id/_generate

Connection id name : egov.idgen.wcid.name=waterservice.connection.id

Connection id format : egov.idgen.wcid.format=WS/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]

Application id name : egov.idgen.wcapid.name=waterservice.application.id

Application id format :

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

Workflow config

Workflow is enable or not : is.external.workflow.enabled=true

Workflow name for water service : create.ws.workflow.name=NewWS1

Workflow url : workflow.workDir.path=http://localhost:8089/

Workflow context path : workflow.context.path=http://localhost:8089/

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

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

Notification topics :

Sms notification topic : kafka.topics.notification.sms=egov.core.notification.sms

Sms enable flag : notification.sms.enabled=true

In app notification flag : egov.user.event.notification.enabled=true

In app creation reason : egov.usr.events.create.topic=persist-user-events-async

In app notification url:

Relative url for in app notification : 

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

Relative sms link : 

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

Localization service config:

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

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

Localization search end point : egov.localization.search.endpoint=/_search

Localization state level flag : egov.localization.statelevel=true

User service config:

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

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

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

Water calculator service config :

WS calculator host : egov.ws.calculation.host=http://localhost:8083/

WS calculate tax end point : egov.ws.calculation.endpoint=waterCalculator/_calculate

WS estimate tax end point : egov.ws.estimate.endpoint=waterCalculator/_estimate

Receipt topic config:

Payment topic : kafka.topics.receipt.create=egov.collection.payment-create

Business service for fee : egov.receipt.businessservice=WS.ONE_TIME_FEE

Meter reading config:

Meter reading create topic : ws.meterreading.create=create-meter-reading

Meter reading create end point : ws.meterreading.create.endpoint=ws-calculator/meterConnection/_create

Notification config

Mseva app link : 

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

View history link config :

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

Connection details link : 

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

Application fee pay link : 

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

Pdf service config: 

Pdf service host url : egov.pdfservice.host=https://egov-micro-dev.egovernments.org/

Pdf creation url : ws.pdfservice.link=pdf-service/v1/_create?tenantId=$tenantId&key=$applicationkey

File Store Id

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

Filestore url for create : ws.fileStore.link=filestore/v1/files/url?tenantId=$tenantId&fileStoreIds=$fileStoreIds

URL shortener service config : 

Shortener url : ws.shortener.url=egov-url-shortening/shortener

Edit Notification topic : 

Edit notification topic : ws.editnotification.topic=editnotification

Post for enrich file store id

Filestore id topic for saving file store ids : ws.consume.filestoreids=ws-filestoreids-process

Save filestore ids to ws-service table, persister use this topic and persist all the value to the table : 

egov.waterservice.savefilestoreIds=save-ws-filestoreids

Workflow default sla config : 

Sla default value for every step : ws.sla.default.value=1728000000

Kafka :

 Before running the water 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.

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

WS 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 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

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-ws-connection

For saving the application and Notificaton

update-ws-connection

For updating the application and Notification

save-ws-filestoreids

For saving the filestore ids

update-ws-workflow

For saving the states of application and Notification

create-meter-reading

For creating meterreading from initial meter reading

editnotification

For Edit notification

ws-filestoreids-process

For cosuming water application and saving the file store id

MDMS Configuration : 

   For Water services, all master data files are in ws-services-masters and ws-services-calculation.    

File Name

Link

Purpose

Documents.json

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

Master data for documents to be provided.

billingPeriod.json

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

Master Data for billing period.

connectionCategory.json

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

Master data for connection category

connectionType.json

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

Master data for connection type.

ownerType.json

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

Master data for owner type.

ownershipType.json

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

Master data for ownership type.

usageType.json

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

Master data for usageType.

waterSource.json

https://raw.githubusercontent.com/egovernments/egov-mdms-data/master/data/pb/ws-services-masters/waterSource.json

Master data for water source and subsource.



CalculationAttribute.json

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

Master data for calculation attribute.

FeeSlab.json

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

Master data for fee slab.

Interest.json

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

Master data for interest.

MeterStatus.json

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

Master data for meter status

Penalty.json

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

Master data for penalty.

PipeSize.json

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

Master data for pipe size.

PlotSizeSlab.json

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

Master data for plot size.

PropertyUsageType.json

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

Master data for property usage type.

Rebate.json

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

Master data for rebate

RoadType.json

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

Master data for road type

WCBillingSlab.json

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

Master data for billing slab

WaterCess.json

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

Master data for water cess.

Other Config Files : 

Service

File

Description

Persister

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

For saving water and meter object we need to configure this two persister file.

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

Indexer

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

https://github.com/egovernments/configs/blob/master/egov-indexer/water-services-meter.yml

For indexing the all data of water and meter in elasticsearch database specify this two file under indexer config. 

Searcher

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

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

API Documentation :

 Please find the API documentation for the water 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/water-persist.yml , https://github.com/egovernments/configs/blob/master/egov-persister/water-persist.yml

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

https://github.com/egovernments/configs/blob/master/egov-indexer/water-services-meter.yml Searcher Config ->

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

Workflow Configuration :

{ "BusinessServices": [ { "tenantId": "pb", "businessService": "NewWS1", "business": "ws-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", "WS_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", "WS_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", "WS_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": [ "WS_DOC_VERIFIER" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "WS_DOC_VERIFIER" ] }, { "action": "SEND_BACK_TO_CITIZEN", "nextState": "PENDING_FOR_CITIZEN_ACTION", "roles": [ "WS_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": [ "WS_FIELD_INSPECTOR" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "WS_FIELD_INSPECTOR" ] }, { "action": "SEND_BACK_FOR_DOCUMENT_VERIFICATION", "nextState": "PENDING_FOR_DOCUMENT_VERIFICATION", "roles": [ "WS_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": [ "WS_APPROVER" ] }, { "action": "REJECT", "nextState": "REJECTED", "roles": [ "WS_APPROVER" ] }, { "action": "SEND_BACK_FOR_FIELD_INSPECTION", "nextState": "PENDING_FOR_FIELD_INSPECTION", "roles": [ "WS_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", "WS_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": [ "WS_CLERK" ] } ] }, { "sla": null, "state": "CONNECTION_ACTIVATED", "applicationStatus": "CONNECTION_ACTIVATED", "isStateUpdatable": false, "docUploadRequired": false, "isStartState": false, "isTerminateState": true } ] } ] }