"""Config for iTunes Marketshare Workflow.""" import os feed_name = 'itunes_marketshare' secrets_path = 'itunes_marketshare' feed_version = '1.0' s3_feed_name = 'iTunesMarketshare' expected_bucket_owner = os.environ.get('EXPECTED_BUCKET_OWNER', '437795906767') storeid = 1 # environment to run in environment = os.environ.get('ENVIRONMENT', 'dev') # bucket for archived data data_bucket = os.environ.get('FEED_INGESTION_DATA_BUCKET', 'dev-cucumbers') # bucket for dropped data drop_bucket = os.environ.get( 'FEED_INGESTION_DROP_BUCKET', 'dev-feed-drop') itunes_reports = ( ('ORCHARD', 'AppleMusicSummary'), ('IODA', 'AppleMusicSummary'), ('BFM_ORCHARD', 'AppleMusicSummary'), ('BFM_IODA', 'AppleMusicSummary'), ('FINETUNES', 'AppleMusicSummary'), ('RELAPSE', 'AppleMusicSummary'), ('PRIDDIS', 'AppleMusicSummary'), ('RDA', 'AppleMusicSummary'), ('IRIS', 'AppleMusicSummary'), ('PHONOFILE', 'AppleMusicSummary'), ('DKUA', 'AppleMusicSummary'), ('AWAL', 'AppleMusicSummary'), ('ARTSPAGES', 'AppleMusicSummary') ) # S3 locations for dropped and archived files s3 = { 'archive': ( 's3://{data_bucket}/{feed_name}/archives/{{date:%Y-%m}}/'.format( data_bucket=data_bucket, feed_name=s3_feed_name)), 'preprocessed': ( 's3://{data_bucket}/{feed_name}/preprocessed/'.format( data_bucket=data_bucket, feed_name=s3_feed_name)), 'preprocessed_filename': 'itunes_mkt_share_{date:%Y-%m-%d}.tsv.gz' } file_pattern = '.+S2.+' snowflake_table_names = { 'staging_raw': 'staging_raw_itunes_market_share', 'currency_db': 'orchard_app_reporting_v2', 'currency_schema': 'art_relations_prod_art_relations' } available_countries = { 'default': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'AG', 'AI', 'AR', 'BB', 'BM', 'BO', 'BS', 'BZ', 'CR', 'DM', 'DO', 'EC', 'GD', 'GT', 'GY', 'HN', 'JM', 'KN', 'KY', 'LC', 'MS', 'NI', 'PA', 'PY', 'SR', 'SV', 'TT', 'UY', 'VC' ], 'ORCHARD': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'TZ', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'IODA': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'TZ', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'BFM_ORCHARD': [ 'CN', 'HK', 'ID', 'IN', 'KR', 'MY', 'PH', 'SG', 'TH', 'TW', 'VN', 'WW', 'ZZ'], 'BFM_IODA': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HR', 'HU', 'IL', 'JP', 'KZ', 'LL', 'MX', 'NG', 'NO', 'NZ', 'PE', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'TR', 'TZ', 'US', 'WW', 'ZA', 'ZZ'], 'FINETUNES': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'PRIDDIS': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'RELAPSE': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'RDA': [ 'AE', 'AU', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'IRIS': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'TZ', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'PHONOFILE': [ 'AE', 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EG', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'QA', 'RO', 'RU', 'SA', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'], 'DKUA': [ 'AU', 'BG', 'BR', 'CA', 'CH', 'CL', 'CN', 'CO', 'CZ', 'DK', 'EU', 'GB', 'HK', 'HR', 'HU', 'ID', 'IL', 'IN', 'JP', 'KR', 'KZ', 'LL', 'MX', 'MY', 'NG', 'NO', 'NZ', 'PE', 'PH', 'PL', 'RO', 'RU', 'SE', 'SG', 'TH', 'TR', 'TW', 'US', 'VN', 'WW', 'ZA', 'ZZ'] } # field names for processed file fieldnames = { '2023-08-01': [ 'country', 'currency', 'distributor', 'Divisor', 'end_date', 'filename', 'Label Market Share', 'Label Non Spatial Available Royalty Bearing Plays', 'Label Paid Subscriber Royalty Bearing Plays', 'Label Proportionate Share', 'Label Royalty Bearing Broadcast Plays', 'Label Spatial Available Royalty Bearing Plays', 'Non Spatial Available Per Play Royalty', 'Paid Subscriber Market Share', 'Per Play Amount', 'Per Play Rate', 'Per Subscriber Daily Minimum', 'Per Subscriber Minimum Amount', 'Per Subscription Daily Minimum', 'Percentage of Revenue', 'product', 'Revenue', 'Revenue per Thousand Listener Hour', 'Revenue per Thousand Listener Hours Guarantee', 'Revenue Share Amount', 'Revenue Share Royalty Amount', 'Royalty Amount', 'RPM Amount', 'Spatial Available Factor', 'Spatial Available Per Play Royalty', 'start_date', 'Subscription Minima Royalty Amount', 'Total Listener Hours', 'Total Non Spatial Available Royalty Bearing Plays', 'Total Paid Subscriber Royalty Bearing Plays', 'Total Royalty Bearing Broadcast Plays', 'Total Royalty Bearing Plays', 'Total Spatial Available Royalty Bearing Plays', 'Total Subscriber Days', 'Trial Royalty Pool', 'Trial Share Royalty Amount', 'is_trial', 'is_adsup', 'is_multiuser', 'is_bundle', 'Label Paid Subscriber Spatial Royalty Bearing Plays', 'Label Paid Subscriber Non Spatial Royalty Bearing Plays', 'Effective Per Play Rate', ], # fieldname before 2023-08-01 'default': [ 'country', 'currency', 'distributor', 'Divisor', 'Effective Per Play Rate', 'end_date', 'filename', 'Label Market Share', 'Label Paid Subscriber Royalty Bearing Plays', 'Label Proportionate Share', 'Label Royalty Bearing Broadcast Plays', 'Label Royalty Bearing Plays', 'Paid Subscriber Market Share', 'Per Play Amount', 'Per Play Rate', 'Per Subscriber Daily Minimum', 'Per Subscriber Minimum Amount', 'Per Subscription Daily Minimum', 'Percentage of Revenue', 'product', 'RPM Amount', 'Revenue', 'Revenue Share Amount', 'Revenue Share Royalty Amount', 'Revenue per Thousand Listener Hour', 'Revenue per Thousand Listener Hours Guarantee', 'Royalty Amount', 'start_date', 'Subscription Minima Royalty Amount', 'Total Listener Hours', 'Total Paid Subscriber Royalty Bearing Plays', 'Total Royalty Bearing Broadcast Plays', 'Total Royalty Bearing Plays', 'Total Subscriber Days', 'Trial Royalty Pool', 'Trial Share Royalty Amount', 'is_trial', 'is_adsup', 'is_multiuser', 'is_bundle', 'Eligible Account Discount Rate', 'Royalty Subtotal' ] }