Package: openimis-be-policy-notification
openIMIS Backend Policy Notification reference moduleThis repository holds the files of the openIMIS Backend Policy Notification reference module.
It is dedicated to be deployed as a module ofopenimis-be_py.ORM mapping:FamilyNotification > tblFamilySMSListened Django Signals:After Family mutationCreateFamilyMutation - create FamilyNotification object connected with created familyUpdateFamilyMutation - update FamilyNotification object connected with updated familyDeleteFamiliesMutation - delete FamilyNotification object connected with deleted familyFamily additional filterUse mode from additional_filter.PolicyNotification to additionally query families by
notification eligibilityServicesFamily notificationCreate FamilyNotification object connected with family with given uuid.create_family_notification_policy(uuid,notification_data)Update FamilyNotification object connected with family with given uuid.update_family_notification_policy(uuid,notification_data)Delete FamilyNotification object connected with family with given uuid.delete_family_notification_policy(uuid,notification_data)notification_datais dict structured as follows:{'approvalOfNotification':True,# boolean informing whether family allows notification comunication, default False'languageOfNotification':'en',# language code determining in which language messages will be sent, default en}ReportsFamily Policy Notification ReportReport summarizing notification eligibility.Available in endpoint:policy_notification/communication_by_notification_reportPayload:{"districtUuid":"districtUUID","regionUuid":"regionUUID","officerUuid":"enrollmentOfficerUUID","mode":1}Modes:0: 'All',1: 'Approval and phone number',2: 'Approval only',3: 'Phone number only',4: 'No approval and phone number'ConfigurationProvidersThis configuration key allows to configure currently used notification provider gateways.
For provider to be used it has to be included in notification_gateways submodule with class name
same as provider config (case-insensitive). When notifications are being send only first
provider is used. Module tries to use another provider only when notifying with previous
one has failed."providers": {
    "eGASMSGateway": {
        "GateUrl": "http://127.0.0.1:8000",
        "SmsResource": "/api/policy_notification/test_sms/",
        "PrivateKey": "",
        "UserId": "",
        "SenderId": "",
        "ServiceId": "",
        "RequestType": "",
        "HeaderKeys": "X-Auth-Request-Hash,X-Auth-Request-Id,X-Auth-Request-Type",
        "HeaderValues": "PrivateKey,UserId,RequestType"
    },
    "TextNotificationProvider": {
        "DestinationFolder": "sent_notification"
    }
}EligibleNotificationTypesDetermines which types of notifications are to be sent."eligibleNotificationTypes": {
    "activation_of_policy": False,
    "starting_of_policy": False,
    "need_for_renewal": False,
    "expiration_of_policy": False,
    "reminder_after_expiration": False,
    "renewal_of_policy": False
}family_policy_notification_report_perms- List of role right required for generating
report, default["131224"]trigger_time_interval_hours- Interval between event detector calls, default 4trigger_first_call_hour- Hour of first task execution in given day, default 8trigger_last_call_hour- Hour of last task execution in given day, default 20Note:trigger_*settings are only used if scheduled taskpolicy_notification.tasks.send_notification_messagesin the openimis settings.pySCHEDULED_TASKis not active. Task included inSCHEDULED_TASKshould use hour param for
execution. Either provided as list of hours at which given task is executed (e.g. hour="8, 12, 16"),
single hour (e.g. hour=8), or the time interval when the task is executed every hour (e.g. hour='8-16').reminder_before_expiry_days- Days before the expiry of un-renewed policy to send notifications,
default 5reminder_after_expiry_days- Days after the expiry of un-renewed policy to send notifications,
default 5openIMIS Modules DependenciesopenIMIS.policyopenIMIS.insuree