from apollo_utils.core.constants.dsp import DSP from server.constants.charts import ChartBreakdown, ChartType def get_chart_id( country_code: str, chart_type: ChartType or str = ChartType.REGIONAL, chart_breakdown: ChartBreakdown or str = ChartBreakdown.DAILY, dsp: DSP = DSP.SPOTIFY, ): """Build chart ID. Args: country_code: Market code. chart_breakdown: Daily or weekly. chart_type: Regional or viral. dsp: DSP. Returns: Chart ID. """ if dsp == DSP.APPLE.value or (not isinstance(dsp, str) and dsp.value == DSP.APPLE.value): chart_type = "charts" elif not isinstance(chart_type, str): chart_type = chart_type.value if not isinstance(chart_breakdown, str): chart_breakdown = chart_breakdown.value return f"{chart_type}_{chart_breakdown}_{country_code}"