complex_model/HailAUSKeysLookup.py
def _post_validate(self, uni_exposure: dict, record):
        """This validates the uni_exposure as per the Multi-Peril Workbench specification
                1. we ignore a location that has no postcode if the peril is Hail
                2. we ignore location that has not geographical specification (address, lat/lon, cresta, ica_zone)

        :param uni_exposure:
        :return: validated uni_exposure
        """
        # incomplete or missing geo-location field should fail
        if not (
                (uni_exposure['latitude'] and uni_exposure['longitude']) or
                self.is_valid_address(uni_exposure['address_id'], uni_exposure['address_type']) or
                uni_exposure['med_id'] or
                uni_exposure['zone_id'] or
                uni_exposure['lrg_id']
        ):
            raise LocationLookupException("A location must have at least a valid Cresta, Ica Zone, Postalcode, Lat/Lon "
                                          "or address id (GNAF ID)", error_code=110)

        # Residential with BI coverage should fail
        if (uni_exposure['lob_id'] == EnumLineOfBusiness.Residential.value and
                uni_exposure['cover_id'] == EnumCover.BI.value):
            raise LocationLookupException("Business Interruption losses are not currently modelled for Residential "
                                          "line of business", error_code=151)

        # Motor construction code but cover is not Motor should fail
        if self._is_motor(record) and uni_exposure['cover_id'] in (EnumCover.Building.value, EnumCover.Contents.value,
                                                                   EnumCover.BI.value):
            raise LocationLookupException("If row has a motor construction code (between 5850 and 5950) then it cannot "
                                          "have cover other than Motor (TIV stored in OtherTIV)", error_code=210)

        return uni_exposure
This validates the uni_exposure as per the Multi-Peril Workbench specification
                1. we ignore a location that has no postcode if the peril is Hail
                2. we ignore location that has not geographical specification (address, lat/lon, cresta, ica_zone)

        :param uni_exposure:
        :return: validated uni_exposure
        
This validates the uni_exposure as per the Multi-Peril Workbench specification
1. we ignore a location that has no postcode if the peril is Hail
2. we ignore location that has not geographical specification (address, lat/lon, cresta, ica_zone)
This validates the uni_exposure as per the Multi - Peril Workbench specification 1 . we ignore a location that has no postcode if the peril is Hail 2 . we ignore location that has not geographical specification ( address lat / lon cresta ica_zone )
def _post_validate(self, uni_exposure: dict, record):
        if not (
                (uni_exposure['latitude'] and uni_exposure['longitude']) or
                self.is_valid_address(uni_exposure['address_id'], uni_exposure['address_type']) or
                uni_exposure['med_id'] or
                uni_exposure['zone_id'] or
                uni_exposure['lrg_id']
        ):
            raise LocationLookupException("A location must have at least a valid Cresta, Ica Zone, Postalcode, Lat/Lon "
                                          "or address id (GNAF ID)", error_code=110)
        if (uni_exposure['lob_id'] == EnumLineOfBusiness.Residential.value and
                uni_exposure['cover_id'] == EnumCover.BI.value):
            raise LocationLookupException("Business Interruption losses are not currently modelled for Residential "
                                          "line of business", error_code=151)
        if self._is_motor(record) and uni_exposure['cover_id'] in (EnumCover.Building.value, EnumCover.Contents.value,
                                                                   EnumCover.BI.value):
            raise LocationLookupException("If row has a motor construction code (between 5850 and 5950) then it cannot "
                                          "have cover other than Motor (TIV stored in OtherTIV)", error_code=210)
        return uni_exposure
def _post_validate ( self , uni_exposure : dict , record ) : if not ( ( uni_exposure [ 'latitude' ] and uni_exposure [ 'longitude' ] ) or self . is_valid_address ( uni_exposure [ 'address_id' ] , uni_exposure [ 'address_type' ] ) or uni_exposure [ 'med_id' ] or uni_exposure [ 'zone_id' ] or uni_exposure [ 'lrg_id' ] ) : raise LocationLookupException ( "A location must have at least a valid Cresta, Ica Zone, Postalcode, Lat/Lon " "or address id (GNAF ID)" , error_code = 110 ) if ( uni_exposure [ 'lob_id' ] == EnumLineOfBusiness . Residential . value and uni_exposure [ 'cover_id' ] == EnumCover . BI . value ) : raise LocationLookupException ( "Business Interruption losses are not currently modelled for Residential " "line of business" , error_code = 151 ) if self . _is_motor ( record ) and uni_exposure [ 'cover_id' ] in ( EnumCover . Building . value , EnumCover . Contents . value , EnumCover . BI . value ) : raise LocationLookupException ( "If row has a motor construction code (between 5850 and 5950) then it cannot " "have cover other than Motor (TIV stored in OtherTIV)" , error_code = 210 ) return uni_exposure
This validates the uni_exposure as per the Multi-Peril Workbench specification
1. we ignore a location that has no postcode if the peril is Hail
2. we ignore location that has not geographical specification (address, lat/lon, cresta, ica_zone)
This validates the uni_exposure as per the Multi - Peril Workbench specification 1 . we ignore a location that has no postcode if the peril is Hail 2 . we ignore location that has not geographical specification ( address lat / lon cresta ica_zone )
"""This validates the uni_exposure as per the Multi-Peril Workbench specification
                1. we ignore a location that has no postcode if the peril is Hail
                2. we ignore location that has not geographical specification (address, lat/lon, cresta, ica_zone)

        :param uni_exposure:
        :return: validated uni_exposure
        """ # incomplete or missing geo-location field should fail # Residential with BI coverage should fail # Motor construction code but cover is not Motor should fail
None
self
uni_exposure
dict
None
record