# Product-usage account scoring: design, round 1

Committed before any sync fault or check ran on a scored company. The frozen parameters are in `protocol-r1.json`; where the
two differ, the JSON wins. Any later change is a labelled "Change N to the protocol", committed before it is used, and a
change made after results are seen says so.

## Question

When a software company scores accounts from product usage and pushes the score into its CRM, what breaks between the
warehouse model and the field a salesperson reads, and what does each break do to the holdout read of the score's added
expansion?

## Overlap test (one question, one study)

Keyword search over the site's cards, then the nearest pages read in full.

- `retargeting-holdout`, sales motions round (`sales-motions.html`). Closest, and the search only found it by its data files:
  inside sales calls the top fifth of free accounts by a usage score, behind a randomized holdout. It already shows that a
  list ranked by usage holds accounts that would have upgraded anyway, that credit overstates cause, how often a holdout
  makes the right call by effect size, and how a propensity list compares with an uplift list. This study does not repeat
  any of that. Its score is a logistic fit in Python with no warehouse model, no sync, no CRM field and no fault.
- `retargeting-holdout`, account pipeline round (`account-pipeline.html`). One CRM fault, a duplicated opportunity, on a
  matched-pair read of pipeline. No score, no sync, no worklist.
- `data-quality-scorecard` and `event-contracts`. What breaks a metric with no error, and each stops at the warehouse or at
  the release. Neither looks at what happens after the warehouse.
- `ai-adoption-measurement`. Sizes a test of one assistant's guided first task. Not this question.

Result: the half of the first question that asks "would these accounts have expanded anyway" is answered in kind by the
sales motions round, so here it gets one measured row and a link, on a different population (paid accounts expanding, a
rule in dbt, a comparison list). The part no page answers is the sync: which faults reach the field a rep reads, which
checks see them, and what they do to the read. That is the round's question and what its headline leads with.

## The synthetic company

A product-led software company with 9,000 paying accounts, 29 weeks of history, workspaces (an account has one or more, and
1.5% move between accounts), weekly seat snapshots, weekly active users and weekly event counts for six features. Every
account has a latent need that drives its usage; 35% heat up at some point, over four weeks. Only the simulation can see
need. Contact and expansion do not feed back into usage inside the period, a simplification that keeps every scenario on the
same usage data.

Generator rates, the hot cut, capacity and the size of the company were set on clean runs of unscored seeds (9001 to 9030)
before this design was committed. No fault and no check result on a fault was seen when setting them.

## The score, in dbt

One definition at one grain, account by week, in `dbt/models/marts/fct_account_week_score.sql`. It is a written rule, not a
fitted model. Over the 4 complete weeks ending at this week: 35 x seat use (mean active users over paid seats, capped at 1) +
25 x growth (events against the 4 weeks before, change clipped to minus 50% and plus 100%, rescaled) + 20 x breadth (distinct
features used of six, over 6) + 20 x seat limit (share of the 4 weeks with active users at 85% of seats or more). Hot from
62, warm from 40, cold below. The definition was written before any outcome existed; the cut was set on unscored seeds to
give a list of about 98 new accounts a week.

## The sync and the people

Each week the mart's payload (`mart_crm_score_sync`) is written to a simulated CRM: score, score week, holdout flag, sync
stamp. Reps read the CRM on Monday. Their list holds accounts the CRM shows hot, not flagged holdout, not marked do not
contact, not worked before the test, best score first, up to 120 calls a week; each reach attempt lands 85% of the time. An
empty holdout flag does not block a call. A few held-out accounts (1%) get a call anyway through inbound questions.

## The test

Randomized by a salted hash of the account, before any score is seen. Two lists enter over 16 weeks (weeks 12 to 27).
Score list: the first week an account crosses into hot, if it was not hot in the four weeks before the test. Comparison list:
a 10% random sample of accounts entered at a drawn week if not yet hot, so a call on the score list can be set against a call
on an ordinary account. Reading: expansion within 13 weeks, by arm, intention to treat, difference in means with a 90%
interval. Call: keep the list if the read is at or above break-even, otherwise stop.

Sizing uses the rule from the retargeting-holdout study, by link and without re-deriving it (`tools/sizing.py` holds the two
functions unchanged): the shortest enrollment that keeps the planned chance of a wrong call at or under 20% each way, then the
smallest holdout. Planning numbers: 98 entrants a week, a 29% holdout rate on the list, and a distance of 2 points from
break-even (the no-effect case). Grid: 8 to 20 weeks, holdout 20% to 50%. Result: 16 weeks, 40% held out, planned wrong call
19.6%.

Two reads, because the two teams look in different places:
- warehouse read: list and arm from the warehouse, expansions from billing. The primary read.
- CRM report read: list and arm as the CRM shows them after the outcome window, expansions from billing.

## Worlds

What a call does is assumed, in three worlds: `none` (nothing), `base` (a call adds up to 12 points, most for accounts with a
real need that have not decided; 7 to 8 points on the score list), `anyway` (a call adds up to 8 points, around the middle of
need, so the score's list is full of accounts that would have expanded anyway; about 1 point there). A call's effect halves
for every 4 weeks of delay. An expansion is worth an assumed US\$6,000 in its first year and a call costs an assumed US\$120, so
break-even is 2 points per call. The same generator sizes and scores the test, so every right-call rate and coverage figure is
a self-test.

## Faults, declared before any check runs

`faults-r1.json` declares 20 faults and one harmless control in words: layer, onset, what changes. They include the three the
question names (stale score, wrong join key, overwritten field). I wrote both them and the checks, so their catch rate is a
self-test and is labelled so at the claim.

A second set comes from an independent author who never sees the checks: 8 faults from a description of the pipeline and the
list of faults already declared. The checks are committed before that author runs and are not changed after. Faults are
implemented from the author's words; any reading that needed a judgment is recorded before the scored run. That set is the
round's held-out result.

## Checks, frozen here

Five groups, thresholds in the protocol, each evaluated every rep week:

1. Warehouse: the 21 dbt tests of the project.
2. Connector: status, and rows written against the payload.
3. Read-back: score within 1 point on at least 99% of accounts, score week current on at least 99%, hot count within 5% of the
   mart's, holdout flag matching on at least 99.5%, live records with an empty score at most 1%, the count of do-not-contact
   flags not falling more than 1% in a week.
4. Test integrity: arm balance against 60 to 40, holdout accounts called at most 5%, contact-arm accounts called at least 70%
   after 3 weeks, arm unchanged since entry.
5. Score drift in the mart: hot share against its trailing four weeks (30%), population stability over deciles (0.10), new
   entrants against the trailing four weeks (half or double).

A fault is caught by a group when one of its checks fires in at least 80% of companies and that check fires in at most 5% of
clean companies. A check that fires on no fault is reported as such. By construction, dbt tests cannot see a fault that happens
after the warehouse, and read-back cannot see a fault in the mart it compares against: both limits are stated beside the counts.

## Replications

100 simulated companies, seeds 1 to 100, each through every scenario and all three worlds. All scenarios share each company's
draws, so differences between scenarios come from the fault. dbt runs `build` on seed 1; the replications execute the SQL dbt
compiled (`results/compiled-sql.json`), and a test pins that both give the same scores.

## Predictions

In `predictions-r1.json`, scored as held, missed or untestable.

## Fixed in advance

The worked example is the first account by number on the clean score list, in the contact arm of seed 1, whose hot band in the
CRM differs from the mart's in its entry week under `join_on_domain`. The takeaway chart shows the base-world read with each fault
against the clean read, for the seven faults with the largest change in the mean read.
