Skip to content

Weekly stock count ​

Every Monday at 07:00, the stock is counted, compared with the minimum of each item, and what is missing is ordered.

In words ​

The wishKnow every Monday what is missing from the shelves, and order it

Step 1 · count

What to doExport the stock count to stock/count.csv.
Who does itAn algorithm runs stock-export --out stock/count.csv
What proves itThe command ends without an error.

Step 2 · compare

What to doCompare stock/count.csv with stock/minimum.csv and write stock/missing.csv: each item under its minimum, with how many to order.
Who does itAn agent
What proves it
  • These must be there: stock/missing.csv
  • A command must pass: stock-verify stock/count.csv stock/minimum.csv stock/missing.csv

Step 3 · order

What to doRead stock/missing.csv and place the order with the suppliers.
Who does itA person
What proves itTheir word stands.

The file ​

json
{
  "$schema": "vpf/1",
  "wish": "Know every Monday what is missing from the shelves, and order it",
  "start": {
    "on": "schedule",
    "days": [
      "mon"
    ],
    "time": "07:00"
  },
  "steps": [
    {
      "id": "count",
      "do": "Export the stock count to stock/count.csv.",
      "by": "algorithm",
      "run": "stock-export --out stock/count.csv"
    },
    {
      "id": "compare",
      "do": "Compare stock/count.csv with stock/minimum.csv and write stock/missing.csv: each item under its minimum, with how many to order.",
      "by": "agent",
      "tools": [
        "read",
        "write"
      ],
      "proof": [
        {
          "by": "algorithm",
          "needs": [
            {
              "need": "files",
              "path": "stock/missing.csv"
            }
          ]
        },
        {
          "by": "algorithm",
          "run": "stock-verify stock/count.csv stock/minimum.csv stock/missing.csv"
        }
      ]
    },
    {
      "id": "order",
      "do": "Read stock/missing.csv and place the order with the suppliers.",
      "by": "person"
    }
  ]
}

Why it is written this way ​

The plan starts on a schedule. The comparison is proven by a command that recounts it, with no model asked, and a person places the order.

Code, schema and examples under the Apache License 2.0. Guide text also under CC BY 4.0.