{
  "templateName": "Restaurant Food Inventory Template with Purchase Units",
  "format": "Editable relational CSV/spreadsheet template",
  "syntheticDataOnly": true,
  "files": [
    "sample.csv",
    "purchase_units.csv",
    "count_sessions.csv",
    "count_lines.csv"
  ],
  "entities": [
    "ingredients",
    "purchase_units",
    "count_sessions",
    "count_lines",
    "purchase_requests"
  ],
  "fieldsByFile": {
    "sample.csv": [
      "ingredient_id",
      "ingredient_name",
      "dimension",
      "base_unit",
      "purchase_unit_id",
      "base_units_per_pack",
      "full_packs_on_hand",
      "loose_base_units",
      "on_hand_base_units",
      "target_base_units",
      "shortage_base_units",
      "order_packs",
      "data_label"
    ],
    "purchase_units.csv": [
      "purchase_unit_id",
      "ingredient_id",
      "pack_name",
      "base_units_per_pack",
      "base_unit",
      "data_label"
    ],
    "count_sessions.csv": [
      "session_id",
      "location_id",
      "counted_at",
      "counted_by",
      "data_label"
    ],
    "count_lines.csv": [
      "line_id",
      "session_id",
      "ingredient_id",
      "purchase_unit_id",
      "full_packs_on_hand",
      "loose_base_units",
      "on_hand_base_units",
      "target_base_units",
      "order_packs",
      "data_label"
    ]
  },
  "validationRules": {
    "base unit is one of g/mL/each according to ingredient dimension": true,
    "never convert mass and volume without ingredient-specific measured data": true,
    "on hand = full packs x pack units + loose base units": true,
    "order packs = ceil(max(0,target-on-hand)/pack size)": true
  }
}
