Пример #1
0
    def _add_per_risk_profiles(self, add_profiles_args):
        self.logger.debug("Adding PR profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                common.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.
                    RiskAttachmentPoint,
                    limit=add_profiles_args.ri_info_row.RiskLimit,
                    placement=add_profiles_args.ri_info_row.PlacementPercent))

            nodes = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == 2)
            for node in nodes:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop)] = profile_id

            # Check ri_info row for overall OccLimit
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                common.get_occlim_profile(
                    profile_id,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                ))
            add_profiles_args.node_layer_profile_map[(
                add_profiles_args.program_node.name,
                add_profiles_args.layer_id,
                add_profiles_args.overlay_loop)] = profile_id
Пример #2
0
    def _add_fac_profiles(self, add_profiles_args):
        self.logger.debug("Adding FAC profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            common.get_reinsurance_profile(
                profile_id,
                attachment=add_profiles_args.ri_info_row.RiskAttachmentPoint,
                limit=add_profiles_args.ri_info_row.RiskLimit,
                ceded=add_profiles_args.ri_info_row.CededPercent,
                placement=add_profiles_args.ri_info_row.PlacementPercent))

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            if ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_LOCATION:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_location_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_POLICY:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_policy_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_ACCOUNT:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_account_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            else:
                raise Exception("Unsupported risk level: {}".format(
                    ri_scope_row.RiskLevel))
Пример #3
0
    def _add_cat_xl_profiles(self, add_profiles_args):
        self.logger.debug("Adding CAT XL profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        if self.risk_level == common.REINS_RISK_LEVEL_PORTFOLIO:
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                common.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.
                    OccurenceAttachmentPoint,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                    placement=add_profiles_args.ri_info_row.PlacementPercent,
                    ceded=add_profiles_args.ri_info_row.CededPercent,
                ))
            add_profiles_args.node_layer_profile_map[(
                add_profiles_args.program_node.name,
                add_profiles_args.layer_id,
                add_profiles_args.overlay_loop)] = profile_id

        else:
            nodes_all = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == 2)

            for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
                profile_id = profile_id + 1

                add_profiles_args.fmprofiles_list.append(
                    common.get_pass_through_profile(profile_id, ))

                # Filter
                if (ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_ACCOUNT
                    ) and self._is_defined(ri_scope_row.AccountNumber):
                    selected_nodes = list(
                        filter(
                            lambda n: n.account_number == ri_scope_row.
                            AccountNumber, nodes_all))
                elif ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_LOCATION and self._is_defined(
                        ri_scope_row.LocationNumber):
                    selected_nodes = list(
                        filter(
                            lambda n: n.location_number == ri_scope_row.
                            LocationNumber, nodes_all))
                elif ri_scope_row.RiskLevel == common.REINS_RISK_LEVEL_POLICY and self._is_defined(
                        ri_scope_row.PolicyNumber):
                    selected_nodes = list(
                        filter(
                            lambda n: n.policy_number == ri_scope_row.
                            PolicyNumber, nodes_all))
                else:
                    selected_nodes = nodes_all
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id

            # add OccLimit / Placed Percent
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                common.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.
                    OccurenceAttachmentPoint,
                    ceded=add_profiles_args.ri_info_row.CededPercent,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                    placement=add_profiles_args.ri_info_row.PlacementPercent,
                ))
            add_profiles_args.node_layer_profile_map[(
                add_profiles_args.program_node.name,
                add_profiles_args.layer_id,
                add_profiles_args.overlay_loop)] = profile_id