Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

7.1 KB
Raw Blame
// Generated by pnpm data:build from the successful dbt build.
export default {
  builtAt: "2026-10-14T15:34:05.056138Z",
  models: [
    {
      name: "customers",
      relation: "main.customers",
      description:
        "This table has basic information about a customer, as well as some derived facts based on a customer's orders",
      sql: 'with customer_orders as (\n    select\n        customer_id,\n        min(order_date) as first_order,\n        max(order_date) as most_recent_order,\n        count(*) as number_of_orders,\n        sum(amount) as customer_lifetime_value\n    from "jaffle_shop"."main"."orders"\n    group by customer_id\n)\n\nselect\n    customers.customer_id,\n    customers.first_name,\n    customers.last_name,\n    customer_orders.first_order,\n    customer_orders.most_recent_order,\n    customer_orders.number_of_orders,\n    customer_orders.customer_lifetime_value\nfrom "jaffle_shop"."main"."stg_customers" as customers\nleft join customer_orders\n    on customers.customer_id = customer_orders.customer_id',
      meta: {
        grain: "One row per customer, including customers with no orders.",
        joins: [
          "customers.customer_id = orders.customer_id (one customer to many orders); aggregate order values before joining customer totals.",
        ],
        metrics: {
          customer_lifetime_value:
            "Lifetime payment amount in AUD across all orders, including returned orders; not net revenue. Use orders.amount for date-filtered totals.",
          number_of_orders: "All orders placed by the customer, regardless of status.",
        },
      },
      dependsOn: ["orders", "stg_customers"],
      columns: [
        {
          name: "customer_id",
          type: "INTEGER",
          description: "This is a unique identifier for a customer",
        },
        {
          name: "first_name",
          type: "VARCHAR",
          description: "Customer's first name. PII.",
        },
        {
          name: "last_name",
          type: "VARCHAR",
          description: "Customer's last name. PII.",
        },
        {
          name: "first_order",
          type: "DATE",
          description: "Date (UTC) of a customer's first order",
        },
        {
          name: "most_recent_order",
          type: "DATE",
          description: "Date (UTC) of a customer's most recent order",
        },
        {
          name: "number_of_orders",
          type: "BIGINT",
          description: "Count of the number of orders a customer has placed",
        },
        {
          name: "customer_lifetime_value",
          type: "DOUBLE",
          description:
            "Lifetime recorded payments in AUD across all of the customer's orders, including returned orders. Not net revenue.",
        },
      ],
    },
    {
      name: "orders",
      relation: "main.orders",
      description:
        "This table has basic information about orders, as well as some derived facts based on payments",
      sql: 'with order_payments as (\n    select\n        order_id,\n        sum(case when payment_method = \'credit_card\' then amount else 0 end) as credit_card_amount,\n        sum(case when payment_method = \'coupon\' then amount else 0 end) as coupon_amount,\n        sum(case when payment_method = \'bank_transfer\' then amount else 0 end) as bank_transfer_amount,\n        sum(case when payment_method = \'gift_card\' then amount else 0 end) as gift_card_amount,\n        sum(amount) as amount\n    from "jaffle_shop"."main"."stg_payments"\n    group by order_id\n)\n\nselect\n    orders.order_id,\n    orders.customer_id,\n    orders.order_date,\n    orders.status,\n    order_payments.credit_card_amount,\n    order_payments.coupon_amount,\n    order_payments.bank_transfer_amount,\n    order_payments.gift_card_amount,\n    order_payments.amount\nfrom "jaffle_shop"."main"."stg_orders" as orders\nleft join order_payments\n    on orders.order_id = order_payments.order_id',
      meta: {
        grain: "One row per order.",
        joins: ["orders.customer_id = customers.customer_id (many orders to one customer)."],
        metrics: {
          amount:
            "Sum of all recorded payments for this order in AUD, including coupons and gift cards, regardless of order status. Not net revenue or profit.",
          order_count: "COUNT(*) on orders. For completed orders filter status = 'completed'.",
          average_order_amount: "AVG(amount) on orders; excludes NULL amounts.",
        },
        caveats: [
          "No refund ledger, tax breakdown, costs, or payment timestamps are available.",
          "order_date is the order placement date, not the payment date.",
          "The bundled seeds are historical synthetic data. Inspect MIN/MAX(order_date) before choosing dates.",
        ],
      },
      dependsOn: ["stg_payments", "stg_orders"],
      columns: [
        {
          name: "order_id",
          type: "INTEGER",
          description: "This is a unique identifier for an order",
        },
        {
          name: "customer_id",
          type: "INTEGER",
          description: "Foreign key to the customers table",
        },
        {
          name: "order_date",
          type: "DATE",
          description: "Date (UTC) that the order was placed",
        },
        {
          name: "status",
          type: "VARCHAR",
          description:
            "Orders can be one of the following statuses:\n\n| status         | description                                                                                                            |\n| -------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| placed         | The order has been placed but has not yet left the warehouse                                                           |\n| shipped        | The order has ben shipped to the customer and is currently in transit                                                  |\n| completed      | The order has been received by the customer                                                                            |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned       | The order has been returned by the customer and received at the warehouse                                              |",
        },
        {
          name: "credit_card_amount",
          type: "DOUBLE",
          description: "Amount of the order (AUD) paid for by credit card",
        },
        {
          name: "coupon_amount",
          type: "DOUBLE",
          description: "Amount of the order (AUD) paid for by coupon",
        },
        {
          name: "bank_transfer_amount",
          type: "DOUBLE",
          description: "Amount of the order (AUD) paid for by bank transfer",
        },
        {
          name: "gift_card_amount",
          type: "DOUBLE",
          description: "Amount of the order (AUD) paid for by gift card",
        },
        {
          name: "amount",
          type: "DOUBLE",
          description: "Total amount (AUD) of the order",
        },
      ],
    },
  ],
};