# Metric contract, proposed for martech-context/metrics.md (MET-01).
# Example values are fictional (Acme Cloud). Replace them; keep every key.
# A contract is complete when every key below has a value. Write "none" rather than leaving a key empty.

metric_id: pipeline_created
display_name: "Pipeline created (sales)"
decision: "Weekly pipeline review: which sources get next week's outbound and paid budget."
entity: deal
grain: "one row per deal, counted once on the day it entered the sales pipeline"
numerator: "sum of amount_in_home_currency for deals created in the sales pipeline"
denominator: none
time_basis: "deal created date"
time_zone: America/New_York
window: "calendar week, Monday to Sunday"
maturity: "a week is final on Wednesday 12:00 after it ends; earlier values are labelled provisional"
exclusions:
  - "deals with _fivetran_deleted true or merged away"
  - "test deals (is_test flag)"
  - "deals in the renewals pipeline"
dimensions:
  - name: original_source
    scope: "HubSpot Original Traffic Source of the deal's primary contact, by the documented deal source rule"
  - name: region
    scope: "company billing country mapped to region"
currency:
  unit: "major units"
  conversion: "converted to USD at the monthly average rate of the created month (decisions.md, FX policy)"
aggregation: "sum over deals; never averaged; never summed across snapshot dates"
missing_input: "deals without an original source count under Unknown, never Direct"
zero_denominator: "not applicable"
revision_policy: "amount changes after creation restate the created week; closed periods restate only through the monthly restatement note"
version: 2
version_history:
  - version: 1
    from: "2026-01-01"
    change: "first definition, amount in deal currency"
  - version: 2
    from: "2026-09-01"
    change: "amount_in_home_currency; renewals pipeline excluded; history restated from 2026-01-01"
business_owner: "RevOps lead"
technical_owner: "Analytics engineer"
implementations:
  - where: "dbt semantic layer metric pipeline_created"
    status: canonical
  - where: "Looker Studio field Pipeline on the Pipeline by source dashboard"
    status: "to be replaced by the semantic layer metric (MET-02)"
acceptance_fixtures:
  - case: "one deal with three contacts"
    expected: "counted once, amount not multiplied"
  - case: "a deal deleted after creation"
    expected: "excluded from every week, including closed ones after the restatement note"
  - case: "a EUR deal created on 2026-10-14"
    expected: "converted at the 2026-10 monthly average rate, USD per one EUR"
