{
  "name": "PourCount keg, cups, and ice calculator",
  "description": "Estimates a practical US keg mix, disposable cups, and ice (pounds) for weddings, parties, and events. Also estimates wine and spirits bottles for the non-beer share of drinks.",
  "version": "1.0.0",
  "inLanguage": "en-US",
  "homepage": "/keg/",
  "llmsTxt": "/keg/llms.txt",
  "units": {
    "pourFluidOunces": 12,
    "gallonFluidOunces": 128,
    "iceBagPounds": 10,
    "wineServingsPer750ml": 5,
    "spiritPoursPer750ml": 16,
    "spiritPourFluidOunces": 1.5
  },
  "kegSizes": [
    {
      "id": "half",
      "label": "Half barrel",
      "short": "1/2 bbl",
      "gallons": 15.5,
      "listedPours": 165,
      "tubIceLbs": 40
    },
    {
      "id": "quarter",
      "label": "Quarter barrel (pony)",
      "short": "1/4 bbl",
      "gallons": 7.75,
      "listedPours": 82,
      "tubIceLbs": 25
    },
    {
      "id": "sixtel",
      "label": "Sixtel (1/6 barrel)",
      "short": "1/6 bbl",
      "gallons": 5.17,
      "listedPours": 55,
      "tubIceLbs": 20
    }
  ],
  "defaults": {
    "guests": 100,
    "percentDrinkers": 80,
    "hours": 4,
    "firstHourRate": 1,
    "afterHourRate": 0.75,
    "beerShare": 70,
    "wineShareOfRest": 60,
    "foamLoss": 0.08,
    "availableSizes": [
      "half",
      "quarter",
      "sixtel"
    ],
    "outdoorWarm": false,
    "pourOz": 12
  },
  "formulas": {
    "drinkers": "guests * (percentDrinkers / 100)",
    "drinksPerDrinker": "firstHourRate * min(1, hours) + afterHourRate * max(0, hours - 1)",
    "totalDrinks": "drinkers * drinksPerDrinker",
    "beerDrinks": "totalDrinks * (beerShare / 100)",
    "restDrinks": "totalDrinks - beerDrinks",
    "wineDrinks": "restDrinks * (wineShareOfRest / 100)",
    "spiritDrinks": "restDrinks - wineDrinks",
    "usablePoursPerKeg": "floor(listedPours * (1 - foamLoss))",
    "listedPours": "floor-ish gallons * 128 / pourOz; published as 165 / 82 / 55 for a 12 oz pour",
    "kegMix": "Enumerate practical combinations of the selected keg sizes. Choose the mix that covers beerDrinks (scaled if pourOz is not 12) with the lowest leftover + 22 * kegCount, with a small preference for including a half barrel when at least 90 beers are needed.",
    "cups": "ceilTo(ceil(totalDrinks * 1.2 + nonDrinkers * 1), 25), but never less than guests (0 if guests is 0)",
    "tubIcePounds": "40 per half barrel + 25 per quarter + 20 per sixtel; * 1.4 if outdoorWarm; * (1 + 0.1 * min(4, hours - 5)) if hours > 5",
    "servingIcePounds": "ceil(guests * (0.75 + (1 - beerShare/100) * 0.5 + extra for hours > 3)), * 1.25 if outdoorWarm",
    "iceTotalPounds": "ceil(tubIce) + servingIce",
    "iceBags10lb": "ceil(iceTotal / 10)",
    "wineBottles750ml": "ceil(wineDrinks / 5)",
    "spiritBottles750ml": "ceil(spiritDrinks / 16)"
  },
  "parameters": {
    "guests": {
      "type": "number",
      "min": 0,
      "max": 5000,
      "default": 100,
      "description": "Total guest count, including non-drinkers."
    },
    "percentDrinkers": {
      "type": "number",
      "aliases": [
        "drinkers"
      ],
      "min": 0,
      "max": 100,
      "default": 80,
      "description": "Percent of guests who will drink alcohol."
    },
    "hours": {
      "type": "number",
      "min": 0,
      "max": 24,
      "default": 4,
      "description": "Event length in hours."
    },
    "firstHourRate": {
      "type": "number",
      "min": 0,
      "max": 6,
      "default": 1,
      "description": "Drinks per drinker in the first hour."
    },
    "afterHourRate": {
      "type": "number",
      "min": 0,
      "max": 6,
      "default": 0.75,
      "description": "Drinks per drinker in each hour after the first."
    },
    "beerShare": {
      "type": "number",
      "aliases": [
        "beer"
      ],
      "min": 0,
      "max": 100,
      "default": 70,
      "description": "Percent of alcoholic drinks that are beer."
    },
    "wineShareOfRest": {
      "type": "number",
      "aliases": [
        "wine"
      ],
      "min": 0,
      "max": 100,
      "default": 60,
      "description": "Percent of the non-beer drinks that are wine; the rest are spirits."
    },
    "foamLoss": {
      "type": "number",
      "min": 0,
      "max": 0.25,
      "default": 0.08,
      "description": "Fraction of keg volume reserved for foam and over-pour. Values greater than 1 in the query string are treated as percents (8 means 0.08)."
    },
    "availableSizes": {
      "type": "array",
      "aliases": [
        "sizes"
      ],
      "values": [
        "half",
        "quarter",
        "sixtel"
      ],
      "default": [
        "half",
        "quarter",
        "sixtel"
      ],
      "description": "Keg sizes the host can actually obtain. In the query string, a comma-separated list."
    },
    "outdoorWarm": {
      "type": "boolean",
      "aliases": [
        "outdoor",
        "warm"
      ],
      "default": false,
      "description": "Set true for outdoor or hot-weather service. Accepts 1, true, yes, on."
    },
    "pourOz": {
      "type": "number",
      "min": 6,
      "max": 20,
      "default": 12,
      "description": "Pour size in US fluid ounces."
    }
  },
  "api": {
    "calculate": {
      "urls": [
        "/api/keg/calculate",
        "/api/keg",
        "/.netlify/functions/keg"
      ],
      "methods": [
        "GET",
        "POST"
      ],
      "exampleGet": "/api/keg/calculate?guests=100&drinkers=80&hours=4&beer=70",
      "exampleGetOutdoor": "/api/keg/calculate?guests=80&drinkers=75&hours=5&beer=60&outdoor=1&sizes=half,sixtel",
      "postBody": "JSON object using the same parameter names as the query string.",
      "cors": true,
      "response": "JSON with ok, spec, defaults, kegSizes, and result (the full calculation object)."
    },
    "spec": {
      "url": "/keg/api/keg.json",
      "method": "GET",
      "description": "This document: formulas, defaults, keg sizes, and a worked example. Available even if serverless functions are not."
    }
  },
  "example": {
    "input": {
      "guests": 100,
      "percentDrinkers": 80,
      "hours": 4,
      "firstHourRate": 1,
      "afterHourRate": 0.75,
      "beerShare": 70,
      "wineShareOfRest": 60,
      "foamLoss": 0.08,
      "availableSizes": [
        "half",
        "quarter",
        "sixtel"
      ],
      "outdoorWarm": false,
      "pourOz": 12
    },
    "result": {
      "inputs": {
        "guests": 100,
        "percentDrinkers": 80,
        "hours": 4,
        "firstHourRate": 1,
        "afterHourRate": 0.75,
        "beerShare": 70,
        "wineShareOfRest": 60,
        "foamLoss": 0.08,
        "availableSizes": [
          "half",
          "quarter",
          "sixtel"
        ],
        "outdoorWarm": false,
        "pourOz": 12
      },
      "drinkers": 80,
      "nonDrinkers": 20,
      "drinksPerDrinker": 3.3,
      "totalDrinks": 260,
      "beerDrinks": 182,
      "wineDrinks": 46.8,
      "spiritDrinks": 31.2,
      "beerPoursNeeded": 182,
      "kegs": [
        {
          "id": "half",
          "label": "Half barrel",
          "short": "1/2 bbl",
          "count": 1,
          "gallons": 15.5,
          "listedPours": 165,
          "usablePours": 151,
          "totalUsable": 151,
          "totalListed": 165,
          "tubIceLbs": 40
        },
        {
          "id": "sixtel",
          "label": "Sixtel (1/6 barrel)",
          "short": "1/6 bbl",
          "count": 1,
          "gallons": 5.17,
          "listedPours": 55,
          "usablePours": 50,
          "totalUsable": 50,
          "totalListed": 55,
          "tubIceLbs": 20
        }
      ],
      "kegCount": 2,
      "totalUsablePours": 201,
      "totalListedPours": 220,
      "leftoverBeer": 19,
      "kegNote": null,
      "cups": 350,
      "ice": {
        "tubLbs": 60,
        "servingLbs": 105,
        "totalLbs": 165,
        "bags10lb": 17
      },
      "wineBottles750ml": 10,
      "spiritBottles750ml": 2,
      "checklist": [
        {
          "id": "jockey-box",
          "title": "Jockey box or CO2 tap system",
          "detail": "For a wedding or any event over a few hours, a jockey box (coils packed in ice, pushed by CO2) keeps beer cold and cuts foam. A picnic pump is fine for a short backyard keg, but beer warms and foams once you pump air into the keg.",
          "priority": "essential"
        },
        {
          "id": "tubs",
          "title": "2 keg tubs (or a large stock tank)",
          "detail": "Each keg should sit in its own tub, or in a large tank, with ice packed around the sides and a little cold water. Do not bury the valve or the pump well. Plan a way to drain meltwater so the keg does not float and tip.",
          "priority": "essential"
        },
        {
          "id": "tap-backup",
          "title": "Backup tap and a wrench",
          "detail": "Bring a spare picnic pump or coupler and a simple wrench. Keg valves differ (D-system is the usual US beer valve). Confirm the coupler with your supplier when you pick up.",
          "priority": "recommended"
        },
        {
          "id": "cups",
          "title": "Cups (and a few wine glasses if you are pouring wine)",
          "detail": "16 oz plastic cups are the practical choice for a 12 oz beer pour plus head. Set a stack at the bar, not out on tables, so people do not grab extras they will lose.",
          "priority": "essential"
        },
        {
          "id": "ice",
          "title": "Bagged ice, plus a scoop and a cooler",
          "detail": "Buy ice the morning of the event if you can. Keep serving ice in a separate cooler from the keg tubs so drink ice stays clean. A scoop beats guests' hands in the bag.",
          "priority": "essential"
        },
        {
          "id": "wine-bar",
          "title": "Wine key, bottle opener, and a small bar table",
          "detail": "Set wine and spirits on a separate table from the keg so the beer line does not stall. A simple bin for empties and a towel will save the table.",
          "priority": "recommended"
        },
        {
          "id": "pourer",
          "title": "Someone to pour and watch the kegs",
          "detail": "Assign one person to pour, swap kegs, and add ice. A self-serve pump at a big wedding is how you run out early or end up with a puddle of foam.",
          "priority": "recommended"
        },
        {
          "id": "extras",
          "title": "Trash bags, recycling, and a drip bucket",
          "detail": "Put a trash can next to the bar, a recycling bin for cans and bottles, and a small bucket under the tap. Pack paper towels. If the party is outdoors, add a pop-up or shade over the kegs — sun is the fastest way to foam.",
          "priority": "recommended"
        }
      ],
      "warnings": [],
      "assumptions": [
        "A standard US pour is 12 oz.",
        "A half barrel (15.5 gal) holds about 165 twelve-ounce pours before foam loss; a quarter barrel about 82; a sixtel about 55.",
        "Usable beer is reduced by 8% to cover foam, line loss, and over-pours.",
        "Drinking rate defaults to 1 drink per person in the first hour and 0.75 each hour after that.",
        "Non-beer drinks are split 60% wine / 40% spirits unless you change that.",
        "Wine is estimated at 5 glasses per 750 ml bottle. Spirits are estimated at 16 (1.5 oz) pours per 750 ml bottle.",
        "Tub ice is 40 lb per half barrel, 25 lb per quarter, and 20 lb per sixtel, with more for heat or long events.",
        "Serving ice is separate from keg-tub ice and is based on guest count, drink mix, length, and weather."
      ]
    }
  }
}
