version: 2
models:
  - name: FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: FANS_SHARE
        description: Share of fans who have the artist on heavy rotation
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= 0'
  - name: FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_COUNTRY_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_COUNTRY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
            - COUNTRY_ISO2
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Nr of fans used for aggregation
        data_tests:
          - not_null
      - name: TOTAL_FANS_COUNT
        description: Total number of fans for country
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= FANS_COUNT'
      - name: FANS_SHARE
        description: Share of fans
        data_tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_between:
              min_value: 0
              max_value: 1
  - name: FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_ACCOUNT_DBT
    description: '{{ doc("FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_ACCOUNT_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: AVAILABLE_FANS_SHARE
        description: Share of fans used for aggregation
        data_tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_between:
              min_value: 0
              max_value: 1
  - name: FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_ACCOUNT_COUNTRY_DBT
    description: '{{ doc("FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_ACCOUNT_COUNTRY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
            - COUNTRY_ISO2
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: AVAILABLE_FANS_COUNT
        description: Nr of fans used for aggregation
        data_tests:
          - not_null
      - name: TOTAL_FANS_COUNT
        description: Number of total fans for country
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= AVAILABLE_FANS_COUNT'
  - name: FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_DAILY_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_DAILY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
            - REPORT_DATE
            - HEAVY_ROTATION
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: REPORT_DATE
        description: Date representing the aggregations
        data_tests:
          - not_null
      - name: HEAVY_ROTATION
        description: Type of aggregation
        data_tests:
          - not_null
          - accepted_values:
              values: [ 'UNKNOWN',
                        'NOT_IN',
                        'IN' ]
      - name: DAILY_RUNNING_TOTAL_FANS_COUNT
        description: Nr of fans per date
        data_tests:
          - not_null
          - fans_count_equal_to_source_daily:
              value_column: "HEAVY_ROTATION"
  - name: FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_COUNTRY_DAILY_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_HEAVY_ROTATION_COUNTRY_DAILY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
            - REPORT_DATE
            - COUNTRY_ISO2
            - HEAVY_ROTATION
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: REPORT_DATE
        description: Date representing the aggregations
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: HEAVY_ROTATION
        description: Type of aggregation
        data_tests:
          - not_null
          - accepted_values:
              values: [ 'UNKNOWN',
                        'NOT_IN',
                        'IN' ]
      - name: DAILY_RUNNING_TOTAL_FANS_COUNT
        description: Nr of fans per date
        data_tests:
          - not_null
          - fans_count_equal_to_source_country_daily:
              value_column: "HEAVY_ROTATION"
  - name: GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_COUNTRY_DAILY_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_COUNTRY_DAILY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - REPORT_DATE
            - COUNTRY_ISO2
            - HEAVY_ROTATION
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: REPORT_DATE
        description: Date representing the aggregations
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: HEAVY_ROTATION
        description: Type of aggregation
        data_tests:
          - not_null
          - accepted_values:
              values: [ 'UNKNOWN',
                        'NOT_IN',
                        'IN' ]
      - name: DAILY_RUNNING_TOTAL_FANS_COUNT
        description: Nr of fans per date
        data_tests:
          - not_null
          - global_fans_count_equal_to_source_country_daily:
              value_column: "HEAVY_ROTATION"
  - name: GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_COUNTRY_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_COUNTRY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - COUNTRY_ISO2
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Nr of fans used for aggregation
        data_tests:
          - not_null
      - name: TOTAL_FANS_COUNT
        description: Total number of fans for country
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= FANS_COUNT'
      - name: FANS_SHARE
        description: Share of fans
        data_tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_between:
              min_value: 0
              max_value: 1
  - name: GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_DAILY_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_DAILY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - REPORT_DATE
            - HEAVY_ROTATION
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: REPORT_DATE
        description: Date representing the aggregations
        data_tests:
          - not_null
      - name: HEAVY_ROTATION
        description: Type of aggregation
        data_tests:
          - not_null
          - accepted_values:
              values: [ 'UNKNOWN',
                        'NOT_IN',
                        'IN' ]
      - name: DAILY_RUNNING_TOTAL_FANS_COUNT
        description: Nr of fans per date
        data_tests:
          - not_null
          - global_fans_count_equal_to_source_daily:
              value_column: "HEAVY_ROTATION"
  - name: GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_HEAVY_ROTATION_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: FANS_SHARE
        description: Share of fans who have the artist on heavy rotation
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= 0'
  - name: GLOBAL_FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_DBT
    description: '{{ doc("GLOBAL_FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: AVAILABLE_FANS_SHARE
        description: Share of fans used for aggregation
        data_tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_between:
              min_value: 0
              max_value: 1
  - name: GLOBAL_FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_COUNTRY_DBT
    description: '{{ doc("GLOBAL_FANS_PRESENCE_HEAVY_ROTATION_BY_ARTIST_COUNTRY_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - COUNTRY_ISO2
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Country code in ISO2 format
        data_tests:
          - not_null
      - name: AVAILABLE_FANS_COUNT
        description: Nr of fans used for aggregation
        data_tests:
          - not_null
      - name: TOTAL_FANS_COUNT
        description: Number of total fans for country
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '>= AVAILABLE_FANS_COUNT'
