Skip to content
An Indefinite ntegral Evidence. Questions. Everything.
--:--:--

Inspectable TID / Market Gaps material. No interpretation is generated from this file. public_test

Economic model

Inspectable calculation code; not a forecast.

Collection Economics and failure conditions Type PYTHON Size 2122 bytes Original /assets/market-gaps/100-burger-a-day/09_TOOLS/economic_model_v0_1.py

Python source

45 lines
#!/usr/bin/env python3
import json, sys, math

def calculate(x):
    sold = float(x["sold_combos"])
    price = float(x["price_incl_vat_dkk"])
    vat = float(x["vat_rate"])
    revenue_ex = price/(1+vat)
    patties = float(x["premium_patties_consumed"])
    patty_g = float(x["patty_weight_raw_g"])
    reserve_factor = patties/sold
    beef_kg = patties*patty_g/1000
    food = float(x["food_cogs_per_sold_combo_dkk"])*sold
    owner_h = float(x["owner_operator_hours_total"])
    owner_value = float(x["owner_hour_value_dkk"])
    owner_labour = owner_h*owner_value
    support = float(x.get("support_cost_per_day_dkk",0))
    other = float(x.get("other_variable_cost_per_combo_dkk",0))*sold
    sales_ex = revenue_ex*sold
    cash_contribution = sales_ex-food-support-other
    economic_contribution = cash_contribution-owner_labour
    nominal = float(x["nominal_premium_patties_per_animal"])
    effective_sold_per_animal = nominal/reserve_factor
    animals_per_100_sale_days = (sold*100)/effective_sold_per_animal
    weekly_oh = float(x.get("fixed_overhead_per_week_dkk",0))
    break_even_days = None if economic_contribution <= 0 else weekly_oh/economic_contribution
    return {
        "revenue_ex_vat_per_combo_dkk": round(revenue_ex,2),
        "sales_ex_vat_per_day_dkk": round(sales_ex,2),
        "reserve_factor": round(reserve_factor,4),
        "premium_beef_kg_consumed": round(beef_kg,3),
        "owner_labour_cost_day_dkk": round(owner_labour,2),
        "cash_contribution_day_dkk": round(cash_contribution,2),
        "economic_contribution_day_dkk": round(economic_contribution,2),
        "economic_contribution_per_sold_combo_dkk": round(economic_contribution/sold,2),
        "effective_sold_burgers_per_animal": round(effective_sold_per_animal,1),
        "break_even_open_days_per_week": None if break_even_days is None else round(break_even_days,2),
    }

if __name__ == "__main__":
    path = sys.argv[1] if len(sys.argv) > 1 else "data/economic_inputs_example.json"
    with open(path, "r", encoding="utf-8") as f:
        x=json.load(f)
    print(json.dumps(calculate(x), indent=2))