version: 2

models:
  - name: int_active_users_daily_web_user_event
    description: Daily active users per web_user_event table. Any user_id with at least one event in the web_user_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-08-23
          end_offset: 0
        partition_mappings:
          - asset_key: web_user_event
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
        backfill_policy:
          max_partitions_per_run: 14
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_web_page_event
    description: Daily active users per web_page_event table. Any user_id with at least one event in the web_page_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-08-23
          end_offset: 0
        partition_mappings:
          - asset_key: [segment_events, web_page_event] # This is a dbt source table, not a Dagster-defined asset
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_web_audio_player_actions
    description: Daily active users per web_audio_player_actions table. Any user_id with at least one event in the web_audio_player_actions table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-06-01
        partition_mappings:
          - asset_key: web_audio_player_actions
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_web_audio_actions
    description: Daily active users per web_audio_actions table. Any user_id with at least one event in the web_audio_actions table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-06-14
          end_offset: 0
        partition_mappings:
          - asset_key: [segment_events, web_audio_actions] # This is a dbt source table, not a Dagster-defined asset
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_web_hook_event
    description: Daily active users per web_hook_event table. Any user_id with at least one event in the web_hook_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2025-07-31
          end_offset: 0
        partition_mappings:
          - asset_key: web_hook_event
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_app_event
    description: Daily active users per app_event table. Any user_id with at least one event in the app_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-11-26
          end_offset: 0
        partition_mappings:
          - asset_key: app_event
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_app_audio_actions
    description: Daily active users per app_audio_actions table. Any user_id with at least one event in the app_audio_actions table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2024-07-17
          end_offset: 0
        partition_mappings:
          - asset_key: app_audio_actions
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_uid
        description: User UID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_bk_realtime_event
    description: Daily active users per bk_realtime_event table. Any user_id with at least one event in the bk_realtime_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2025-01-01
          end_offset: 0
        partition_mappings:
          - asset_key: bk_realtime_event
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_id
        description: User ID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_bk_nonrealtime_event
    description: Daily active users per bk_nonrealtime_event table. Any user_id with at least one event in the bk_nonrealtime_event table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2025-02-03
          end_offset: 0
        partition_mappings:
          - asset_key: bk_nonrealtime_event
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_id
        description: User ID
      - name: p_date
        description: Partition date
      - name: n_events
        description: Number of events for the user on the given day
  - name: int_active_users_daily_user_session_state
    description: Daily active users per user_session_state table. Any user_id with at least one session in the user_session_state table on a given day is considered active.
    config:
      group: active_users
    meta:
      dagster:
        partitions_def:
          type: daily
          start_date: 2025-01-01
          end_offset: 0
        partition_mappings:
          - asset_key: [user_session_state]
            type: time_window
            start_offset: 0
            end_offset: 0
            allow_nonexistent_upstream_partitions: False
        automation_condition: daily_cron_with_eager_historical_backfill_condition
    columns:
      - name: user_id
        description: User ID
      - name: p_date
        description: Partition date
      - name: n_sessions_web
        description: Number of web sessions for the user on the given day
      - name: n_sessions_ios
        description: Number of iOS sessions for the user on the given day
      - name: n_sessions_android
        description: Number of Android sessions for the user on the given day
