""" These constants are mappings of the row key segment variations for Bigtable row keys """ from delphi_api.v3.enums import RowKeyAgg, RowKeyPrefix ARTIST_STREAMS = { RowKeyPrefix.artist_date.value: ['artist_id', 'date'], RowKeyPrefix.artist_date_track.value: ['artist_id', 'date', 'track_id'], RowKeyPrefix.artist_isrc_date.value: ['artist_id', 'isrc', 'date'], RowKeyPrefix.artist_playlist_date.value: ['artist_id', 'playlist_id', 'date'], RowKeyPrefix.artist_track_date.value: ['artist_id', 'track_id', 'date'], } TRACK_STREAMS = { RowKeyPrefix.isrc_date.value: ['isrc', 'date'], RowKeyPrefix.isrc_date_playlist.value: ['isrc', 'date', 'playlist_id'], RowKeyPrefix.track_artist_date.value: ['track_id', 'artist_id', 'date'], RowKeyPrefix.track_date.value: ['track_id', 'date'], RowKeyPrefix.track_date_playlist.value: ['track_id', 'date', 'playlist_id'], } CHART_ROW_KEYS = { RowKeyPrefix.chart_date_isrc.value: ['chart_id', 'date', 'isrc'], RowKeyPrefix.chart_isrc_date.value: ['chart_id', 'isrc', 'date'], RowKeyPrefix.dsp_date_isrc_chart.value: ['dsp', 'date', 'isrc', 'chart_id'], RowKeyPrefix.dsp_isrc_date_chart.value: ['dsp', 'isrc', 'date', 'chart_id'], RowKeyPrefix.isrc_chart_date.value: ['isrc', 'chart_id', 'date'], RowKeyPrefix.isrc_date_chart.value: ['isrc', 'date', 'chart_id'], } PLAYLIST_ROW_KEYS = { RowKeyPrefix.dsp_isrc_date_playlist.value: ['dsp', 'isrc', 'date', 'playlist_id'], RowKeyPrefix.playlist_date_isrc.value: ['playlist_id', 'date', 'isrc'], RowKeyPrefix.playlist_date.value: ['playlist_id', 'date'], RowKeyPrefix.playlist_isrc_date.value: ['playlist_id', 'isrc', 'date'], RowKeyPrefix.playlist_track_date.value: ['playlist_id', 'track_id', 'date'], RowKeyPrefix.isrc_playlist_date.value: ['isrc', 'playlist_id', 'date'], RowKeyPrefix.isrc_date_playlist.value: ['isrc', 'date', 'playlist_id'], } PRODUCT_STREAMS = { RowKeyPrefix.product_date.value: ['product_id', 'date'], } CHARTMETRIC_ROW_KEYS = { RowKeyPrefix.artist.value: ['artist_id', 'date', 'dsp'] } STREAMS_ROW_KEYS = { **ARTIST_STREAMS, **PLAYLIST_ROW_KEYS, **PRODUCT_STREAMS, **TRACK_STREAMS, } AGG_FORMATS = { RowKeyAgg.DAY14: 'yyyy-mm-dd', RowKeyAgg.DAY28: 'yyyy-mm-dd', RowKeyAgg.DAY7: 'yyyy-mm-dd', RowKeyAgg.ALLTIME: 'yyyy-mm-dd', RowKeyAgg.DAY: 'yyyy-mm-dd', RowKeyAgg.MONTH: 'yyyy-mm', RowKeyAgg.YEAR: 'yyyy', }