// Proves the nutrition panel and health score end to end against the LIVE // catalogue-intelligence service — no database, no Fiesta, just the piece that // was built. // // go run ./scratch/nutritionproof # known products // go run ./scratch/nutritionproof # any product // // Prints what `getproductbyvariant` will put on the product once deployed. package main import ( "encoding/json" "fmt" "os" "nearle/models" "nearle/services" ) func main() { base := os.Getenv("NUTRITION_BASE") if base == "" { base = "https://mcp.nearle.ai.in/api" } service := services.NewNutritionService(base) // Real products from tenant 1147, checked against the live service on // 29 Sep 2026: one the service has scored, one it has nothing for, and one // that is not food — which must come back with no score whatever the // service says, because that endpoint is not gated for edibility. products := []models.Products{ {Productid: 7101, Productbrand: "balaji", Imageid: "balaji_balaji_wafers_simply_salted_135g", Productname: "Balaji Wafers Simply Salted 135g (scored)"}, {Productid: 7093, Productbrand: "patanjali", Imageid: "patanjali_patanjali_cow_ghee_500ml", Productname: "Patanjali Cow Ghee 500ml (no data)"}, {Productid: 7121, Productbrand: "godrej", Imageid: "godrej_godrej_no1_sandal_and_turmeric_soap_100g", Productname: "Godrej No.1 Soap 100g (not food)"}, } if len(os.Args) == 3 { products = []models.Products{{ Productbrand: os.Args[1], Imageid: os.Args[2], Productname: os.Args[1] + "/" + os.Args[2], }} } for i := range products { found := service.ForProduct(products[i].Productbrand, products[i].Imageid) products[i].Nutrition = found.Panel products[i].Healthscore = found.Health fmt.Printf("\n---- %s ----\n", products[i].Productname) encoded, _ := json.MarshalIndent(map[string]any{ "nutrition": products[i].Nutrition, "healthscore": products[i].Healthscore, }, "", " ") fmt.Println(string(encoded)) } }