version: 2

models:

  - name: STREAMS_DEMOGRAPHICS_BY_TRACK_COUNTRY_FEED_DISTRIBUTOR_DAILY_HISTORY_DBT
    description:
      A table containing number of streams per age and gender on a country / feed level.
      The age streaming numbers will not be entirely accurate for apple, see
      https://orcd.slack.com/archives/CNXRJ1NCD/p1576583179044600 for further information
    config:
      tags: history
    tests:
      - unique:
          column_name: "concat(track_id, '-',  country_code, '-',  download_activity_date, '-',  feed_id, '-',  distributor)"
    columns:
      - name: distributor
        tests:
          - not_null
      - name: track_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: download_activity_date
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: product_id
        tests:
          - not_null
      - name: isrc
        tests:
          - not_null
      - name: streams
        tests:
          - not_null
      - name: age_group_under_18
        description: amount of streams coming from people aged 0 - 17
        tests:
          - not_null
      - name: age_group_18_22
        description: amount of streams coming from people aged 18 - 22
        tests:
          - not_null
      - name: age_group_23_27
        description: amount of streams coming from people aged 23 - 27
        tests:
          - not_null
      - name: age_group_28_34
        description: amount of streams coming from people aged 28 - 34
        tests:
          - not_null
      - name: age_group_35_44
        description: amount of streams coming from people aged 35 - 44
        tests:
          - not_null
      - name: age_group_45_59
        description: amount of streams coming from people aged 45 - 59
        tests:
          - not_null
      - name: age_group_60_plus
        description: amount of streams coming from people aged 60 and above
        tests:
          - not_null
      - name: age_group_unknown
        description: amount of streams coming from people we don't have age information for
        tests:
          - not_null
      - name: male
        description: amount of streams coming from male listeners
        tests:
          - not_null
      - name: female
        description: amount of streams coming from female
        tests:
          - not_null
      - name: unknown_gender
        description: amount of streams coming from people we don't have gender information for
        tests:
          - not_null

  - name: STREAMS_DEMOGRAPHICS_BY_TRACK_COUNTRY_FEED_DISTRIBUTOR_DAILY_RECENT_DBT
    description:
      A table containing number of streams per age and gender on a country / feed level.
      The age streaming numbers will not be entirely accurate for apple, see
      https://orcd.slack.com/archives/CNXRJ1NCD/p1576583179044600 for further information
    tests:
      - unique:
          column_name: "concat(track_id, '-',  country_code, '-',  download_activity_date, '-',  feed_id, '-',  distributor)"
    columns:
      - name: distributor
        tests:
          - not_null
      - name: track_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: download_activity_date
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: product_id
        tests:
          - not_null
      - name: isrc
        tests:
          - not_null
      - name: streams
        tests:
          - not_null
      - name: age_group_under_18
        description: amount of streams coming from people aged 0 - 17
        tests:
          - not_null
      - name: age_group_18_22
        description: amount of streams coming from people aged 18 - 22
        tests:
          - not_null
      - name: age_group_23_27
        description: amount of streams coming from people aged 23 - 27
        tests:
          - not_null
      - name: age_group_28_34
        description: amount of streams coming from people aged 28 - 34
        tests:
          - not_null
      - name: age_group_35_44
        description: amount of streams coming from people aged 35 - 44
        tests:
          - not_null
      - name: age_group_45_59
        description: amount of streams coming from people aged 45 - 59
        tests:
          - not_null
      - name: age_group_60_plus
        description: amount of streams coming from people aged 60 and above
        tests:
          - not_null
      - name: age_group_unknown
        description: amount of streams coming from people we don't have age information for
        tests:
          - not_null
      - name: male
        description: amount of streams coming from male listeners
        tests:
          - not_null
      - name: female
        description: amount of streams coming from female
        tests:
          - not_null
      - name: unknown_gender
        description: amount of streams coming from people we don't have gender information for
        tests:
          - not_null
