Fire-NOC Service
Objective:
The main objective of the Fire-NOC module is to provide No Objection Certificate indicating that the building is designed as per fire safety norms and regulation.
Requirements:
Prior knowledge of JavaScript.
Prior knowledge of Node.js platform.
Prior knowledge of Kafka.
JSONPath for filtering required data from json objects.
Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON etc.
Prior knowledge of eGov-mdms service, eGov-persister, eGov-user, eGov-location, eGov-localization, eGov-idgen.
Functionality:
FireNOC service is used to get firenoc for single/multiple building. There are 3 endpoints for this service
Create FireNOC (/firenoc-services/_create):
Create API call is called with INITIATED action to create new application. In this API call we validate request body(using ajv module for contract specific validation and explicit checking for user related validation checks), enrich audit details, generate application no using idgen, persist data using persister and return response.
Allowed user roles: NOC_CEMP, CITIZEN
Update FireNOC (/firenoc-services/_update):
Once application is created it can be updated by citizen or employee while taking action on application
Allowed user roles: NOC_CEMP, CITIZEN, NOC_DOC_VERIFIER, NOC_FIELD_INSPECTOR, NOC_APPROVER
Search FireNOC (/firenoc-services/_search):
Search API call is used to search for application. If search call is being made by CITIZEN then only his application would be fetched applying other search filters. For employee search based on search filter will return data.
Allowed user roles: NOC_CEMP, CITIZEN, NOC_DOC_VERIFIER, NOC_FIELD_INSPECTOR, NOC_APPROVER, EMPLOYEE
PRD:
Refer the below document for PRD of FireNOC module.
https://docs.google.com/document/d/1HuNgTYYQ4nDrqn_LPPtu3CaVdrxHVHAIUIl-wOZsIgA/edit?ts=5c91c088
API Contract:
Setup and Usage:
The application is present in firenoc-services folder of municipal-services repository.
Branch: noc_latest
Postman Collection: https://www.getpostman.com/collections/093e28bb4e341770b6c7
Dependencies:
User:
Firenoc depends on egov-user for searching user on every create employee call. If user is not found then create user whenever required. Firenoc uses /user/users/_createnovalidate, /user/users/_updatenovalidate, /user/v1/_search APIs.
MDMS:
Firenoc service makes calls to egov-mdms-service to fetch required masters as stated above. These are significant in validations.
Note: This service has to be restarted.
ID Gen:
Firenoc makes use of egov-idgen for generating application no (labelled as Application no on the screen.). Format of the id and the key are configurable, they're part of the envVariables file.
Note: The new build of ID Gen has to be promoted.
Location:
Firenoc makes call to this service to validate boundary data.
Workflow:
Firenoc service makes call to workflow service when user takes action on application.
User event:
In case of user action to push mseva notification this service is used.
Firenoc calculator:
In case of create and update we need to recalculate firenoc fees and generate demands based on UOM's. This service is used for
Configurations:
MDMS:
Firenoc master:
ApplicationType - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/firenoc/ApplicationType.json
BuildingType - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/firenoc/BuildingType.json
FireNocStateConstats - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/firenoc/FireNocStateConstats.json
FireStations - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/firenoc/FireStations.json
PropertyType - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/firenoc/PropertyType.json
FireNocULBConstats - https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/amritsar/firenoc/FireNocULBConstats.json (ulb specific constants)
Persister Config:
Id Gen Config:
Business service config:
{
"RequestInfo": {
"apiId": "Rainmaker",
"action": "",
"did": 1,
"key": "",
"msgId": "20170310130900|en_IN",
"requesterId": "",
"ts": 1513579888683,
"ver": ".01",
"authToken": "<authToken>"
},
"BusinessServices": [
{
"tenantId": "pb",
"businessService": "FIRENOC",
"business": "fireNoc",
"businessServiceSla": 172800000,
"states": [
{
"sla": null,
"state": null,
"applicationStatus": null,
"docUploadRequired": false,
"isStartState": true,
"isTerminateState": false,
"actions": [
{
"action": "INITIATE",
"nextState": "INITIATED",
"roles": [
"CITIZEN",
"NOC_CEMP"
]
}
]
},
{
"sla": null,
"state": "INITIATED",
"applicationStatus": "INITIATED",
"docUploadRequired": false,
"isStartState": true,
"isTerminateState": false,
"actions": [
{
"action": "APPLY",
"nextState": "PENDINGPAYMENT",
"roles": [
"CITIZEN",
"NOC_CEMP"
]
},
{
"action": "INITIATE",
"nextState": "INITIATED",
"roles": [
"CITIZEN",
"TL_CEMP"
]
}
]
},
{
"sla": null,
"state": "PENDINGPAYMENT",
"applicationStatus": "PENDINGPAYMENT",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": false,
"actions": [
{
"action": "PAY",
"nextState": "DOCUMENTVERIFY",
"roles": [
"CITIZEN",
"NOC_CEMP"
]
},
{
"action": "ADHOC",
"nextState": "PENDINGPAYMENT",
"roles": [
"NOC_CEMP"
]
}
]
},
{
"sla": 86400000,
"state": "DOCUMENTVERIFY",
"applicationStatus": "DOCUMENTVERIFY",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": false,
"actions": [
{
"action": "REJECT",
"nextState": "REJECTED",
"roles": [
"NOC_DOC_VERIFIER"
]
},
{
"action": "FORWARD",
"nextState": "FIELDINSPECTION",
"roles": [
"NOC_DOC_VERIFIER"
]
},
{
"action": "REFER",
"nextState": "DOCUMENTVERIFY",
"roles": [
"NOC_DOC_VERIFIER"
]
},
{
"action": "SENDBACKTOCITIZEN",
"nextState": "CITIZENACTIONREQUIRED",
"roles": [
"NOC_DOC_VERIFIER"
]
}
]
},
{
"sla": null,
"state": "REJECTED",
"applicationStatus": "REJECTED",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": true
},
{
"sla": 86400000,
"state": "FIELDINSPECTION",
"applicationStatus": "FIELDINSPECTION",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": false,
"actions": [
{
"action": "REJECT",
"nextState": "REJECTED",
"roles": [
"NOC_FIELD_INSPECTOR"
]
},
{
"action": "SENDBACK",
"nextState": "DOCUMENTVERIFY",
"roles": [
"NOC_FIELD_INSPECTOR"
]
},
{
"action": "FORWARD",
"nextState": "PENDINGAPPROVAL",
"roles": [
"NOC_FIELD_INSPECTOR"
]
},
{
"action": "REFER",
"nextState": "FIELDINSPECTION",
"roles": [
"NOC_FIELD_INSPECTOR"
]
},
{
"action": "SENDBACKTOCITIZEN",
"nextState": "CITIZENACTIONREQUIRED",
"roles": [
"NOC_FIELD_INSPECTOR"
]
}
]
},
{
"sla": 43200000,
"state": "PENDINGAPPROVAL",
"applicationStatus": "PENDINGAPPROVAL",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": false,
"actions": [
{
"action": "SENDBACK",
"nextState": "FIELDINSPECTION",
"roles": [
"NOC_APPROVER"
]
},
{
"action": "REFER",
"nextState": "PENDINGAPPROVAL",
"roles": [
"NOC_APPROVER"
]
},
{
"action": "APPROVE",
"nextState": "APPROVED",
"roles": [
"NOC_APPROVER"
]
},
{
"action": "REJECT",
"nextState": "REJECTED",
"roles": [
"NOC_APPROVER"
]
}
]
},
{
"sla": null,
"state": "APPROVED",
"applicationStatus": "APPROVED",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": false,
"actions": [
{
"action": "CANCEL",
"nextState": "CANCELLED",
"roles": [
"NOC_APPROVER"
]
}
]
},
{
"sla": null,
"state": "CANCELLED",
"applicationStatus": "CANCELLED",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": true,
"isStateUpdatable": false,
"actions": null
},
{
"sla": null,
"state": "CITIZENACTIONREQUIRED",
"applicationStatus": "CITIZENACTIONREQUIRED",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": false,
"isStateUpdatable": true,
"actions": [
{
"action": "RESUBMIT",
"nextState": "DOCUMENTVERIFY",
"roles": [
"CITIZEN",
"NOC_CEMP"
]
}
]
}
]
}
]
}
Basic Setup to run locally:
Before running the Fire NOC service in local system ,make sure that the Workflow service, ID-Gen service, FireNOC Calculator service, Egov-Location service and Egov-User service are running in background.The following service can be port-forwarded.
Below are example for port forwarding (source port value need to be taken from envVariables.js).
Step 1: Port-forward the workflow service.
kubectl port-forward -n egov <egov-workflow pod id> 8089:8080
Step 2: Port-forward the egov-location service.
kubectl port-forward -n egov <egov-location pod id> 8090:8080
Step 3: Port-forward the egov-user service.
kubectl port-forward -n egov <egov-user pod id> 8088:8080
Step 4: Port-forward the firenoc-calculator service.
kubectl port-forward -n egov <firenoc-calculator pod id> 8083:8080
Step 5: Port-forward the egov-idgen service.
kubectl port-forward -n egov <egov-idgen pod id> 8087:8080
Step 6: After port-forwarding all the service mentioned above, now start the fire-noc service by running
the command npm run dev in terminal.