"""Validation map for rules that apply WITHIN a row of data.""" from validations import intra_row_validations as irv from constants.genres import ( CLASSICAL_PARENT_GENRES ) from constants import field_constants as fc INTRA_ROW_VALIDATION_MAP = [ { "description": "All-or-None Filled Performer 1", "validator": irv.all_or_none_filled, "fields": [ fc.PERFORMER_1_TYPE, fc.PERFORMER_1_LEGAL_NAME, fc.PERFORMER_1_MAIN_ROLE ], }, { "description": "All-or-None Filled Performer 2", "validator": irv.all_or_none_filled, "fields": [ fc.PERFORMER_2_TYPE, fc.PERFORMER_2_LEGAL_NAME, fc.PERFORMER_2_MAIN_ROLE ], }, { "description": "All-or-None Filled Performer 3", "validator": irv.all_or_none_filled, "fields": [ fc.PERFORMER_3_TYPE, fc.PERFORMER_3_LEGAL_NAME, fc.PERFORMER_3_MAIN_ROLE ], }, { "description": "All-or-None Filled Performer 4", "validator": irv.all_or_none_filled, "fields": [ fc.PERFORMER_4_TYPE, fc.PERFORMER_4_LEGAL_NAME, fc.PERFORMER_4_MAIN_ROLE ], }, { "description": "All-or-None Filled Performer 5", "validator": irv.all_or_none_filled, "fields": [ fc.PERFORMER_5_TYPE, fc.PERFORMER_5_LEGAL_NAME, fc.PERFORMER_5_MAIN_ROLE ], }, { "description": "Orchestral Track Artist(s) Filled", "validator": irv.conditional_filled, "conditional_field": fc.GENRE, "trigger_values": CLASSICAL_PARENT_GENRES, "dependent_fields": [ fc.TRACK_ARTISTS_COMPOSERS, fc.TRACK_ARTISTS_CONDUCTORS, fc.TRACK_ARTISTS_ORCHESTRAS, fc.TRACK_ARTISTS_ENSEMBLES, ], }, { "description": "Orchestral Release Artist(s) Filled", "validator": irv.conditional_filled, "conditional_field": fc.GENRE, "trigger_values": CLASSICAL_PARENT_GENRES, "dependent_fields": [ fc.RELEASE_ARTISTS_COMPOSERS, fc.RELEASE_ARTISTS_CONDUCTORS, fc.RELEASE_ARTISTS_ORCHESTRAS, fc.RELEASE_ARTISTS_ENSEMBLES, ], }, { "description": "iTunes Preorder Yes Requires Date", "validator": irv.conditional_filled, "conditional_field": fc.ITUNES_PREORDER, "trigger_values": ['Pre-order'], "dependent_fields": [ fc.ITUNES_PREORDER_DATE, fc.PREORDER_PREVIEW, ], }, { "description": "At Least One Primary Performer Exists", "validator": irv.at_least_one_exists, "fields": [ fc.PERFORMER_1_TYPE, fc.PERFORMER_2_TYPE, fc.PERFORMER_3_TYPE, fc.PERFORMER_4_TYPE, fc.PERFORMER_5_TYPE ], "required_values": [ fc.PRIMARY_PERFORMER_TYPE ], }, { "description": "Release Date is Before or on Sale Start Date", "validator": irv.valid_date_range, "start_date_field": fc.RELEASE_DATE, "end_date_field": fc.SALE_START_DATE, }, { "description": "Check that Subgenre is Valid to Genre", "validator": irv.validate_subgenre_to_genre, "genre_field": fc.GENRE, "subgenre_field": fc.SUB_GENRE, }, { "description": "If Filled Ownership for Sound Recording", "validator": irv.conditional_filled, "conditional_field": fc.OWNERSHIP_FOR_THIS_SOUND_RECORDING, "trigger_values": fc.OWNERSHIP_TYPES, "dependent_fields": [ fc.COUNTRY_OF_RECORDING, fc.NATIONALITY_OF_ORIGINAL_COPYRIGHT_OWNER, ] }, { "description": "If Blank Ownership for Sound Recording", "validator": irv.conditional_blank_list, "conditional_field": fc.OWNERSHIP_FOR_THIS_SOUND_RECORDING, "trigger_values": [], "dependent_fields": [ fc.COUNTRY_OF_RECORDING, fc.NATIONALITY_OF_ORIGINAL_COPYRIGHT_OWNER, ] } ]