Atlas Commerce Ops
Core Workflow
- Read the prompt, every request payload, and the answer template before querying data.
- Read the provided environment access file or user-provided connection details. Do not infer credentials from placeholders.
- Query
/api/schemaand/api/data-dictionaryfresh for the current environment. Treat the live metadata as authoritative. - Translate the request into exact cohorts, cutoff logic, status rules, rounding rules, and output ordering before writing SQL.
- Use
POST /api/sqlonly forSELECTorWITHanalysis queries. UsePOST /api/sql/transactiononly when the request explicitly asks for a controlled correction. - Build results from the live database every time. Do not reuse example counts, IDs, statuses, or answer values.
- Validate the final JSON against the supplied answer template and write only the JSON object requested by the user.
API Helpers
Use bundled scripts when they reduce copy/paste mistakes:
scripts/atlas_api.py: callschema,dictionary,audit,sql, ortransaction.scripts/validate_answer.py: check a produced answer JSON against the request's answer template.
Set GDPEVO_ENV_BASE_URL or ATLAS_BASE_URL to the service base URL, and set ATLAS_AUTH_TOKEN or GDPEVO_AUTH_TOKEN to the bearer token. Do not hardcode credentials in saved files.
Example read-only query:
python skill/scripts/atlas_api.py sql --sql "SELECT COUNT(*) AS n FROM orders"
Example validation:
python skill/scripts/validate_answer.py input/payloads/answer_template.json answer.json
Query Discipline
- Keep SQL in CTEs so cohort membership, effective rows, rollups, and final formatting are inspectable.
- Confirm denominators separately from metric queries.
- Inspect distinct status, event type, priority, currency, and reason-code values before assuming enum contents.
- Use ISO-8601 UTC text comparisons directly only when both sides use the same stored UTC format.
- Apply inclusive and exclusive boundaries exactly as written. If the request says a date range is inclusive, include both endpoints.
- Round only final reported metrics unless the request says intermediate rounding is required.
- Order ranked output by unrounded metric values first, then apply the stated tie breakers.
- Return arrays in the stated order; use ascending identifier order when the template or request requires sorted IDs.
Atlas Data Patterns
- Treat production account filters as excluding internal and test accounts when the request refers to production accounts or production customers.
- Prefer append-only event tables for time-at-cutoff questions when the request defines effective status from events. Use denormalized
current_statusfields only when the request allows snapshot status. - For imported source rows that can recur on retries, deduplicate by the source identity described in the dictionary, usually
(source_system, external_event_id), keeping the latestingested_atand a stable row-id tie breaker. - For money, convert minor-unit fields to major currency units before FX conversion, join daily FX by row service date or requested valuation date, and round final displayed money to the requested decimals.
- For fulfillment, evaluate eligible orders against campaign/account/warehouse scope, then determine completion from physical shipments and effective carrier delivery state at the cutoff.
- For refunds, distinguish logical refund IDs from retry rows, subtract effective linked reversals, rank normalized reasons by effective net amount, and test leakage candidates at the order level.
- For warehouse productivity, scope eligible tasks by warehouse, production work class, and created window; derive completion, units, productive minutes, rework, delay, employee, and team metrics at the requested cutoff.
- For support health, scope eligible cases through accounts and opened-window criteria, reconstruct active state and response/resolution timing from case events, and use cutoff elapsed active time for unresolved obligations.
Controlled Corrections
Use mutations only when the request explicitly asks for a correction.
- Identify the single approved target row and canonical field with read-only SQL.
- Preserve raw source fields, source identity fields, and unrelated rows.
- Check existing audit rows for the target correction key and source row before mutating.
- Submit one transaction containing a guarded
UPDATEand onecorrection_auditINSERT. - Set
expected_total_changesto the exact number of intended changed rows. - Guard the update by row id, old value, and relevant scope fields so repeated or wrong-scope runs do not modify extra rows.
- Verify affected business rows, inserted audit rows, post-change canonical value, and any requested pre/post metric delta.
- Report the template's success status only if the request's success rule is satisfied; otherwise report the template's failure status with the actual observed result.
Output Rules
- Match the answer template exactly, including required fields, nested object shapes, enum values, arrays, and
additionalPropertiesoradditional_propertiesrestrictions. - Emit JSON numbers for numeric metrics, not strings.
- Use
nullonly if the template permits it. - Do not include markdown, comments, SQL, explanation, or extra fields in the answer file.