Package: polzybackend
PoLZy Back-End AppPoLZyis a flexible tool for insurance companies to deal with standard business processes during the life cycle of a policy.Here you can find the PoLZy back-end application.Currently, it is available only a development installationCustom ElementsAs we mention above,PoLZyis a flexible system. You may adjust it by your specific environment by developing custom subclasses.PolicyA policy class is responsible for fetching policy data from Policy Management System and providing it to the front-end app. It inherits classPolicyfrombase.policyand overrides the following elements:fetch(policy_number, effective_date)The method fetches a policy data from the Policy Management System and reshape it to aJSONobject (dict) of structure that is shown in the figure bellow. The reshaped data is stored indataproperty. The method returnsTrueif it successful, otherwise -False.activities_by_statePropertyactivities_by_statedefines the list of possible policy states and available activities for each state:activities_by_status={'state_1':['activity_1','activity_2',],'state_2':[]}Policy AttributesThere are several properties that defines policy attribute (see the figure above):attributes_policy-- policy attributes (dictionary of<name: description>records)attributes_insured_person-- insured person attributes (corresponds to insured object attributes ifis_person: true-- dictionary of<name: description>records)attributes_insured_object-- insured object attributes (corresponds to insured object attributes ifis_person: false-- dictionary of<name: description>records)attributes_implementation-- implementation attributes of an insured object (dictionary of<name: description>records)attributes_product_line-- product line attributes (dictionary which keys correspond to the Product Line names and values are dictionary of<name: description>)attributes_insured_object_type-- insured object type attributes (corresponds to insured object attributes ifis_person: false-- dictionary which keys correspond to the Insured Object Types and values are dictionary of<name: description>)ActivationSet propertyCLASSNAME_POLICYof the config object to point on the policy class to activate it within current PoLZy implementation.classConfig(object):CLASSNAME_POLICY='polzy.SamplePolicy'ExampleExample of policy definitionfrombase.policyimportPolicyclassSamplePolicy(Policy):# policy statuses with corresponded possible activitiesactivities_by_state={'active':['cancel','suspend',],'canceled':[],'suspended':['re-activate'],}# policy attribute descriptionsattributes_policy={'Policy Attribute 1':'Description of Policy Attribute 1','Policy Attribute 2':'Description of Policy Attribute 2','Policy Attribute 3':'Description of Policy Attribute 3','Policy Attribute 4':'Description of Policy Attribute 4',}# product line attribute descriptionsattributes_product_line={'Life':{'Life Attribute 1':'Description of Life Attribute 1','Life Attribute 2':'Description of Life Attribute 2','Life Attribute 3':'Description of Life Attribute 3',},'Health':{'Health Attribute 1':'Description of Health Attribute 1','Health Attribute 2':'Description of Health Attribute 2','Health Attribute 3':'Description of Health Attribute 3','Health Attribute 4':'Description of Health Attribute 4','Health Attribute 5':'Description of Health Attribute 5',},'P&C':{'P&C Attribute 1':'Description of P&C Attribute 1','P&C Attribute 2':'Description of P&C Attribute 2',},'Car':{'Car Attribute 1':'Description of Car Attribute 1',},}# insured person attribute descriptionsattributes_insured_person={'Insured Object Attribute 1':'Description of Insured Object Attribute 1','Insured Object Attribute 2':'Description of Insured Object Attribute 2','Insured Object Attribute 3':'Description of Insured Object Attribute 3',}# insured object attribute descriptionsattributes_insured_object={'Insured Object Attribute 1':'Description of Insured Object Attribute 1','Insured Object Attribute 2':'Description of Insured Object Attribute 2','Insured Object Attribute 3':'Description of Insured Object Attribute 3',}# insured object type attribute descriptionsattributes_insured_object_type={'House':{'Hause Attribute 1':'Description of House Attribute 1',},'Car':{'Car Attribute 1':'Description of Car Attribute 1','Car Attribute 2':'Description of Car Attribute 2',},'Factory':{'Factory Attribute 1':'Description of Factory Attribute 1','Factory Attribute 2':'Description of Factory Attribute 2','Factory Attribute 3':'Description of Factory Attribute 3',},'Field':{'Field Attribute 1':'Description of Field Attribute 1','Field Attribute 2':'Description of Field Attribute 2',},'Forest':{'Forest Attribute 1':'Description of Forest Attribute 1',},}# implementation attribute descriptionsattributes_implementation={'Implementation Attribute 1':'Description of Implementation Attribute 1','Implementation Attribute 2':'Description of Implementation Attribute 2',}deffetch(self):# fetch policy data from Policy Management Systemdata=policy_system.get(self.number,self.effective_date)ifdata:# reshape data if neededself.data=datareturnTruereturnFalseInitializationFirst install the dependencies and initiate the database:pipinstall-rrequirements.py
flaskdbinit
flaskdbmigrate
flaskdbupgradeBy default, PoLZy uses sqlite3 databasepolzy.dblocated in the app root folder. You may change that by setting the environmental variableDATABASE_URL.To migrate database after changing the Value Models, execute:flaskdbmigrate
flaskdbupgradeTo populate database with the sample instances, execute:pythonpopulate_db.py