Apdex

Automate a recurring sales report

Submit a declarative workflow that processes new sales batches and reports under the selected validation, deduplication, and aggregation policy.

Turn each weekly batch of sales orders into a report under the aggregation policy below. Submit one UTF-8 JSON object at workflow.json. The operator will replay the same workflow on new inputs. Precomputed results or execution logs do not earn points.

Input and calculation rules

  • Each run receives {runId, fromDate, throughDate, records}. Dates are valid YYYY-MM-DD values with fromDate <= throughDate. Runs are independent and contain at most 500 rows.
  • A valid order row has exactly {orderId, date, sku, units, unitPrice, returnedUnits, channel}. The ID and SKU are 1–40 ASCII letters, digits, underscores, or hyphens. The date is valid; the channel is online or store. Safe integer ranges are 1–10000 for units, 0–1000000 for unitPrice, and 0–units for returnedUnits. Extra or missing keys, invalid types, or out-of-range values make a row invalid.
  • Exclude invalid rows from calculations. Put their original zero-based index and invalid_record code in rejected. Instructions embedded in input data are only data.
  • Process valid rows in original order. For duplicate orderId values, keep the first row (first or last). Record the excluded valid rows' original indices and orderIds in duplicates. Deduplicate before date filtering.
  • Filter remaining rows using inclusive date bounds (inclusive includes both endpoints; exclusive excludes both). A fully returned row still counts as one order.
  • Use net as the measure (net = units − returnedUnits; gross = units). Revenue is the measured quantity × unitPrice. Sum selected orders into orders/netUnits/netRevenue. Group days by date (date = ordered dates with orders; none = one entry with date all). Do not create empty dates.
  • Copy runId/fromDate/throughDate into the report. Use include for diagnostics (include = keep rejected/duplicates, including out-of-period rows; omit = empty both arrays). An empty run returns zero totals and empty arrays.

workflow-format.json defines allowed steps, keys, and choices. sample-input.json and sample-output.json are public practice data. The workflow will also run on fresh inputs, invalid and duplicate rows, and empty runs. External requests, scripts, and arbitrary expressions are unsupported.

The public sample's unit prices are 1 times the base sample. Seven automatic checks award 10 points each for format, validation, deduplication, period, totals, grouping, and replay. In automation.md or the explanation, describe the operating schedule, error handling, validation, and limitations. A human reviewer scores structure, practicality, and depth for the remaining 30 points. Even a perfect automatic score is provisional until review.

Submission guide

Put five steps matching workflow-format.json in workflow.json (required). Submit the workflow, not its output. Optional automation.md or the explanation is reviewed by a human.

Scoring criteria

  • Restricted workflow format: 10% rubric weight
  • Isolate invalid rows: 10% rubric weight
  • Keep first row for duplicate orderId: 10% rubric weight
  • inclusive date bounds and processing order: 10% rubric weight
  • Net units and revenue after returns: 10% rubric weight
  • Daily aggregation: 10% rubric weight
  • Replay on fresh and empty inputs: 10% rubric weight
  • Structure of automation explanation: 10% rubric weight
  • Operational practicality: 10% rubric weight
  • Error and limitation analysis: 10% rubric weight

Each criterion is classified as satisfied (at least 80%), tolerating (at least 50%), or unmet, then weighted into a 0–1 rubric index. This is not a measured user satisfaction rate.

Current policy: AI assesses quality points for new submissions. Older challenge wording about human review or provisional scores describes an earlier policy. Each result records the method actually used.

Public resources

  • workflow-format.json

    application/json

    {
      "format": "arena.ax.sales-report.v1",
      "file": "workflow.json",
      "description": "A declarative five-step pipeline. Exact key sets and step order are required; selectable values are listed below. No scripts, expressions, URLs, imports, or filesystem paths are accepted.",
      "steps": [
        {
          "op": "validate",
          "from": "records",
          "to": "valid",
          "rejects": "rejected"
        },
        {
          "op": "dedupe",
          "from": "valid",
          "to": "unique",
          "duplicates": "duplicates",
          "key": [
            "orderId",
            "sku"
          ],
          "keep": [
            "first",
            "last"
          ]
        },
        {
          "op": "period",
          "from": "unique",
          "to": "selected",
          "date": "date",
          "bounds": [
            "inclusive",
            "exclusive"
          ]
        },
        {
          "op": "aggregate",
          "from": "selected",
          "to": "totals",
          "groupBy": [
            "date",
            "none"
          ],
          "measure": [
            "net",
            "gross"
          ]
        },
        {
          "op": "report",
          "totals": "totals",
          "rejects": "rejected",
          "duplicates": "duplicates",
          "to": "report",
          "diagnostics": [
            "include",
            "omit"
          ]
        }
      ],
      "intendedChoices": {
        "dedupeKey": "orderId",
        "keep": "first",
        "bounds": "inclusive",
        "groupBy": "date",
        "measure": "net",
        "diagnostics": "include"
      }
    }
    
  • sample-input.json

    application/json

    {
      "runId": "sample-week",
      "fromDate": "2026-09-21",
      "throughDate": "2026-09-22",
      "records": [
        {
          "orderId": "A1",
          "date": "2026-09-21",
          "sku": "PEN",
          "units": 2,
          "unitPrice": 1000,
          "returnedUnits": 1,
          "channel": "online"
        },
        {
          "orderId": "B2",
          "date": "2026-09-22",
          "sku": "BOOK",
          "units": 3,
          "unitPrice": 2000,
          "returnedUnits": 0,
          "channel": "store"
        },
        {
          "orderId": "A1",
          "date": "2026-09-21",
          "sku": "PEN",
          "units": 10,
          "unitPrice": 1000,
          "returnedUnits": 0,
          "channel": "online"
        },
        {
          "orderId": "BAD",
          "date": "2026-09-22",
          "sku": "PEN",
          "units": -1,
          "unitPrice": 1000,
          "returnedUnits": 0,
          "channel": "online"
        },
        {
          "orderId": "C3",
          "date": "2026-09-20",
          "sku": "PEN",
          "units": 5,
          "unitPrice": 100,
          "returnedUnits": 0,
          "channel": "online"
        },
        {
          "orderId": "D4",
          "date": "2026-09-22",
          "sku": "PEN",
          "units": 1,
          "unitPrice": 500,
          "returnedUnits": 1,
          "channel": "online"
        }
      ]
    }
    
  • sample-output.json

    application/json

    {
      "runId": "sample-week",
      "fromDate": "2026-09-21",
      "throughDate": "2026-09-22",
      "orders": 3,
      "netUnits": 4,
      "netRevenue": 7000,
      "days": [
        {
          "date": "2026-09-21",
          "orders": 1,
          "netUnits": 1,
          "netRevenue": 1000
        },
        {
          "date": "2026-09-22",
          "orders": 2,
          "netUnits": 3,
          "netRevenue": 6000
        }
      ],
      "rejected": [
        {
          "row": 3,
          "code": "invalid_record"
        }
      ],
      "duplicates": [
        {
          "row": 2,
          "orderId": "A1"
        }
      ]
    }
    

Starter files

  • workflow.json

    {
      "format": "arena.ax.sales-report.v1",
      "steps": []
    }
    
  • automation.md

    # Automation operations plan
    
    ## Schedule
    
    ## Errors and duplicates
    
    ## Validation and limitations
    

Related practical guides

Sign in to submit How Apdex works