version: 2

models:
  - name: int_agg_user_platform_daily_spine_base
    description: Base daily aggregation of user platform spine.
    config:
      group: agg
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-06-01
          end_offset: 0
        partition_mappings:
          - asset_key: ['prod_int', 'int_user_platform_date_spine']
            type: identity
          - asset_key: ['PROD', 'dim_clip']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['PROD', 'agg_play_info_hourly_v2']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['segment_events', 'web_audio_actions']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['segment_events', 'app_audio_actions']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['prod_stg', 'stg_backend_events__clip_like_undolike']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['prod_stg', 'stg_backend_events__clip_play']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['prod_int', 'int_user_follower_counts_daily']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['prod_int', 'int_agg_user_hook_platform_daily_spine_base']
            type: time_window
            allow_nonexistent_upstream_partitions: True
          - asset_key: ['prod_marts', 'active_users_daily']
            type: time_window
            allow_nonexistent_upstream_partitions: True
        automation_condition: agg_user_daily_cron
        backfill_policy:
          max_partitions_per_run: 28
    columns:
      - name: user_id
        description: User ID
      - name: user_uid
        description: User UID
      - name: subscription_tier
        description: User's subscription tier
      - name: platform
        description: Platform where activity occurred
      - name: clip_total_count
        description: Total clips created on this platform this day
      - name: gen_clip_total_count
        description: Total gen clips created on this platform this day
      - name: play_count
        description: Total number of play sessions on this platform this day
      - name: play_duration_seconds
        description: Total play duration in seconds on this platform this day
      - name: unique_play_duration_seconds
        description: Total unique play duration in seconds on this platform this day
      - name: play_breakdown
        description: JSON breakdown of play metrics by song ownership
      - name: hook_create_count
        description: Total hooks created on this platform this day
      - name: hook_play_count
        description: Total hook play sessions on this platform this day
      - name: hook_play_duration_seconds
        description: Total hook play duration in seconds on this platform this day
      - name: hook_unique_play_duration_seconds
        description: Total unique hook play duration in seconds on this platform this day
      - name: hook_play_breakdown
        description: JSON breakdown of hook play metrics by song ownership
      - name: is_high_intent_listening
        description: JSON object with high intent listening flags by version (v1, v2) on this day.
      - name: high_intent_listening_breakdown
        description: JSON breakdown of high intent listening by version, with v2 including own/others breakdown
      - name: is_active
        description: Whether user had any activity on this platform this day
      - name: engagement_flags
        description: JSON object with all engagement flags (clip_create, clip_listen, hook_create, hook_listen, etc.)
      - name: total_following_cnt
        description: Total count of users this user is following (platform-agnostic)
      - name: total_follower_cnt
        description: Total count of users following this user (platform-agnostic)
      - name: net_likes_received_count
        description: Net likes received on user's content on this platform this day
      - name: p_date
        description: Date partition
      - name: days_since_user_joined
        description: Number of days since the user joined
