contract_id: fraud_risk_feature_store_v1
model_feature_service: fraud_risk_service_v3
business_use_case: card transaction fraud risk scoring
prediction_time_column: scoring_ts
owner: ml-platform@acme.example
reviewer: data-governance@acme.example

entities:
  - name: customer
    join_key: customer_id
    description: Stable customer identifier used by offline joins and online feature lookup.
  - name: merchant
    join_key: merchant_id
    description: Stable merchant identifier used for merchant risk context.

feature_views:
  - name: customer_velocity_1h
    entity: customer
    event_timestamp: event_ts
    created_timestamp: ingest_ts
    offline_source: lakehouse.silver.customer_velocity_hourly
    online_store: redis://feature-online/customer_velocity_1h
    source_delay: PT10M
    temporal_join_lookback: P7D
    ttl: PT2H
    owner: risk-data-engineering@acme.example
    features:
      - name: txn_count_1h
        dtype: float
        description: Count of customer transactions in the previous hour.
        default_policy: reject_if_missing
      - name: total_amount_1h
        dtype: float
        description: Sum of customer transaction amount in the previous hour.
        default_policy: reject_if_missing
      - name: chargeback_count_30d
        dtype: float
        description: Number of known chargebacks in the previous thirty days.
        default_policy: default_to_zero_with_log
    materialization:
      mode: scheduled_batch
      schedule: '*/15 * * * *'
      freshness_sla: PT30M
      backfill_policy: point_in_time_recompute

  - name: merchant_risk_daily
    entity: merchant
    event_timestamp: event_ts
    created_timestamp: ingest_ts
    offline_source: lakehouse.gold.merchant_risk_daily
    online_store: redis://feature-online/merchant_risk_daily
    source_delay: PT30M
    temporal_join_lookback: P30D
    ttl: P2D
    owner: merchant-analytics@acme.example
    features:
      - name: merchant_dispute_rate_30d
        dtype: float
        description: Share of merchant transactions disputed in the previous thirty days.
        default_policy: reject_if_missing
      - name: merchant_txn_count_30d
        dtype: float
        description: Number of merchant transactions in the previous thirty days.
        default_policy: reject_if_missing
    materialization:
      mode: scheduled_batch
      schedule: '0 * * * *'
      freshness_sla: PT2H
      backfill_policy: point_in_time_recompute

quality_gates:
  require_primary_key_uniqueness: true
  require_event_time_not_after_prediction_time: true
  require_source_delay_in_point_in_time_join: true
  require_online_freshness_check: true
  require_training_serving_skew_test: true
  maximum_null_rate: 0.01
