-
Notifications
You must be signed in to change notification settings - Fork 32
Core Concepts and Data Model
KitchenPC separates recipe-domain operations from storage and user interfaces.
IKPCContext is the engine boundary. It selects data loading, persistence, the current user, and available in-memory indexes. Initialize one context at application startup and reuse it.
AuthIdentity contains a user ID and alias. Database-backed menus, queues, ratings, and shopping lists are scoped through context.Identity.
var anonymous = AuthIdentity.Anonymous;
var user = new AuthIdentity(userId, "Ada");
IKPCContext userContext = dbContext.AsUserContext(user);AsUserContext creates a lightweight identity-specific view; it does not rebuild indexes.
Domain objects can identify records without loading them:
var recipe = Recipe.FromId(recipeId);
var ingredient = Ingredient.FromId(ingredientId);
var menu = Menu.FromId(menuId);Use context.Recipes.Load(...).List() when fields are required. Fluent calls accept references so several IDs can be batched into one adapter operation.
-
Ingredientis a normalized food, such as milk or banana. -
IngredientFormdescribes a measurable form, such as whole, chopped, or melted. -
Amountcombines a numeric size with aUnitsvalue. -
IngredientUsagebinds ingredient, form, amount, preparation note, and optional recipe section. -
IngredientAggregationis the normalized output of combining compatible usages.
Conversion depends on form metadata in the store. Weight, volume, and whole-unit expressions are not automatically interchangeable unless KitchenPC knows the required form ratios.
Recipe holds descriptive fields, time, yield, tags, method, image, rating data, and structured ingredient sections. RecipeBrief is a smaller search and queue representation. RecipeTags is a flag set covering meal, diet, nutrition, taste, and skill classifications.
The categorization subsystem can infer classifications from recipe text, ingredients, quantities, and ingredient metadata. Recipe search exposes these as filters.
Fluent objects collect an operation until a terminal method executes it:
- reads:
List()/ListAsync(); - search:
Results()/ResultsAsync(); - mutations:
Commit()and, where available,CommitAsync(); - modeling:
Generate()/Compile().
StaticContext is a read-mostly snapshot playground. DBContext delegates persistence to IDBAdapter. The supplied DatabaseAdapter stores recipes, ratings, menus, queues, shopping lists, ingredient metadata, and NLP data in a relational schema.
The physical PostgreSQL ingredient catalog table is named shoppingingredients for compatibility with the production KitchenPC website. Public APIs use the simpler ingredient terminology.
KitchenPC is MIT licensed. Runnable applications live in KitchenPC/Samples.