Operations analytical scorecard & correction tasks
These tasks share one shape: a natural-language prompt points at a request
payload JSON (the authoritative policy) and an answer_template.json (the
exact output contract), and asks you to compute production results from an
authenticated operations database and write one JSON object to answer.json.
They are read-only analytical tasks unless the request explicitly asks you
to apply a correction. Your answer is graded on exact values and exact
conformance, so precision on definitions, boundaries, rounding, and ordering is
everything.
The environment (base URL, auth, and the available endpoints — schema,
data-dictionary, read-only SQL, and, for correction tasks, a transactional SQL
and correction-audit view) is described in the run's own access file. Read that
file each time rather than assuming; do not hardcode hosts or credentials.
Work in this order
1. Read all three inputs before touching the database
- prompt.txt — the framing, the output filename (
answer.json), and the
"conform exactly, no commentary/extra fields" requirement.
- request payload JSON — the source of truth. Extract, verbatim, every:
scope/cohort filter,
business_definitions, money/FX policy, time windows
and their inclusive/exclusive boundary flag and cutoff, rollups,
ranking/tie_break/limit rules, rounding rule, and the ordered
status/risk rule list. Re-read each definition literally — small clauses
("incomplete orders remain in the denominator", "no shipment promise does not
satisfy the first condition", "at least two … with the same normalized reason
code") change the answer.
- answer_template.json — the JSON Schema you must satisfy: required keys,
scalar types (integers stay integers), ID
patterns, array minItems/
maxItems and stated ordering, numeric precision (multipleOf /
decimal_places / x-precision), and additionalProperties:false.
2. Discover the real data model — never guess names
The request describes fields in business/logical terms (e.g. a rate on a
warehouse's region, or fx_rates.usd_per_unit); physical table and column
names can differ. Use the environment's schema and data-dictionary endpoints to
learn the actual tables, columns, and units, and to map each logical concept to
storage. Do not rely on database catalog introspection from inside SQL — the
query layer only serves the documented business tables. If a discovery endpoint
is unavailable, map names from whatever context the environment does expose
before writing queries, and state any assumption you were forced to make.
3. Compute with read-only SQL, holding full precision
The query service is SQLite-dialect SQL over the operations tables. Build up
each required output with explicit queries and verify intermediate counts.
- Boundaries are exact UTC. Apply window start/end with the exact
inclusive/exclusive semantics stated; compare against the stated cutoff,
not "now".
- Reduce to effective/canonical entities first. When raw vs. canonical
values, versions, or multiple rows per business entity exist, collapse to the
one effective record (e.g. latest-wins / final status / supersession)
before you count or aggregate. "Logical" refunds/shipments/cases may span
several rows; a "complete" order may require every associated shipment to
satisfy a condition. Net figures apply reversals/offsets before comparison.
- Apply eligibility exactly. Production-only populations, segment/region/
tier/warehouse filters, campaign attribution within an active window, and
membership predicates all narrow the cohort — and the cohort is usually the
denominator.
- Money/time conversions use the policy's basis (e.g. the daily FX rate for
each row's service date and currency; active-clock vs. wall-clock elapsed
time). Value comparisons (refund vs. order gross) at the rate/date the policy
names.
- Round only at the end. Carry unrounded values through all logic and
comparisons; round only the final reported rates/amounts to the template's
stated decimals.
4. Ordering, selection, and ID lists
- Worst/top-N: sort by the unrounded metric in the stated direction,
then by each stated tie-break key in order (typically the id ascending), then
take exactly N. Report each metric rounded per the template, but rank on the
unrounded value.
- ID/list outputs: dedupe, keep only members that truly satisfy the
definition, ensure each matches the template's
pattern exactly, and sort as
specified (usually id ascending).
5. Status / risk classification
Evaluate the status rule list in order and assign the first tier whose
full condition holds; if none, the explicit fallback tier. Build each condition
from the unrounded rates and the exact comparators (>=, <, thresholds,
and USD/count sub-conditions) as written. A tier usually requires all of its
clauses.
6. Correction / mutation tasks (only when explicitly requested)
When the request asks you to apply a correction:
- Find the single raw↔canonical contradiction it describes. Change only the
one approved minimal canonical field on exactly one business row. Leave
raw/source values, source identity fields, and unrelated rows untouched.
- Use the environment's controlled transactional endpoint to commit, in one
transaction, the business-row update and its audit record. Populate the
audit record from the request's approved-correction block (audit id,
correction key, entity type/id, source row id, field name, old/new value,
reason code, corrected timestamp, actor).
- Verify with a follow-up read that the canonical value changed. Report the
success status per the request's rule: e.g.
APPLIED only when exactly one
business row and one audit row committed and the post-change query confirms
the new value; otherwise NOT_APPLIED with the results actually observed.
- Report backlog/impact counts both pre- and post-correction as the template
requires, and compute any delta as (post − pre).
7. Emit exactly one conforming JSON object
Write answer.json as a single JSON object with only the required keys, in the
right types, at the right precision, with arrays of the right length and order,
and IDs matching their patterns. No prose, no extra keys.
Pre-submission self-check
Recurring traps
- Reading rates off rounded intermediate values, or rounding before comparing
to a status threshold.
- Dropping incomplete/ineligible items that the definition keeps in the
denominator.
- Treating a business/logical field name as a physical column without checking
the data dictionary.
- Ranking on the rounded metric, or forgetting the id-ascending tie-break.
- Off-by-one on inclusive vs. exclusive window edges, or using current time
instead of the stated cutoff.
- On corrections: editing raw/source fields, touching more than one row, or
reporting
APPLIED without a confirming post-change read.
1---2name: atlas-ops-analytical-scorecard3description: Use when a task delivers a business "scorecard", "reconciliation", "review", "backlog", or "correction" as three files — a prompt, a request-policy JSON (scope, business definitions, rollups, tie-breaks, rounding, status rules), and an answer_template.json — to be computed against an authenticated, read-only SQL workplace/operations database and written as one JSON object to answer.json. Covers eligibility cohorts, "effective/canonical" entity reduction, exact UTC windows, rate/rounding rules, worst/top-N ordering with tie-breaks, ordered status-rule cascades, and single-row canonical corrections with an audit record.4---56# Operations analytical scorecard & correction tasks78These tasks share one shape: a natural-language prompt points at a **request9payload JSON** (the authoritative policy) and an **answer_template.json** (the10exact output contract), and asks you to compute production results from an11authenticated operations database and write one JSON object to `answer.json`.12They are read-only **analytical** tasks unless the request explicitly asks you13to *apply a correction*. Your answer is graded on exact values and exact14conformance, so precision on definitions, boundaries, rounding, and ordering is15everything.1617The environment (base URL, auth, and the available endpoints — schema,18data-dictionary, read-only SQL, and, for correction tasks, a transactional SQL19and correction-audit view) is described in the run's own access file. Read that20file each time rather than assuming; do not hardcode hosts or credentials.2122## Work in this order2324### 1. Read all three inputs before touching the database25- **prompt.txt** — the framing, the output filename (`answer.json`), and the26 "conform exactly, no commentary/extra fields" requirement.27- **request payload JSON** — the source of truth. Extract, verbatim, every:28 scope/cohort filter, `business_definitions`, money/FX policy, time windows29 and their `inclusive/exclusive` boundary flag and cutoff, `rollups`,30 ranking/`tie_break`/`limit` rules, `rounding` rule, and the ordered31 status/risk rule list. Re-read each definition literally — small clauses32 ("incomplete orders remain in the denominator", "no shipment promise does not33 satisfy the first condition", "at least two … with the same normalized reason34 code") change the answer.35- **answer_template.json** — the JSON Schema you must satisfy: required keys,36 scalar types (integers stay integers), ID `pattern`s, array `minItems`/37 `maxItems` and stated ordering, numeric precision (`multipleOf` /38 `decimal_places` / `x-precision`), and `additionalProperties:false`.3940### 2. Discover the real data model — never guess names41The request describes fields in **business/logical** terms (e.g. a rate on a42warehouse's region, or `fx_rates.usd_per_unit`); physical table and column43names can differ. Use the environment's schema and data-dictionary endpoints to44learn the actual tables, columns, and units, and to map each logical concept to45storage. Do not rely on database catalog introspection from inside SQL — the46query layer only serves the documented business tables. If a discovery endpoint47is unavailable, map names from whatever context the environment does expose48before writing queries, and state any assumption you were forced to make.4950### 3. Compute with read-only SQL, holding full precision51The query service is SQLite-dialect SQL over the operations tables. Build up52each required output with explicit queries and verify intermediate counts.53- **Boundaries are exact UTC.** Apply window start/end with the exact54 `inclusive`/`exclusive` semantics stated; compare against the stated cutoff,55 not "now".56- **Reduce to effective/canonical entities first.** When raw vs. canonical57 values, versions, or multiple rows per business entity exist, collapse to the58 one *effective* record (e.g. latest-wins / final status / supersession)59 before you count or aggregate. "Logical" refunds/shipments/cases may span60 several rows; a "complete" order may require *every* associated shipment to61 satisfy a condition. Net figures apply reversals/offsets before comparison.62- **Apply eligibility exactly.** Production-only populations, segment/region/63 tier/warehouse filters, campaign attribution within an active window, and64 membership predicates all narrow the cohort — and the cohort is usually the65 denominator.66- **Money/time conversions** use the policy's basis (e.g. the daily FX rate for67 each row's service date and currency; active-clock vs. wall-clock elapsed68 time). Value comparisons (refund vs. order gross) at the rate/date the policy69 names.70- **Round only at the end.** Carry unrounded values through all logic and71 comparisons; round only the *final reported* rates/amounts to the template's72 stated decimals.7374### 4. Ordering, selection, and ID lists75- **Worst/top-N:** sort by the **unrounded** metric in the stated direction,76 then by each stated tie-break key in order (typically the id ascending), then77 take exactly N. Report each metric rounded per the template, but rank on the78 unrounded value.79- **ID/list outputs:** dedupe, keep only members that truly satisfy the80 definition, ensure each matches the template's `pattern` exactly, and sort as81 specified (usually id ascending).8283### 5. Status / risk classification84Evaluate the status rule list **in order** and assign the **first** tier whose85full condition holds; if none, the explicit fallback tier. Build each condition86from the *unrounded* rates and the exact comparators (`>=`, `<`, thresholds,87and USD/count sub-conditions) as written. A tier usually requires *all* of its88clauses.8990### 6. Correction / mutation tasks (only when explicitly requested)91When the request asks you to apply a correction:92- Find the single raw↔canonical contradiction it describes. Change **only** the93 one approved minimal canonical field on **exactly one** business row. Leave94 raw/source values, source identity fields, and unrelated rows untouched.95- Use the environment's controlled transactional endpoint to commit, in one96 transaction, the business-row update **and** its audit record. Populate the97 audit record from the request's approved-correction block (audit id,98 correction key, entity type/id, source row id, field name, old/new value,99 reason code, corrected timestamp, actor).100- **Verify** with a follow-up read that the canonical value changed. Report the101 success status per the request's rule: e.g. `APPLIED` only when exactly one102 business row and one audit row committed and the post-change query confirms103 the new value; otherwise `NOT_APPLIED` with the results actually observed.104- Report backlog/impact counts both pre- and post-correction as the template105 requires, and compute any delta as (post − pre).106107### 7. Emit exactly one conforming JSON object108Write `answer.json` as a single JSON object with only the required keys, in the109right types, at the right precision, with arrays of the right length and order,110and IDs matching their patterns. No prose, no extra keys.111112## Pre-submission self-check113- [ ] Every `required` key present; no extra keys (`additionalProperties:false`).114- [ ] Integers are integers; each rate/amount rounded to the template's decimals115 (`multipleOf`/`decimal_places`/`x-precision`) — and only rounded at the end.116- [ ] Rankings computed on **unrounded** values; every tie-break applied in117 order; arrays hold exactly the stated count and ordering.118- [ ] All ID strings match their regex `pattern`; lists deduped and sorted.119- [ ] Cohort/eligibility, window boundaries (inclusive/exclusive), and cutoff120 applied exactly; denominators match the request's wording.121- [ ] "Effective/canonical/logical" reduction applied before counting.122- [ ] Status/risk chosen by first-matching tier in the listed order.123- [ ] (Correction tasks) exactly one business row + one audit row changed, raw124 values preserved, post-change verified, status reported per the rule.125- [ ] Output is valid JSON with no commentary.126127## Recurring traps128- Reading rates off rounded intermediate values, or rounding before comparing129 to a status threshold.130- Dropping incomplete/ineligible items that the definition keeps in the131 denominator.132- Treating a business/logical field name as a physical column without checking133 the data dictionary.134- Ranking on the rounded metric, or forgetting the id-ascending tie-break.135- Off-by-one on inclusive vs. exclusive window edges, or using current time136 instead of the stated cutoff.137- On corrections: editing raw/source fields, touching more than one row, or138 reporting `APPLIED` without a confirming post-change read.