version: 2

models:
  - name: clip_engagement_features
    description: "Mart model that aggregates all engagement signals (plays, likes, shares, pins, etc.) into a comprehensive feature set for each clip. This model serves as a foundational layer for downstream recommendation and analytics tasks."
    config:
      group: recommendations
      tags: ["cadence=daily", "dbt"]
    columns:
      - name: clip_id
        description: "Unique identifier for the clip"
      - name: clip_creator_user_id
        description: "ID of the user who created the clip"
      - name: first_play_start_ts_utc
        description: "Timestamp of the very first play of this clip by any user"
      - name: last_play_start_ts_utc
        description: "Timestamp of the most recent play of this clip by any user"
      - name: last_engagement_timestamp
        description: "The latest timestamp from any engagement event (play, like, share, pin, etc.) for this clip. Used for incremental processing."
      - name: n_creator_likes
        description: "Number of likes the creator has given their own clip"
      - name: n_creator_verified_likes
        description: "Number of likes from the creator where they listened for at least 5 seconds"
      - name: creator_net_pin_clip
        description: "Net pin action from the creator on their own clip (1 for pinned, 0 for not)"
      - name: n_creator_shares
        description: "Number of times the creator has shared their own clip"
      - name: did_owner_add_to_playlist
        description: "Boolean indicating if the creator has added their own clip to a playlist"
      - name: n_playlists_added_by_owner
        description: "Number of unique playlists the creator has added their clip to"
      - name: n_non_creator_likes
        description: "Number of likes from users other than the creator"
      - name: n_non_creator_verified_likes
        description: "Number of likes from non-creators where they listened for at least 5 seconds"
      - name: n_non_creator_shares
        description: "Number of shares from users other than the creator"
      - name: n_unique_non_creator_users_shared
        description: "Number of unique non-creator users who have shared this clip"
      - name: n_non_creator_added_to_playlist
        description: "Number of non-creator users who have added this clip to a playlist"
      - name: n_playlists_added_by_non_owner
        description: "Number of unique playlists this clip has been added to by non-creators"
  - name: public_clip_static_features
    description: "Mart model for public clip static features used in recommendation systems"
    config:
      group: recommendations
      tags: ["cadence=daily", "dbt"]
    columns:
      # Base clip data from dim_clip
      - name: clip_id
        description: "Unique identifier for the clip"
      - name: p_date
        description: "Partition date for the clip"
      - name: p_hour
        description: "Partition hour for the clip"
      - name: created_at
        description: "Timestamp when the clip was created"
      - name: user_id
        description: "ID of the user who created the clip"
      - name: request_id
        description: "Unique request identifier"
      - name: s3_id
        description: "S3 identifier for the clip file"
      - name: platform
        description: "Platform where the clip was created"
      - name: display_index
        description: "Display order index for the clip"
      - name: initial_title
        description: "Initial title of the clip"
      - name: time_used_sec
        description: "Time used in seconds for clip generation"
      - name: type
        description: "Type of clip generation"
      - name: task
        description: "Specific task performed for the clip"
      - name: priority
        description: "Priority level of the clip request"
      - name: duration_sec
        description: "Duration of the clip in seconds"
      - name: is_refund_credits
        description: "Whether credits were refunded for this clip"
      - name: is_bot
        description: "Whether the clip was created by a bot"
      - name: credit_cost
        description: "Number of credits used for this clip"
      - name: lyrics_at_gen
        description: "Lyrics at generation time"
      - name: is_simple
        description: "Whether this is a simple clip"
      - name: simple_prompt
        description: "Simple prompt used for generation"
      - name: lyrics_final
        description: "Final lyrics of the clip"
      - name: is_make_instrumental
        description: "Whether the clip is instrumental"
      - name: style_tags
        description: "Style tags associated with the clip"
      - name: negative_style_tags
        description: "Negative style tags for the clip"
      - name: request_models
        description: "Models requested for generation"
      - name: model_name
        description: "Name of the model used for generation"
      - name: experiment_inf_param
        description: "Experiment inference parameters"
      - name: experiment_version
        description: "Version of the experiment"
      - name: history
        description: "JSON history of the clip generation process"
      - name: concat_history
        description: "Concatenated history information"
      - name: error_type
        description: "Type of error if any occurred"
      - name: error_message
        description: "Error message if any occurred"
      - name: upload_has_vocal
        description: "Whether the uploaded file has vocals"
      - name: edit_session_id
        description: "Session ID for editing"
      - name: edited_clip_id
        description: "ID of the edited clip"
      - name: task_details
        description: "Detailed task information"
      - name: creation_source
        description: "Source of clip creation"
      - name: augmented_tags
        description: "Augmented tags for the clip"
      - name: free_quota_category
        description: "Category for free quota usage"
      - name: lyrics_language
        description: "Language of the lyrics"
      - name: simple_lyrics_model
        description: "Model used for simple lyrics"
      - name: created_session_id
        description: "Session ID when clip was created"
      - name: is_audio_watermark
        description: "Whether audio watermark is applied"
      - name: user_tier
        description: "Tier of the user"
      - name: is_deleted
        description: "Whether the clip is deleted"
      # Additional columns from dim_clip
      - name: clip_uid
        description: "Unique identifier for the clip"
      - name: cleaned_create_mode
        description: "Cleaned creation mode - derived from create_mode or is_simple flag"
      - name: model_category
        description: "Categorized model version (v3.5, v4, v4.5, stem, etc.)"
      - name: category
        description: "Categorized clip type (normal_gen, cover_gen, extend_gen, etc.)"
      - name: history_length
        description: "Number of items in the history JSON array"
      - name: is_made_in_edit
        description: "Whether the clip was made in edit mode"
      - name: has_augmented_tags
        description: "Whether the clip has augmented tags"
      - name: was_prompt_used_exactly
        description: "Whether the prompt was used exactly"
      - name: owner_creation_day_total_clip_cnt
        description: "Total number of clips created by the owner on their creation day"
      - name: owner_creation_day_play_duration_sec_own
        description: "Total play duration in seconds for the owner on their creation day"
      - name: owner_creation_day_play_duration_sec_others
        description: "Total play duration in seconds for others on the owner's creation day"
      - name: owner_creation_day_subscription_tier
        description: "Subscription tier of the owner on their creation day"
      - name: like_count
        description: "Number of likes for the clip"
      - name: dislike_count
        description: "Number of dislikes for the clip"
      - name: flag_count
        description: "Number of flags for the clip"
      - name: play_count_displayed
        description: "Number of times the clip was played"
      - name: download_audio_mp3_count
        description: "Number of times the clip was downloaded as MP3"
      - name: download_audio_wav_count
        description: "Number of times the clip was downloaded as WAV"
      - name: download_video_count
        description: "Number of times the clip was downloaded as video"
      - name: share_count
        description: "Number of times the clip was shared"
      - name: owner_init_play_cnt
        description: "Number of plays for the owner"
      - name: owner_init_play_duration_seconds
        description: "Total play duration in seconds for the owner"
      - name: owner_init_net_like_events
        description: "Net like events for the owner (likes minus unlikes)"
      - name: owner_init_net_dislike_events
        description: "Net dislike events for the owner (dislikes minus undislikes)"
      - name: owner_init_n_share_events
        description: "Number of share events for the owner"
      - name: owner_init_n_download_events
        description: "Number of download events for the owner"
      - name: owner_init_net_public_toggle_events
        description: "Net public toggle events for the owner (make public minus make private)"
      - name: owner_init_net_positive_interactions
        description: "Net positive interactions for the owner"
      - name: owner_init_satisfaction_metric_version
        description: "Version of the satisfaction metric used"
      - name: owner_init_is_satisfactory_indirect
        description: "Whether the clip is satisfactory based on indirect metrics"
      - name: owner_init_is_satisfactory_direct
        description: "Whether the clip is satisfactory based on direct metrics"
      - name: owner_init_is_satisfactory
        description: "Whether the clip is satisfactory overall"
      - name: first_play_start_ts_utc
        description: "Timestamp of the first play"
      - name: last_play_start_ts_utc
        description: "Timestamp of the last play"
      - name: creator_first_play_start_ts_utc
        description: "Timestamp of the first play from the creator"
      - name: creator_last_play_start_ts_utc
        description: "Timestamp of the last play from the creator"
      - name: creator_play_cnt_0s
        description: "Number of plays from the creator"
      - name: creator_play_cnt_5s
        description: "Number of plays from the creator that lasted at least 5 seconds"
      - name: creator_play_cnt_25pct
        description: "Number of plays from the creator that covered at least 25% unique seconds of the clip"
      - name: creator_play_cnt_50pct
        description: "Number of plays from the creator that covered at least 50% unique seconds of the clip"
      - name: creator_play_cnt_90pct
        description: "Number of plays from the creator that covered at least 90% unique seconds of the clip"
      - name: creator_play_duration_seconds_0s
        description: "Total play duration in seconds for the creator"
      - name: creator_play_duration_seconds_5s
        description: "Total play duration in seconds for the creator that lasted at least 5 seconds"
      - name: creator_play_duration_seconds_25pct
        description: "Total play duration in seconds for the creator that covered at least 25% unique seconds of the clip"
      - name: creator_play_duration_seconds_50pct
        description: "Total play duration in seconds for the creator that covered at least 50% unique seconds of the clip"
      - name: creator_play_duration_seconds_90pct
        description: "Total play duration in seconds for the creator that covered at least 90% unique seconds of the clip"
      - name: non_creator_first_play_start_ts_utc
        description: "Timestamp of the first play from non-creators"
      - name: non_creator_last_play_start_ts_utc
        description: "Timestamp of the last play from non-creators"
      - name: n_non_creator_listeners_0s
        description: "Number of listeners for non-creators"
      - name: n_non_creator_listeners_5s
        description: "Number of listeners for non-creators that lasted at least 5 seconds"
      - name: n_non_creator_listeners_25pct
        description: "Number of listeners for non-creators that covered at least 25% unique seconds of the clip"
      - name: n_non_creator_listeners_50pct
        description: "Number of listeners for non-creators that covered at least 50% unique seconds of the clip"
      - name: n_non_creator_listeners_90pct
        description: "Number of listeners for non-creators that covered at least 90% unique seconds of the clip"
      - name: non_creator_play_cnt_0s
        description: "Number of plays from non-creators"
      - name: non_creator_play_cnt_5s
        description: "Number of plays from non-creators that lasted at least 5 seconds"
      - name: non_creator_play_cnt_25pct
        description: "Number of plays from non-creators that covered at least 25% unique seconds of the clip"
      - name: non_creator_play_cnt_50pct
        description: "Number of plays from non-creators that covered at least 50% unique seconds of the clip"
      - name: non_creator_play_cnt_90pct
        description: "Number of plays from non-creators that covered at least 90% unique seconds of the clip"
      - name: non_creator_play_duration_seconds_0s
        description: "Total play duration in seconds for non-creators"
      - name: non_creator_play_duration_seconds_5s
        description: "Total play duration in seconds for non-creators that lasted at least 5 seconds"
      - name: non_creator_play_duration_seconds_25pct
        description: "Total play duration in seconds for non-creators that covered at least 25% unique seconds of the clip"
      - name: non_creator_play_duration_seconds_50pct
        description: "Total play duration in seconds for non-creators that covered at least 50% unique seconds of the clip"
      - name: non_creator_play_duration_seconds_90pct
        description: "Total play duration in seconds for non-creators that covered at least 90% unique seconds of the clip"
      - name: n_creator_likes
        description: "Number of likes from the creator"
      - name: n_creator_verified_likes
        description: "Number of verified likes from the creator"
      - name: creator_has_undo_like
        description: "Whether the creator has undone a like at any point"
      - name: n_non_creator_likes
        description: "Number of likes from non-creators"
      - name: n_non_creator_verified_likes
        description: "Number of verified likes from non-creators"
      - name: n_comments
        description: "Total number of non-deleted comments for the clip"
      - name: n_non_reply_comments
        description: "Number of non-deleted top-level comments (where parent_id is null)"
  - name: creator_trustworthiness_features
    description: "Mart model for creator trustworthiness features used in recommendation systems"
    config:
      group: recommendations
      tags: ["cadence=daily", "dbt"]
    columns:
      - name: user_id
        description: "ID of the user"
      - name: user_uid
        description: "Unique identifier for the user"
      - name: n_days_active
        description: "Number of days the user has been active"
      - name: n_days_active_create
        description: "Number of days the user has been active and created"
      - name: n_days_active_listen
        description: "Number of days the user has been active and listened"
      - name: n_days_active_l7d
        description: "Number of days the user has been active in the last 7 days"
      - name: n_days_active_create_l7d
        description: "Number of days the user has been active and created in the last 7 days"
      - name: n_days_active_listen_l7d
        description: "Number of days the user has been active and listened in the last 7 days"
      - name: n_days_active_listen_own_l7d
        description: "Number of days the user has been active and listened to their own clips in the last 7 days"
      - name: n_days_active_listen_others_l7d
        description: "Number of days the user has been active and listened to other users' clips in the last 7 days"
      - name: n_days_active_l28d
        description: "Number of days the user has been active in the last 28 days"
      - name: n_days_active_create_l28d
        description: "Number of days the user has been active and created in the last 28 days"
      - name: n_days_active_listen_l28d
        description: "Number of days the user has been active and listened in the last 28 days"
      - name: n_days_active_listen_own_l28d
        description: "Number of days the user has been active and listened to their own clips in the last 28 days"
      - name: n_days_active_listen_others_l28d
        description: "Number of days the user has been active and listened to other users' clips in the last 28 days"
      - name: n_clips_created
        description: "Number of clips the user has created"
      - name: n_gen_clips_created
        description: "Number of clips the user has created using the generative AI"
      - name: pct_clips_created_gen
        description: "Percentage of clips the user has created using the generative AI"
      - name: avg_clips_created_per_active_create_day
        description: "Average number of clips the user has created per day they have been active and created"
      - name: n_plays
        description: "Number of clips the user has listened to"
      - name: n_plays_own
        description: "Number of clips the user has listened to their own clips"
      - name: n_plays_others
        description: "Number of clips the user has listened to other users' clips"
      - name: pct_plays_own
        description: "Percentage of total play count the user has listened to their own clips"
      - name: ratio_plays_others_to_own
        description: "Ratio of total play count the user has listened to other users' clips to their own clips"
      - name: avg_plays_per_active_listen_day
        description: "Average number of clips the user has listened to per day they have been active and listened to clips"
      - name: avg_plays_own_per_active_listen_day
        description: "Average number of clips the user has listened to their own clips per day they have been active and listened to clips"
      - name: avg_plays_others_per_active_listen_day
        description: "Average number of clips the user has listened to other users' clips per day they have been active and listened to clips"
      - name: avg_plays_per_active_create_day
        description: "Average number of clips the user has created per day they have been active and created clips"
