def validate(rows): for row in rows: verify_row_count(row, FIELDS, 1) verify_row_count(row, OPTIONAL_FIELDS, 1, is_required=False) verify_same_row_count(row, TABLE_FIELDS) verify_row_values(row, 'SugMisparZihuy', SUG_MISPAR_ZIHUY_MAPPING) yield row
def validate(rows): for row in rows: doc = row['document'] num_records = len(doc.get(TABLE_FIELDS[0], [])) verify_row_count(row, FIELDS, 1) verify_row_count(row, OPTIONAL_FIELDS, 1, is_required=False) verify_row_count(row, ADDITIONAL_FIELDS, 1, is_required=False) verify_row_count(row, TABLE_FIELDS, num_records) verify_row_count(row, OPTIONAL_TABLE_FIELDS, num_records, is_required=False) verify_row_values(row, 'IsNostroAccountOfBankOrInsuranceCompany', YES_NO_VALUES) verify_row_values(row, 'EntityType', ENTITY_TYPES) yield row
def validate(rows): for row in rows: verify_row_count(row, FIELDS, 1) verify_row_values( row, 'IsIsraeli', {'אדם פרטי ללא אזרחות ישראלית', 'אדם פרטי עם אזרחות ישראלית'}) verify_row_values(row, 'IsBothDirectorAndCeoOrRelativeOfCeo', {'_________', 'כן', 'לא'}) verify_row_values(row, 'EmployedAtAnotherJobConnectedToTheCompany', {'אינו ממלא', 'ממלא'}) verify_row_values(row, 'RelativeOfAnotherVip', RELATIVE_OF_ANOTHER_VIP_MAPPING) verify_row_values(row, 'HasStocksInTheCompany', HAS_STOCKS_IN_THE_COMPANY_MAPPING) verify_row_values(row, 'HasStocksInSubsidiaryOrConnectedCompany', {'_________', 'אינו מחזיק', 'מחזיק'}) verify_row_values(row, 'SugMisparZihuy', SUG_MISPAR_ZIHUY_MAPPING) yield row
def validate(rows): for row in rows: doc = row['document'] num_records = len(doc.get(TABLE_FIELDS[0], [])) verify_row_count(row, FIELDS, 1) verify_row_count(row, TABLE_FIELDS, num_records) verify_row_count(row, OPTIONAL_TABLE_FIELDS, num_records, is_required=False) verify_row_values(row, 'IsHeldBySubsidiary', HOLDER_TYPE_MAPPING) verify_row_values(row, 'Subsidiary_IDType', ID_TYPE_MAPPING) yield row
def validate(rows): for row in rows: doc = row['document'] url = row['url'] verify_row_count(row, FIELDS, 1) verify_row_count(row, OPTIONAL_FIELDS, 1, is_required=False) num_stakeholders = len(doc.get('FullName', [])) verify_row_count(row, TABLE_FIELDS, num_stakeholders) verify_row_count(row, OPTIONAL_TABLE_FIELDS, num_stakeholders, is_required=False) verify_same_row_count(row, CORE_STAKE_HOLDER_FIELDS.keys()) num_core_stake_holders = len( doc.get(first(CORE_STAKE_HOLDER_FIELDS.keys()), [])) verify_same_row_count(row, OFFICER_STAKE_HOLDER_FIELDS.keys()) num_officer_stake_holders = len( doc.get(first(OFFICER_STAKE_HOLDER_FIELDS.keys()), [])) is_empty_officer_list = num_officer_stake_holders == 1 and not doc[ 'ShemVeSugNiarErechBaelyEnyan'][0].replace('_', '').replace( '-', '').strip() if is_empty_officer_list and (num_stakeholders != num_core_stake_holders): raise Exception( "Documnet {} failed Validation. Expected the core list {} to match stakeholder count {}" .format(url, num_stakeholders, num_core_stake_holders)) elif not is_empty_officer_list and ( num_stakeholders != num_core_stake_holders + num_officer_stake_holders): raise Exception( "Documnet {} failed Validation. Expected the core list {} to match stakeholder count + officer count: {} + {}" .format(url, num_stakeholders, num_core_stake_holders, num_officer_stake_holders)) yield row
def validate(rows): for row in rows: verify_row_count(row, FIELDS, 1) verify_row_count(row, OPTIONAL_FIELDS, 1, is_required=False) verify_same_row_count(row, TABLE_FIELDS) yield row