Skip to content

Cookbook: rules and compliance

The question. Which records break which rule, and has anyone accepted the exception?

Three tools, from simplest to most specific.

A shape states what data must look like. For example, a quality test value must be present and numeric, or a lot must name a farm. Import shapes with POST /validation/shapes/import; preview them first with POST /validation/shapes/preview to see what would change.

Terminal window
curl -X POST "$URL/validation/runs" -H "Authorization: Bearer $TOKEN" -H "x-graphowl-workspace: dairy-coop"
curl "$URL/validation/report?limit=20" -H "Authorization: Bearer $TOKEN" -H "x-graphowl-workspace: dairy-coop"

The report lists violations worst first, with total and paging. An empty report with computedAt: null means it has not run, not that the data is clean.

When a violation is accepted, record a waiver (/validation/waivers) with the reason. A waived violation stays visible as a decision, so the exception is auditable instead of invisible.

An expectation is a named quality check with a pass and fail count, for example “every lot has a farm”. They are listed at /validation/expectations, and preview_expectations and explain_expectation from an agent show what a check would do and why.

The dairy data has a limit of 400,000 for somatic cell count. Keep the limit as a parameter of the pack (it is an example, not a regulatory value) rather than in query text, so the rule and its threshold are reviewed like any other model change.

  • A rule is data, with an author and a review, like everything else.
  • Validation never changes the data; it reports.
  • A decision (waiver) is a fact too, so the history of “we knew and accepted it” is queryable.

See Reason and validate for the routes.