Skip to content

06 — Shopping & Coordination Module

Version: 1.20
Last Updated: 2026-08-06 13:58:52

Status: Implemented in this repository (API + /shopping UI + SSE sync + super-admin catalog). Treat this document as the behavioural and UX spec; where the app differs, 02-REQUIREMENTS.md §3.8, §7.9 and the code win.

Master requirements: 02-REQUIREMENTS.md · Tier: Complete only (backend/billing/tiers.json) · Phase: 04-ROADMAP.md Phase 7 (delivered)

Supersedes: 06-SHOPPING-ESSENTIALS-MODULE.md (retired)
Module slug: shopping

Implementation notes (code vs original spec)

Section titled “Implementation notes (code vs original spec)”
TopicIn code
Core lists + catalog + SSEDone — routers/shopping.py, services/shopping_service.py, frontend/src/pages/Shopping.tsx
Recurring resetDone — APScheduler 06:00 per tenant timezone
Super-admin catalogDone — routers/admin_shopping.py, /admin/shopping-catalog
Dashboard / shift widgetsDone — ShoppingDashboardWidget wired in Dashboard.tsx (self-gates on shopping module). ShoppingShiftWidget remains optional on shift detail.
Calm Care UI (/shopping)Done (2026-05-30) — Calm Care migration per 03-DESIGN-SYSTEM.md §8. Active list: horizontal ShoppingListRow inside cc-card. Desktop: inline ± quantity, sage purchase check, remove. Mobile (≤639px): single-line row — swipe right → Purchased, swipe left → Remove (SwipeActionRow); tap qty pill for ± sheet. Catalog browse + search: AddItemsSheet bottom sheet (mobile FAB + desktop dashed “Add items”). List tabs: cc-chip row. Purchased before: collapsed by default (PurchasedSection); expanded strip uses PurchasedTile (same proportions as CatalogItemTile). Legacy ShoppingItemCard tile grid retained for unit tests only. List tab state (2026-05-31): Shopping.tsx reconciles activeListId after every list fetch and resets on patient change — prevents 404 item fetches when a list was deleted elsewhere. Catalog icon rendering (2026-06-01): IconResolver treats browser-cached raster assets as ready when img.complete && naturalWidth > 0 (cached images may not fire onLoad). Catalog picker surfaces pass loadPriority="eager" (CatalogItemTile, PurchasedTile, CategoryBrowser) — prevents blank gray pulse placeholders on product tiles in AddItemsSheet.
Custom product photosDone — POST/GET/DELETE …/items/{id}/image; catalog/suggestion photo routes; files in UPLOADS_DIR/<tenant_id>/ via services/images.py (save_shopping_item_image(..., tenant_id)). Served only through authenticated routes — not static /uploads. Stale reference self-heal: if GET …/image finds photo_url set but the file is missing on disk, repositories/shopping.clear_stale_photo_url clears that filename for the tenant and returns 404; list rows and tiles fall back to the catalog icon and drop the stale URL from local state.

  1. Vision & Purpose
  2. Deployment Modes
  3. Subscription & Monetisation
  4. List Types & Category Architecture
  5. The Three-Tier Catalog
  6. User Roles & Permissions
  7. Item Lifecycle
  8. UX & Interaction Model
  9. Real-Time Sync
  10. Community Contribution & Catalog Moderation
  11. Database Schema
  12. API Design
  13. Backend Architecture
  14. Integration with LynCareOS Modules
  15. Implementation Task Breakdown
  16. Localisation & Internationalisation
  17. Expanded Catalog — Full Item Reference

The Shopping & Coordination module is a shared, real-time, needs-coordination tool for everyone supporting a care recipient. It answers one operational question at any moment:

“What does our person need, who is getting it, and has it been sorted?”

Unlike a grocery app, this module coordinates across multiple shoppers acting simultaneously at different locations. If ten items need buying, five people can each grab two from wherever they happen to be. Every purchase is visible to everyone else the moment it happens.

The module is not a pharmacy system. Prescriptions and medication restocking are a separate list context from groceries. Services (cleaning, physio) are a separate context from physical products. Lists are purposefully separated by context so no one is looking at milk and morphine in the same view.

  • One click to add. If an item has been bought before, it appears in “Used Before” — one tap re-adds it with the same quantity and unit as last time.
  • One action to purchase. Desktop: visible sage tick on every active item. Mobile: swipe right to reveal Purchased and commit (item leaves the active list).
  • One click to remove. A visible remove icon on every active item. Separate from purchased.
  • Real-time for everyone. When any user purchases or adds an item, every other connected user’s list updates within seconds.
  • Lists are separate contexts. Grocery, pharmacy, and services lists do not share items or views.

The module runs in two distinct tenanting modes depending on deployment context.

Lists are patient-scoped. Each list belongs to a specific patient being cared for. A user who supports two patients manages separate list sets for each.

Tenant (care organisation / family)
└── Patient: Mrs Thompson
├── List: Weekly Groceries
├── List: Chemist Run
└── List: Home Services

Access to a patient’s lists is controlled by patient_access — the same row that governs who can view that patient’s medications and shifts. All existing LynCareOS auth and isolation patterns apply without modification.

Lists are tenant-scoped (household-level). There is no patient record — the tenant itself is the owner.

Tenant (household)
├── List: Weekly Groceries
├── List: Chemist Run
└── List: Cleaning Supplies

In standalone mode, all tenant members have access to all lists. The patient_id column on every shopping table is NULL. The API URL structure changes from /api/patients/{id}/shopping/... to /api/shopping/... at the tenant level. No other code changes are required.

shopping_lists.patient_id is nullable. A DB check constraint enforces that in Mode A it is set and in Mode B it is null. The application layer detects mode from the subscription context flag standalone_mode on the tenant record. API handlers branch on this flag to determine whether to enforce patient_access checks or tenant-level membership checks.

Mode B status: not built in this repository. The separate product GetQwikShop (www.getqwik.shop) is being built at D:\Projects\GetQwikShop — see debt D4. Canonical design/plan live in that repo’s docs/superpowers/. LynCareOS historical note only. Building Mode B inside LynCareOS is not part of that effort.


The shopping module slug already exists in subscriptions and the MODULES tuple in database.py. No schema migration is needed for the subscription gate itself.

StateBehaviour
Active (includes shopping)Full access to all lists, catalog, and real-time sync
Active (without shopping)Shopping nav item visible with lock overlay; tapping shows upgrade prompt
TrialFull access; trial countdown banner shown at top of shopping screens
ExpiredAll lists read-only; no add/purchase/remove; expired banner shown
Standalone subscriptionTenant subscribes to shopping only; no clinical modules required

The shopping module is independently purchasable without any clinical modules. A household with no care needs can subscribe to shopping-only. This is enforced at the subscription level — require_module('shopping') has no dependency check on medication_dispensing or care_calendar.


Every catalog item, subcategory, and category carries an emoji as its primary visual identifier. Emoji are device-rendered, require no download, work on every platform, and are universally understood regardless of the user’s reading language. They are the first-phase icon strategy.

Each item tile in the Add panel displays:

┌────────────┐
│ 🥑 │ ← large emoji (32–40px)
│ Avocado │ ← localised display name
└────────────┘

The icon field on catalog_items stores the emoji character directly (e.g. 🥑). If an item has no emoji of its own, it inherits its subcategory’s emoji; if the subcategory has none, it inherits the category’s emoji. This three-level fallback ensures every item always has a visual identifier.

Phase 8 enhancement: The icon_type field ('emoji' | 'svg' | 'url') allows a future migration from emoji to custom SVG illustrations without changing the data model or API contract. The frontend renders based on icon_type: emoji renders as a Unicode character; SVG loads from /icons/catalog/; URL fetches from a CDN. The Phase 7 build uses emoji exclusively.

Subcategory substitute rasters (visual families): When an item does not yet have its own dedicated raster asset (or the file is missing), the UI falls back to the subcategory’s icon_type / icon_value — a single shared illustration for the whole subcategory. Treat this as a visual family, not a literal picture of every SKU. Example: every milk type listed under Milk & Alternatives (full cream milk, skim milk, almond milk, oat milk, soy milk, etc.) can share one milk bottle 3D asset on the subcategory row until per-item art exists. The same pattern applies elsewhere (e.g. one generic bread icon for all bread SKUs in Bread). Item-level icons still override when set.


Each list has a list_type that determines its default category set and visual identity.

List type slugDisplay nameDefault categories shownItem types
groceryGroceriesFruit & Veg, Meat & Seafood, Dairy & Eggs, Bakery, Pantry, Frozen, Drinks, SnacksProducts
pharmacyPharmacy & MedicalMedications, Medical Supplies, Wound Care, Equipment & AidsProducts
personal_carePersonal CareBody Care, Hair Care, Oral Care, Clothing, GroomingProducts
householdHouseholdCleaning, Laundry, Paper Goods, Kitchen SuppliesProducts
servicesServicesHome Care, Allied Health, Personal Services, TradesServices
equipmentEquipmentMobility Aids, Bathroom Aids, Pressure Care, Communication AidsProducts
generalGeneralAll categoriesBoth

A tenant can have multiple active lists of any type. A patient might have a “Weekly Groceries” list and a separate “Coles Run This Weekend” list — both of type grocery.

The catalog is three levels deep: Category → Subcategory → Item. See Part 17 for the complete reference list. The tables below show the canonical structure with emoji icons and representative items.

Subcategory🏷Representative items
Fresh Fruit🍎Apple 🍎, Banana 🍌, Orange 🍊, Pear 🍐, Grapes 🍇, Strawberries 🍓, Blueberries 🫐, Raspberries, Blackberries, Watermelon 🍉, Rockmelon, Honeydew, Mango 🥭, Avocado 🥑, Lemon 🍋, Lime, Mandarin, Kiwifruit 🥝, Pineapple 🍍, Nectarines 🍑, Peaches, Plums, Cherries 🍒, Figs, Pomegranate, Dragon fruit, Lychee, Papaya
Fresh Vegetables🥦Potato 🥔, Sweet potato, Carrot 🥕, Onion 🧅, Red onion, Shallots, Spring onion, Leek, Garlic 🧄, Ginger, Broccoli 🥦, Cauliflower, Cabbage, Brussels sprouts, Zucchini, Eggplant 🍆, Capsicum 🫑, Chilli 🌶️, Corn 🌽, Asparagus, Green beans, Snow peas, Bok choy, Spinach, Kale, Silverbeet, Lettuce, Rocket, Beetroot, Pumpkin, Butternut pumpkin, Mushrooms 🍄, Celery, Fennel, Cucumber 🥒, Tomato 🍅, Cherry tomatoes, Radish, Parsnip
Salad & Herbs🌿Mixed salad leaves, Rocket, Coleslaw mix, Parsley 🌿, Coriander, Basil, Mint, Thyme, Rosemary, Dill, Chives, Lemongrass, Kaffir lime leaves
Pre-cut & Packaged Produce🥗Stir fry mix, Soup vegetables, Washed salad, Pre-cut fruit, Vegetable tray, Coleslaw pack
Deli & Charcuterie🧆Prosciutto, Pancetta, Mortadella, Pastrami, Smoked salmon slices, Roast chicken, Stuffed olives, Antipasto mix, Hummus tub, Tzatziki, Baba ghanoush
World Foods🌏Basmati rice, Jasmine rice, Sushi rice, Rice noodles, Udon noodles, Soba noodles, Ramen noodles, Coconut milk, Fish sauce, Oyster sauce, Hoisin sauce, Miso paste, Tahini, Harissa, Curry paste, Sambal, Sriracha, Nori sheets, Tofu, Tempeh, Edamame, Lemongrass, Kafir lime leaves, Garam masala, Sumac, Za’atar, Cardamom
Health & Organic🌱Chia seeds, Flaxseeds, Hemp seeds, Sunflower seeds, Pumpkin seeds, Activated nuts, Acai powder, Spirulina, Collagen powder, Protein powder, Nutritional yeast, Almond flour, Coconut flour, Oat milk, Almond milk, Coconut yogurt, Kefir, Kombucha, Apple cider vinegar, Coconut aminos, Organic honey
Specialty Dietary🔆Gluten free pasta, Gluten free bread, Gluten free flour, Gluten free oats, Dairy free cheese, Dairy free butter, Lactose free milk, Vegan sausages, Vegan mince, Vegan chicken, Plant-based burger patties, Tofu, Tempeh, Seitan, Chickpea pasta, Lentil pasta
Meat — Poultry🍗Chicken breast 🍗, Chicken thighs, Chicken wings, Chicken drumsticks, Whole chicken, Chicken mince, Turkey breast, Turkey mince, Duck breast, Quail
Meat — Beef🥩Beef mince 🥩, Beef steak, Eye fillet, Sirloin, Rump steak, Beef stir fry strips, Roast beef, Corned beef, Veal cutlets, Osso bucco
Meat — Pork & Lamb🥓Pork chops 🥓, Pork mince, Pork belly, Pork roast, Bacon, Pancetta, Ham, Prosciutto, Lamb chops, Lamb mince, Lamb roast, Lamb shanks, Rack of lamb
Processed Meats🌭Sausages 🌭, Chorizo, Salami, Pepperoni, Deli meats, Hot dogs, Kransky, Cabanossi
Seafood🐟Salmon 🐟, Tuna fillet, White fish fillets, Barramundi, Snapper, Flathead, Bream, Prawns 🦐, Shrimp, Crab 🦀, Mussels, Oysters 🦪, Scallops, Calamari, Octopus, Fish cakes, Fish fingers
Milk & Alternatives🥛Full cream milk 🥛, Skim milk, Reduced fat milk, Lactose free milk, A2 milk, Almond milk, Oat milk, Soy milk, Coconut milk, Rice milk, Macadamia milk, Hemp milk
Cheese🧀Cheddar 🧀, Mozzarella, Parmesan, Tasty cheese, Feta, Goat cheese, Brie, Camembert, Cream cheese, Ricotta, Cottage cheese, Haloumi, Colby, Edam, Gruyère, Swiss cheese, Blue cheese, Sliced cheese
Eggs🥚Free range eggs 🥚, Cage free eggs, Organic eggs, Barn laid eggs, Duck eggs
Butter & Spreads🧈Butter 🧈, Salted butter, Unsalted butter, Margarine, Spreadable butter, Ghee, Coconut oil spread
Yogurt & Dairy Desserts🫙Greek yogurt, Natural yogurt, Flavoured yogurt, Coconut yogurt, Dairy free yogurt, Custard, Rice pudding, Sour cream, Crème fraîche
Cream & Milk Products🍶Thickened cream, Light cream, Sour cream, Double cream, Condensed milk, Evaporated milk, Coconut cream, Buttermilk
Bread🍞White bread 🍞, Wholemeal bread, Multigrain bread, Sourdough, Gluten free bread, Rye bread, Spelt bread, Low-GI bread, Seeded bread
Bread Rolls & Buns🥖Bread rolls, Burger buns, Hot dog rolls, Bagels 🥯, Brioche rolls, Slider buns
Pastries & Sweet Bakery🥐Croissants 🥐, Danishes, Pain au chocolat, Scrolls, Donuts, Cinnamon rolls, Kouign-amann
Flatbreads🫓Wraps 🫓, Tortillas, Naan, Pita bread, Mountain bread, Lavash, Chapati, Roti
Cakes & Slices🧁Muffins 🧁, Cupcakes, Cake, Banana bread, Lamingtons, Brownies, Bliss balls, Protein balls
Rice, Pasta & Grains🍝White rice, Brown rice, Basmati rice 🍝, Jasmine rice, Sushi rice, Pasta, Spaghetti, Penne, Fusilli, Rigatoni, Fettuccine, Lasagne sheets, Orzo, Gnocchi, Noodles, Quinoa, Couscous, Bulgur wheat, Polenta, Rolled oats, Steel cut oats, Barley, Freekeh
Canned & Jarred Goods🥫Canned tomatoes 🥫, Tomato paste, Diced tomatoes, Crushed tomatoes, Canned beans, Chickpeas, Lentils, Black beans, Kidney beans, Canned corn, Canned tuna, Canned salmon, Canned sardines, Canned soup, Baked beans, Coconut cream, Passata, Capers, Artichoke hearts
Baking🫙Flour, Self raising flour, Wholemeal flour, Almond flour, Coconut flour, Sugar, Brown sugar, Icing sugar, Caster sugar, Raw sugar, Baking powder, Bicarb soda, Yeast, Vanilla essence, Vanilla bean paste, Cocoa powder, Chocolate chips, Desiccated coconut, Shredded coconut, Dried cranberries, Dried apricots
Oils, Sauces & Condiments🫒Olive oil 🫒, Extra virgin olive oil, Vegetable oil, Canola oil, Coconut oil, Sesame oil, White vinegar, Balsamic vinegar, Apple cider vinegar, Rice wine vinegar, Soy sauce, Tamari, Fish sauce, Oyster sauce, Hoisin sauce, Ketchup, Mustard, Dijion mustard, Mayonnaise, Chilli sauce, Sriracha, Worcestershire sauce, Tabasco, Sweet chilli sauce, Teriyaki sauce, Salad dressing, Caesar dressing
Spreads & Breakfast🍯Peanut butter 🍯, Almond butter, Cashew butter, Jam, Strawberry jam, Honey, Vegemite, Marmite, Nutella, Maple syrup, Marmalade, Tahini, Lemon curd, Cream cheese spread
Breakfast Cereal🥣Weetbix 🥣, Cornflakes, Muesli, Bircher muesli, Porridge oats, Granola, Bran flakes, Puffed rice, Cheerios, Coco Pops style, Bran buds
Spices & Herbs (dried)🧂Salt 🧂, Sea salt, Himalayan salt, Pepper, Black pepper, White pepper, Paprika, Smoked paprika, Cumin, Turmeric, Coriander powder, Garlic powder, Onion powder, Cinnamon, Nutmeg, Cloves, Cardamom, Star anise, Bay leaves, Oregano, Thyme, Rosemary, Basil, Mixed herbs, Curry powder, Garam masala, Chilli flakes, Cayenne pepper, Chinese five spice, Za’atar, Sumac, Saffron
Frozen Vegetables❄️Frozen peas ❄️, Frozen corn, Mixed vegetables, Frozen spinach, Frozen broccoli, Frozen edamame, Stir fry vegetables, Frozen chips, Frozen sweet potato fries
Frozen Fruit🧊Frozen berries 🧊, Frozen mango, Frozen tropical mix, Frozen raspberries, Frozen blueberries, Frozen dragon fruit
Frozen Meals🍕Frozen pizza 🍕, Ready meals, Frozen pasta, Frozen curry, Frozen stir fry, Frozen dumplings, Frozen spring rolls, Frozen pies, Frozen burritos
Frozen Protein🐓Chicken nuggets 🐓, Fish fingers, Frozen seafood, Frozen dim sims, Frozen schnitzel, Frozen fish fillets
Frozen Desserts🍦Ice cream 🍦, Gelato, Frozen yogurt, Ice blocks, Frozen waffles, Frozen cheesecake
Water💧Still water 💧, Sparkling water, Mineral water, Flavoured water, Coconut water
Juice🧃Orange juice 🧃, Apple juice, Pineapple juice, Mango juice, Cranberry juice, Tomato juice, Mixed juice, Vegetable juice, Cold pressed juice
Soft Drinks🥤Cola 🥤, Diet cola, Lemonade, Ginger beer, Ginger ale, Tonic water, Soda water, Kombucha, Sparkling water with flavour
Hot Drinks☕Instant coffee ☕, Ground coffee, Coffee beans, Coffee pods, Espresso pods, Decaf coffee, Black tea, English breakfast tea, Earl Grey, Green tea, Herbal tea, Chamomile tea, Peppermint tea, Hot chocolate, Chai, Milo
Energy & Sports Drinks⚡Sports drink ⚡, Energy drink, Electrolyte drink, Electrolyte powder, Protein shake, Hydration tablets
Alcohol🍺Beer 🍺, Craft beer, Lager, Stout, Wine 🍷, Red wine, White wine, Sparkling wine, Champagne, Rosé, Spirits 🥃, Whisky, Gin, Vodka, Rum, Tequila, Cider, Pre-mixed drinks
Chips & Savoury Snacks🍟Potato chips 🍟, Corn chips, Pretzels, Rice crackers, Popcorn 🍿, Vegetable crisps, Rice cakes, Puffed corn, Twisties style, Crackers
Biscuits & Sweet Snacks🍪Biscuits 🍪, Cookies, Crackers, Muesli bars, Fruit bars, Bliss balls, Protein bars, Rice cakes, Wafers, Shortbread
Chocolate & Confectionery🍫Chocolate block 🍫, Chocolate bar, Dark chocolate, Milk chocolate, White chocolate, Lollies, Gummies, Jelly beans, Candy canes, Hard candy, Toffee, Marshmallows, Turkish delight
Nuts & Dried Fruit🥜Mixed nuts 🥜, Almonds, Cashews, Walnuts, Pecans, Macadamias, Pistachios, Peanuts, Brazil nuts, Hazelnuts, Trail mix, Dried apricots, Raisins, Sultanas, Dried mango, Dried cranberries, Medjool dates
Dips & Antipasto🫙Hummus 🫙, Tzatziki, Guacamole, Baba ghanoush, Taramasalata, Olives, Sundried tomatoes, Marinated capsicum, Artichoke hearts, Caponata
Subcategory🏷Representative items
Prescription Medications💊(free-text only — no pre-populated items for prescription privacy)
Over-the-Counter Medications💊Paracetamol 💊, Ibuprofen, Aspirin, Antihistamine, Antacid, Laxative, Antidiarrheal, Cough syrup, Cough lozenges, Throat lozenges, Nasal spray, Saline nasal rinse, Eye drops, Lubricating eye drops, Ear drops, Motion sickness tablets, Sleep aid tablets, Anti-nausea tablets
Pain Management🩺Paracetamol 500mg, Ibuprofen gel, Topical pain relief, Heat patches, Cold packs, TENS machine pads, Voltaren gel
Vitamins & Supplements💊Vitamin C, Vitamin D3, Vitamin B12, Vitamin E, Multivitamin, Fish oil, Omega-3, Iron supplement, Magnesium, Calcium, Zinc, Probiotics, CoQ10, Folic acid, Melatonin, Glucosamine, Collagen, Evening primrose oil
Diabetes Management🩸Blood glucose strips, Lancets, Insulin syringes, Insulin pen needles, CGM sensors, Alcohol wipes, Glucose tablets, Glucose gel
Cardiovascular Health❤️Blood pressure monitor batteries, Cholesterol supplements, Fish oil, Garlic supplement, CoQ10
Respiratory Health😤Spacer device, Peak flow meter, Nebuliser mask, Saline solution, Steam inhaler, Ventolin (generic), Nasal strips
Eye & Ear Care👁️Lubricating eye drops 👁️, Antibiotic eye drops, Eye wash, Ear drops, Ear wax removal drops, Hearing aid batteries
Sleep & Mental Wellbeing😴Melatonin, Magnesium glycinate, Lavender oil, Sleep mask, Ear plugs, White noise machine
Wound Care🩹Adhesive bandages 🩹, Gauze dressings, Non-adhesive dressings, Wound closure strips, Hydrocolloid dressings, Foam dressings, Waterproof dressings, Antiseptic cream, Antiseptic solution, Saline wound wash, Compression bandage, Cohesive bandage, Surgical tape, Wound drainage bags
Continence Products🩱Disposable pads, Light pads, Heavy pads, Absorbent underwear, Pull-up pants, Tab-style briefs, Bed underpads, Waterproof mattress protector, Catheter leg bags, Catheter night bags, Catheter straps, Urinary drainage bags
Medical Consumables🧤Nitrile gloves 🧤, Latex gloves, Vinyl gloves, Disposable aprons, Syringes, Needles, Alcohol wipes, Sterile swabs, Cotton balls, Blood glucose strips, Lancets, Urine test strips, Stool collection kits, Pill organiser, Pill crusher, Medication cups
First Aid🚑First aid kit refill 🚑, Instant ice pack, Elastic bandage, Triangular bandage, Tweezers, Thermometer strips, Digital thermometer, CPR face shield, Trauma dressings, Burn gel, Blister plasters
Mobility Aids — Consumables🦯Walking frame tennis balls 🦯, Non-slip socks, Crutch tips, Crutch handles, Wheelchair cushion cover, Wheelchair arm pad, Rollator hand grips, Walking stick rubber tip
Subcategory🏷Representative items
Body Wash & Soap🧴Body wash 🧴, Soap bar, Sensitive skin body wash, Moisturising body wash, Hand wash, Antibacterial hand wash, Bath salts, Bath oil, Shower gel
Hair Care💆Shampoo 💆, Conditioner, 2-in-1 shampoo, Anti-dandruff shampoo, Dry shampoo, Hair treatment, Hair mask, Leave-in conditioner, Hair colour, Hair ties, Bobby pins, Comb, Hair brush, Detangling spray
Oral Care🦷Toothpaste 🦷, Toothbrush, Soft toothbrush, Children’s toothbrush, Electric toothbrush heads, Dental floss, Interdental brushes, Mouthwash, Fluoride rinse, Denture adhesive, Denture cleaner, Denture tablets, Tongue scraper, Teeth whitening strips
Skin Care🌸Moisturiser 🌸, Face wash, Face cleanser, Toner, Serum, Eye cream, Sunscreen SPF50+, Sunscreen SPF30, Lip balm, Hand cream, Body lotion, After sun, Eczema cream, Sorbolene, QV cream, Cetaphil, Nappy rash cream
Sun Care☀️Sunscreen SPF50+ ☀️, Sunscreen SPF30, Kids sunscreen, Zinc sunscreen, Sunscreen spray, Lip balm SPF, After sun gel, After sun lotion
Grooming🪒Deodorant 🪒, Antiperspirant, Roll-on deodorant, Razors, Disposable razors, Razor blades, Shaving cream, Shaving gel, Shaving foam, Aftershave, Pre-shave oil, Tweezers, Nail clippers, Nail file, Emery boards
Men’s Grooming🧔Beard oil 🧔, Beard balm, Beard wash, Men’s moisturiser, Men’s face wash, Cologne, Men’s deodorant, Men’s razor, Shaving brush, Men’s hair gel, Men’s hair wax, Men’s hair clay
Feminine Hygiene🌺Pads 🌺, Night pads, Tampons, Panty liners, Menstrual cup, Period underwear, Feminine wash, Intimate wipes, Vaginal moisturiser
Baby & Infant👶Baby shampoo 👶, Baby body wash, Nappy rash cream, Baby wipes, Baby lotion, Baby oil, Baby powder, Nappies, Pull-up nappies, Baby face washer, Baby bath, Infant formula
Clothing👕Socks 👕, Non-slip socks, Compression stockings, Support stockings, Underwear, T-shirt, Singlet, Pyjamas, Hospital gown, Slippers, Non-slip slippers, Ugg boots, Cardigan, Zip-up hoodie, Tracksuit pants, Elasticated waist pants, Adaptive clothing
Incontinence Underwear🩲Incontinence briefs 🩲, Washable incontinence underwear, Waterproof briefs, Absorbent underwear, Swim nappies
Subcategory🏷Representative items
General Cleaning🧹Multi-purpose cleaner 🧹, Disinfectant spray, Disinfectant wipes, Bathroom cleaner, Toilet cleaner, Toilet duck, Floor cleaner, Mop bucket, Glass cleaner, Mould remover, Bleach, Ammonia, Bicarb soda, White vinegar
Kitchen Cleaning🍽️Dishwashing liquid 🍽️, Dishwasher tablets, Dishwasher powder, Dishwasher rinse aid, Oven cleaner, Kitchen degreaser, Sponges, Scourers, Steel wool, Dish cloths, Dish brush, Bottle brush
Laundry🧺Laundry detergent 🧺, Liquid laundry detergent, Laundry pods, Fabric softener, Stain remover, Laundry soaker, Bleach, Colour catcher, Dryer sheets, Laundry bags, Mesh laundry bags, Ironing spray
Paper Goods🧻Toilet paper 🧻, 3-ply toilet paper, Paper towels, Facial tissues, Box tissues, Paper napkins, Disposable cloths
Waste & Storage🗑️Bin liners 🗑️, Small bin liners, Large bin liners, Recycling bags, Compost bags, Freezer bags, Zip lock bags, Cling wrap, Beeswax wraps, Aluminium foil, Baking paper, Parchment paper, Rubber gloves, Disposable gloves
Kitchen Supplies🥄Aluminium foil 🥄, Baking paper, Cling wrap, Toothpicks, Skewers, Baking cups, Candles, Matches, Lighter, Batteries (AA), Batteries (AAA), Light bulbs, Glad wrap
Pest Control🪲Fly spray 🪲, Ant bait, Ant spray, Mouse traps, Rat bait, Cockroach bait, Fly strips, Bug zapper, Mosquito coils, Insect repellent
Garden & Outdoor🌻Potting mix 🌻, Fertiliser, Plant food, Garden hose, Watering can, Garden gloves, Snail bait, Weed killer, Lawn seed, Bird seed, Pet water bowl
Subcategory🏷Representative items
Home Care Services🧹House cleaning 🧹, Deep clean, End of lease clean, Vacuuming, Mopping, Bathroom clean, Kitchen clean, Oven clean, Window cleaning, Ironing, Laundry service, Bed making, Grocery run
Garden & Outdoor🌱Lawn mowing 🌱, Garden maintenance, Hedge trimming, Gutter cleaning, Pressure washing, Leaf blowing, Garden rubbish removal
Allied Health🏥Physiotherapy session 🏥, Occupational therapy, Podiatry, Speech therapy, Dietitian consultation, Massage therapy, Hydrotherapy, Chiropractic, Osteopathy, Exercise physiology, Neuropsychology assessment
Mental Health🧠Psychology session 🧠, Counselling session, Psychiatry review, Art therapy, Music therapy, Pet therapy session, Social engagement activity
Personal Services✂️Hairdresser ✂️, Barber, Mobile hairdresser, Nail care, Manicure, Pedicure, Waxing, Eyebrow threading, Makeup application
Medical Transport🚑Medical transport booking 🚑, Non-emergency medical transport, Taxi to appointment, Ride share to appointment, NDIS transport, Wheelchair-accessible taxi, Community transport
Social & Recreational🎭Social outing 🎭, Day program, Respite activity, Library visit, Cinema visit, Community group, Volunteer visitor, Friendship program
Trades & Maintenance🔧Plumber 🔧, Electrician, Handyman, Locksmith, Grab rail installation, Ramp installation, Bathroom modification, Stair lift service, Home modification assessment
Pharmacy & Delivery📦Medication delivery 📦, Chemist delivery, Grocery delivery, Meal kit delivery, Meals on Wheels, Meal delivery service
Respite & Care🤝Respite care 🤝, In-home respite, Day respite, Emergency respite, Overnight respite, Carer relief service
Subcategory🏷Representative items
Mobility Aids🦯Walking stick 🦯, Quad cane, Walking frame, Wheeled walking frame, Rollator, Manual wheelchair, Transport wheelchair, Power wheelchair, Scooter, Crutches, Forearm crutches
Bathroom & Toilet Aids🚿Shower chair 🚿, Shower stool, Bath board, Bath seat, Transfer bench, Raised toilet seat, Toilet frame, Grab rail, Suction grab rail, Non-slip bath mat, Commode chair, Portable commode, Bedpan, Urinal bottle
Pressure Care🛏️Pressure cushion 🛏️, Gel cushion, Air cushion, Pressure mattress overlay, Foam mattress topper, Air mattress, Heel protectors, Heel wedge, Elbow protectors, Seat wedge
Bed Aids🛏️Bed rail 🛏️, Half bed rail, Bed grab handle, Bed rope ladder, Bed wedge pillow, Leg rest pillow, Bed table, Overbed table, Monkey pole, Slide sheet, Transfer belt
Communication & Vision👁️Large print calendar 👁️, Large print phone, Magnifying glass, Handheld magnifier, Talking clock, Alarm clock with vibration, Hearing aid batteries, Hearing aid cleaning kit, Amplified telephone, Visual door bell, Dementia clock
Daily Living Aids🍴Non-slip mat 🍴, Jar opener, Long handled reacher, Grabber tool, Dressing aids, Sock aid, Elastic shoelaces, Button hook, Zipper pull, Adapted cutlery, Non-slip plate, Plate guard, Cup with two handles, Angled spoon, Rocker knife, Cutting board with spikes
Continence Equipment🚰Commode chair 🚰, Portable commode, Bedside commode, Urinal bottle, Female urinal, Bedpan, Catheter stand, Catheter bag holder, Penile sheath, Continence pad holder

A list’s grouping mode is set per-list by the admin. It controls how items are displayed when viewing the active list.

ModeDisplay behaviour
by_categoryItems grouped under category headings, subcategory subheadings. Sort within group: added order. Default.
flatSingle undifferentiated list. Sort: added order. No headers.
customUser-defined drag-and-drop sort order. Items display in the user-set order with no automatic grouping.

“Used Before” always pins to the top of the add panel regardless of grouping mode. It does not appear within the active list itself — it is only shown when browsing to add new items.


The catalog has three distinct tiers with different ownership, visibility, and governance.

Tier 1: Platform Catalog (system-level)
Maintained by the platform owner.
Available read-only to all tenants.
Items have icons, aliases, default units, categories.
↕ moderation
Tier 2: Community Suggestions (pending review)
Free-text items added by users that are not in Tier 1.
Automatically deduplicated by normalised name.
Ranked by frequency (how many distinct tenants have added the same item).
Platform owner reviews and either promotes to Tier 1 or rejects.
↕ tenant boundary
Tier 3: Tenant Custom Items
Items specific to one tenant that are not suitable for the platform catalog.
Never promoted. Visible only to that tenant.
E.g. "Nan's special bread from the Ukrainian bakery on Smith St"

When a user types into the add-item field:

  1. Search the Tier 1 platform catalog for items matching the input (fuzzy name + alias match).
  2. Search the tenant’s Tier 3 custom items and append any matches.
  3. If the typed text does not match any catalog item with sufficient confidence, display a “Add ‘[text]’ as a new item” option at the bottom of the results.
  4. Selecting “Add as new item” creates a free-text list item and simultaneously creates or increments a Tier 2 catalog_suggestions row with normalized_name = lowercase trimmed input.

The catalog stores regional synonyms so users find items regardless of which term they use:

Canonical nameAliases
CapsicumBell pepper, Pepper
Beef minceGround beef, Minced beef, Mince
ZucchiniCourgette
PrawnsShrimp
Soft drinkSoda, Cola, Fizzy drink
ParacetamolAcetaminophen, Panadol (generic alias)
Continence padsIncontinence pads, Pads (in pharmacy context)

Aliases are locale-tagged (en-AU, en-US, en-GB) so future internationalisation is straightforward.

Catalog product-name localisation (jurisdiction-aware, not literal)

Section titled “Catalog product-name localisation (jurisdiction-aware, not literal)”

Product decision (2026-08-06): catalog_items / catalog_item_aliases display names are localised per market, never translated word-for-word from the en-AU source. Word-for-word translation produces names a shopper in that market would not recognise or would find legally wrong.

Research the target jurisdiction’s own retail, legal, and cultural conventions for every locale — this applies to every future language, not just French:

  • Legal: EU Regulation 1308/2013 reserves lait (“milk”) for dairy — plant-based drinks are boisson à l’avoine / à l’amande / au soja in fr-FR, never lait de. A literal translator misses this; a market-aware one does not.
  • Sector terminology: French aged-care uses aides techniques (not a literal “equipment and aids”) and téléassistance for personal alarm devices — the terms carers and admin bodies (CNSA, APF) actually use.
  • Allergen/regulatory labelling: fruits à coque is the correct EU allergen-labelling term for tree nuts, not the colloquial noix (walnuts).
  • Non-Latin / other-jurisdiction locales (e.g. Hindi, Arabic) require the same discipline: consult that market’s retail and regulatory norms, not a dictionary. Do not assume Latin-script localisation patterns transfer.

Brand names are an acceptable localised display name, not a translation defect. When a well-known local retail brand is what shoppers actually ask for (e.g. fr-FR Weet-Bix → Weetabix, Corn Flakes, Bimi for broccolini, Vegemite kept as-is), use it. Do not flag brand retention as “untranslated” or block on it.

No static per-item confidence field is maintained. Each AI or human reviewer applies independent judgement per item on every pass; there is no shared “certainty” score carried between reviewers. Ongoing correctness comes from the same refinement loop already described above: admin catalog edits (ShoppingCatalogAdmin) and catalog_suggestions frequency ranking surface what real users in a market actually call an item, and that feeds back into catalog_item_aliases per locale over time — translation quality improves from production usage signal, not a one-time review score.

Localisation review runs on a per-locale payload in findings/, never by hand-editing a bundle. The tooling is language-agnostic — the locale is an argument and market metadata comes from locales.config.json, so adding a market is data, not a new script.

ArtefactContents
findings/i18n-<locale>-shopping-catalog.header.jsonPolicy, review protocol, the shared unit map, category/subcategory names, counts, append-only review log
findings/i18n-<locale>-shopping-catalog.items.jsonlOne JSON object per catalog item — JSONL so large sets split into batches and re-stitch without a reviewer reformatting the file
Terminal window
# Build or refresh the payload (accepted names carry forward; new seed items are reported)
python backend/scripts/catalog_localisation_export.py --locale fr-FR --batch-size 60
# Merge a reviewer's returned file — validated before anything is written
python backend/scripts/catalog_localisation_merge.py --locale fr-FR --reviewed <file.jsonl> --reviewer <model-or-person>

An item row carries normalized_name, category_slug, subcategory_slug, en_name, en_unit, and emoji as immutable join keys, plus three reviewer-editable fields:

  • local_name — the display name a shopper in that market would use.
  • local_aliases — the other names they might type (regional variants, the brand name when the canonical entry is generic). These load into catalog_item_aliases, so a wider alias list directly improves search recall.
  • market_rationale — why this name, in market terms (retail convention, labelling law, regional usage) — not a restatement of the translation.

Units are localised once in the header, not per item. A reviewer looking at one row cannot see that bunch became botte on one item and bouquet on another; that is the same consistency defect class the UI-bundle gate exists to catch. Items reference en_unit and the header resolves it.

catalog_localisation_merge.py rejects the whole file if a reviewer changes a join key, returns an unknown normalized_name, duplicates a row, or invents a field (for example re-adding a confidence score). The failure mode with model reviewers is a silently reshaped payload, not a bad translation — that breaks the join back to catalog_items long after the review looks finished.

Pass numbering is retired in favour of the header’s append-only reviews log (reviewer, timestamp, rows reviewed, changes applied). Superseded artefacts findings/i18n-fr-FR-shopping-catalog-pass1.json / -pass3.json are kept only as history. These are all drafting/QA artefacts, not the runtime source — accepted names load into catalog_item_aliases / catalog_category_translations before they affect the product.

Agent-facing rules: .cursor/rules/i18n-catalog-localisation.mdc.


Permissions depend on deployment mode.

ActionPatientCarerAdminObserver
View any listYesYesYesYes
View Used Before panelYesYesYesYes
Add item to listYesYesYesNo
Remove item from listYesYesYesNo
Mark item purchasedYesYesYesYes
Undo purchaseYesYesYesNo
Edit item (qty, notes, unit)YesYesYesNo
Create a new listNoYesYesNo
Rename / delete a listNoNoYesNo
Change list grouping modeNoYesYesNo
Submit catalog suggestionYesYesYesNo
Manage tenant custom itemsNoNoYesNo

Observer rationale: Observers often participate in care practically — a family member who is an observer may be doing the actual shopping run. Denying them the purchase action would break real-world workflows. They cannot modify the list composition (add/remove) but they can record that they bought something.

All household members (any tenant membership role) have full add/remove/purchase rights. There is no observer role in standalone mode — a viewer membership role maps to the observer column above.


User adds item
│
▼
[ ACTIVE ] ──── user taps [✕] ──────► [ REMOVED ]
│ (deleted from list;
│ not in Used Before)
user taps [✓]
│
▼
[ PURCHASED ] ──────────────────────────► Used Before pool
│ (available for quick re-add)
│
(if recurring)
after recurrence_interval_days
│
▼
[ ACTIVE ] (automatically re-added to list)

Active → Purchased

  • Triggered by any eligible user tapping the [✓] purchase icon.
  • Records purchased_by (user id) and purchased_at (UTC timestamp).
  • Item immediately disappears from the active list view for all connected clients (real-time via SSE).
  • Item enters the “Purchased” collapsible section at the bottom of the list (collapsed by default, shows count “Purchased (3)”).
  • Item is added or updated in the Used Before pool for this patient/tenant.

Active → Removed

  • Triggered by any eligible user tapping the [✕] remove icon.
  • Item is soft-deleted (status = 'removed').
  • Item does NOT enter Used Before.
  • Item disappears from the active list immediately for all connected clients.
  • No confirmation dialog required for remove (low-friction UX). Undo available via toast for 5 seconds (“Item removed · Undo”).

Purchased → Active (recurring items only)

  • If is_recurring = true, a background scheduled task runs daily at 06:00 local time.
  • It finds purchased items where purchased_at < (now - recurrence_interval_days).
  • It resets them to status = 'active', clears purchased_by and purchased_at, updates updated_at.
  • The item reappears on the active list for all connected clients.
  • A consolidated care alert is refreshed for the care team (when the shopping channel is enabled) — same single row per patient, count incremented.

Care alerts (when shopping channel enabled)

Section titled “Care alerts (when shopping channel enabled)”

Shopping list mutations sync one consolidated in-app care alert per patient — not one alert per item.

TriggerAlert behaviour
Item addedUpsert open alert shopping:{patient_id}; body shows active-item count (e.g. “4 items on the shopping list.”)
Item purchasedCount decrements; alert auto-resolves when no active items remain
Purchase undoneCount increments; alert re-opens or updates if channel enabled
Item removed (active)Count decrements; auto-resolve when empty
Recurring item resetCount increments when item returns to active

Implementation: alert_shopping_sync.sync_shopping_alert_for_patient (via shopping_service._schedule_shopping_alert_sync after HTTP commit). Legacy per-item open rows are superseded on next sync. Deep link: /shopping?patientId={id}.

The Used Before pool is a virtual category derived from purchase history. It is not a separate table — it is a query over shopping_list_items where status = 'purchased'.

Query logic:

SELECT DISTINCT ON (COALESCE(catalog_item_id::text, LOWER(name)))
catalog_item_id,
name,
category_id,
subcategory_id,
quantity,
unit,
MAX(purchased_at) AS last_purchased_at,
COUNT(*) AS purchase_count
FROM shopping_list_items
WHERE (patient_id = $1 OR list_id IN (SELECT id FROM shopping_lists WHERE tenant_id = $2))
AND status = 'purchased'
GROUP BY COALESCE(catalog_item_id::text, LOWER(name)), catalog_item_id, name, category_id, subcategory_id, quantity, unit
ORDER BY last_purchased_at DESC
LIMIT 30;

Ranking: Most recently purchased first. Items not purchased in the last 90 days are excluded unless the pool would be fewer than 10 items.

Re-adding from Used Before: One tap re-adds the item to the current active list with the same name, category_id, subcategory_id, quantity, and unit as the last purchase. No form required. The item appears in the active list immediately.


┌──────────────────────────────────────────────────────┐
│ Mrs Thompson — Groceries [+ New] │ ← list name + create list btn
│ Weekly Groceries ▾ Chemist Run │ ← list selector tabs
│ │
│ 12 items to get │ ← item count
│ │
│ FRUIT & VEGETABLES │ ← category header (grouped mode)
│ ┌────────────────────────────────────────────────┐ │
│ │ 🍎 Apple 1 kg [✓] [✕] │ │
│ │ Added by Sarah · 2h ago │ │
│ └────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────┐ │
│ │ 🥛 Oat milk 2 × 1L [✓] [✕] │ │
│ │ Added by Admin · yesterday │ │
│ └────────────────────────────────────────────────┘ │
│ │
│ BAKERY │
│ ┌────────────────────────────────────────────────┐ │
│ │ 🍞 Multigrain bread 1 loaf [✓] [✕] │ │
│ └────────────────────────────────────────────────┘ │
│ │
│ ─────── Purchased (3) ▸ ────────────────────────── │ ← collapsed, tap to expand
│ │
│ [+ Add item]│ ← FAB on mobile
└──────────────────────────────────────────────────────┘

Desktop / tablet (sm+) — single horizontal row:

[Icon] [Item name + priority badge] [− qty +] [✓ purchase] [✕ remove]

Tapping the icon opens the photo picker. Quantity is adjusted via inline ± stepper.

Mobile (≤639px) — compact single line inside SwipeActionRow:

[Icon] [Item name + badge …truncate] [qty pill]
← swipe left: Remove (coral) | swipe right: Purchased (sage) →
  • Swipe right past threshold → Purchased — marks purchased; item leaves the active list (same API as desktop ✓).
  • Swipe left past threshold → Remove — removes from list (carer/admin when canEdit).
  • Tap qty pill → bottom sheet with ± stepper (keeps the row one line tall).
  • Vertical list scroll is preserved (horizontal axis lock in SwipeActionRow).

Both purchase and remove remain one gesture on mobile; desktop keeps always-visible controls for mouse users.

Detail expansion (notes, supplier notes, full edit sheet on row tap) from the original spec is not yet implemented — photo capture and quantity edit cover the primary carer flows.

Triggered by [+ Add items] (desktop, dashed button) or apricot FAB (mobile). Opens AddItemsSheet — a bottom sheet on all viewports (desktop renders as a right-side panel per shared BottomSheet).

Catalog items render as a 3-column tile grid inside the sheet (not inline on the main page). Category picker uses compact cc-card tiles (rounded-2xl, rounded-xl icon well); subcategories use a compact horizontal cc-chip filter row (text-xs, 30px min-height, 14px icons). Every product tile uses the same cell size (CATALOG_TILE_GRID exported from CatalogItemTile.tsx): 34×34px icon/photo in a rounded-xl well, 10px two-line label, white shadow-soft card surface (6rem row height on mobile).

Icon / photo priority on each tile: patient photo (authenticated blob via useAuthenticatedImage) when present; else catalog raster via IconResolver (svg under /catalog-icons/items/… or 3D png under /assets/catalog-3d/…); else subcategory substitute; else emoji; else cart fallback. Do not rely on onLoad alone for raster readiness — see IconResolver.tsx.

┌──────────────────────────────────────────────────────┐
│ Add to Weekly Groceries [Close]│
│ │
│ [Search or type an item... ] │ ← search input, autofocus
│ │
│ ★ USED BEFORE │ ← pinned at top
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 🍎 Apple │ │ 🥛 Oat │ │ 🍞 Bread │ ··· │ ← tap to add instantly
│ │ │ │ milk │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │
│ FRUIT & VEGETABLES │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 🍎 Apple │ │ 🍌 Banana│ │ 🍊 Orange│ ··· │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │
│ DAIRY & EGGS │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 🥛 Milk │ │ 🧀 Cheese│ │ 🥚 Eggs │ ··· │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │
└──────────────────────────────────────────────────────┘

Tap a catalog item → instantly added to list with default quantity/unit. Panel stays open for rapid multi-add.

Typing in search → filters catalog items by name and alias match. Free-text result appears at bottom: Add "Fancy truffle oil" as new item.

Selecting free-text → opens a minimal detail form:

Name: [Fancy truffle oil ]
Category: [Pantry ▾] Subcategory: [Oils ▾]
Qty: [1] Unit: [bottle ▾]
Note: [ ]
[Add to list]

Tap a Used Before item → instantly added with same qty/unit as last purchase. Zero friction.

When one or more items have been purchased on the current list, a collapsed Purchased before (N) section appears below the active list (PurchasedSection, collapsed by default).

Tapping the header expands a horizontal scroll strip of PurchasedTile cards — same Calm Care proportions as the add-items catalog picker (rounded-2xl white card, 34×34px icon/photo in a rounded-xl well, 10px two-line label). Tap a tile to re-add that item to the active list (sage flash + “Added!” feedback, same as catalog add).

  • Remove (×) on a tile — removes that entry from purchase history on the list (carer/admin when permitted).
  • ⋯ Clear all purchase history — admin overflow menu; two-step confirm before clearing the whole pool on this list.

Lists for the current patient are displayed as a horizontally scrollable cc-chip tab row inside a soft card (ShoppingListTabs). The active list uses cc-chip-active. A [+ New list] chip at the end creates a list (carer/admin only). Delete is a two-step confirm on the active tab.

8.6 Priority badge (pharmacy/medical lists)

Section titled “8.6 Priority badge (pharmacy/medical lists)”

For items on pharmacy or equipment lists, an optional priority badge appears:

PriorityBadgeColour
criticalUrgentCoral (cc-status-overdue)
highHighAmber (cc-status-due)
normal(no badge)—
low(no badge, grey text)—

On pharmacy lists, the active list sorts: critical first → high → normal → low. Within each priority band, items sort in added order.


The shopping module emits server-sent events on every mutation. All clients connected to the same patient’s context receive the event and invalidate their local list state, triggering a silent background re-fetch.

{
"event": "shopping_list_updated",
"payload": {
"list_id": 42,
"patient_id": 7,
"tenant_id": 3,
"action": "purchase",
"item_id": 188,
"item_name": "Oat milk",
"performed_by_name": "Sarah"
}
}
ActionSSE eventAdditional effect
Item addedshopping_list_updatedConsolidated care alert sync (count upsert) when shopping channel enabled
Item purchasedshopping_list_updatedConsolidated care alert sync (count decrement or auto-resolve)
Purchase undoneshopping_list_updatedConsolidated care alert sync (count increment)
Item removedshopping_list_updatedConsolidated care alert sync (count decrement or auto-resolve)
Items clearedshopping_list_updated—
Recurring item resetshopping_list_updatedConsolidated care alert sync when item returns to active

The frontend listens for shopping_list_updated events via the existing SSE infrastructure in lib/api.ts. On receipt, the shopping list state is re-fetched silently (no spinner, no page reload). The active list view updates in place — new items appear, purchased items disappear, all without user action.

List tab reconciliation: After every fetchLists, Shopping.tsx checks that activeListId still exists in the returned array; if not, it selects the first list or clears selection. Changing the care recipient resets list/item state before fetching — avoids GET …/lists/{id}/items 404 when a list was deleted on another device or the stored tab id is stale.

Mobile purchase/remove: On viewports ≤639px, ShoppingListRow uses SwipeActionRow — swipe right Purchased, swipe left Remove (when editable). Desktop keeps inline ✓ / ✕ controls.

Distributed pickup — concurrent purchase behaviour

Section titled “Distributed pickup — concurrent purchase behaviour”

When multiple users are simultaneously shopping and marking items purchased:

  • First user to mark an item purchased wins (desktop ✓ or mobile swipe right → Purchased). The purchase is written immediately to the DB.
  • The SSE event removes the item from all other connected clients’ active lists within ~1 second.
  • The tiny race-condition window (network RTT) is accepted for Phase 7. If two users simultaneously purchase the same item, the second write is a no-op at the DB level (idempotent — item status is already purchased). No error is shown; the second user simply sees the item was already bought.
  • A Phase 8 enhancement will add a soft “I’m getting this” claimed state as an optional list-level setting.

10. Community Contribution & Catalog Moderation

Section titled “10. Community Contribution & Catalog Moderation”

When a user adds a free-text item (not matched from the catalog), the backend:

  1. Normalises the input: lowercase, trim whitespace, collapse multiple spaces.
  2. Checks catalog_suggestions for an existing row with the same normalized_name.
  3. If found: increments frequency_count and updates last_submitted_at. Updates submitted_by_tenant_ids (array of distinct tenants who have submitted this term).
  4. If not found: creates a new row with status = 'pending', frequency_count = 1.

The user’s list item is created regardless — the suggestion is a background background action that never blocks the UX.

Accessible to super-admins only at:

GET /api/admin/shopping/catalog/suggestions
?status=pending
&sort=frequency_desc (default)
&category=grocery

The review queue shows suggestions ordered by frequency_count DESC — items added independently by many different tenants surface first. This is the primary signal for what belongs in the platform catalog.

Review screen layout:

┌──────────────────────────────────────────────────────────────┐
│ Catalog Suggestions — Pending (47) │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ "Incontinence briefs" 🔥 23 tenants │ │
│ │ Suggested category: Pharmacy → Continence Products │ │
│ │ [Approve & add to catalog] [Reject] [Merge with…] │ │
│ └──────────────────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ "Oat bran" 🔥 18 tenants │ │
│ │ Suggested category: Grocery → Breakfast Cereal │ │
│ │ [Approve & add to catalog] [Reject] [Merge with…] │ │
│ └──────────────────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ "Fancy truffle oil" 1 tenant │ │
│ │ Suggested category: Grocery → Oils │ │
│ │ [Approve & add to catalog] [Reject] [Merge with…] │ │
│ └──────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘

Approve:

  • Platform admin sets the canonical name, selects category/subcategory, sets default unit, optionally adds aliases.
  • A new catalog_items row is created.
  • The catalog_suggestions row is marked approved, merged_into_catalog_item_id set.
  • All existing free-text list items matching this normalised name are retroactively linked to the new catalog_item_id (background job).

Reject:

  • catalog_suggestions row marked rejected with optional review_notes.
  • No effect on existing list items — they remain as free-text items.
  • The suggestion will not re-surface unless a different normalised name creates a new row.

Merge:

  • The suggestion is an alias of an existing catalog item (e.g. “Incontinence pads” merges into “Continence pads”).
  • The alias is added to catalog_item_aliases for the target item.
  • Existing free-text list items are retroactively linked.

If a tenant creates a custom item that is clearly not suitable for the platform catalog, an admin can mark it tenant_only = true. This prevents it from ever appearing in the community suggestions queue. Tenant custom items are visible only to that tenant.


All tables use PostgreSQL types consistent with schema.sql. No SQLite syntax.

System/platform tables (no tenant isolation)

Section titled “System/platform tables (no tenant isolation)”
-- Top-level categories (e.g. Groceries, Pharmacy, Personal Care)
CREATE TABLE catalog_categories (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL, -- canonical English name
slug TEXT NOT NULL UNIQUE,
icon_emoji TEXT, -- e.g. '🛒'
icon_type TEXT NOT NULL DEFAULT 'emoji'
CHECK (icon_type IN ('emoji', 'svg', 'url')),
icon_value TEXT,
item_type TEXT NOT NULL DEFAULT 'product'
CHECK (item_type IN ('product', 'service', 'both')),
sort_order INTEGER NOT NULL DEFAULT 0,
active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Subcategories (e.g. Fresh Fruit, Dairy & Eggs)
CREATE TABLE catalog_subcategories (
id SERIAL PRIMARY KEY,
category_id INTEGER NOT NULL REFERENCES catalog_categories(id),
name TEXT NOT NULL, -- canonical English name
icon_emoji TEXT, -- fallback for items without their own emoji
icon_type TEXT NOT NULL DEFAULT 'emoji'
CHECK (icon_type IN ('emoji', 'svg', 'url')),
icon_value TEXT,
sort_order INTEGER NOT NULL DEFAULT 0,
active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Individual catalog items (e.g. Apple, Oat milk, Physiotherapy session)
CREATE TABLE catalog_items (
id SERIAL PRIMARY KEY,
category_id INTEGER NOT NULL REFERENCES catalog_categories(id),
subcategory_id INTEGER REFERENCES catalog_subcategories(id),
name TEXT NOT NULL, -- canonical English name (en-AU)
normalized_name TEXT NOT NULL, -- lowercase, trimmed — for dedup/search
item_type TEXT NOT NULL DEFAULT 'product'
CHECK (item_type IN ('product', 'service')),
default_unit TEXT, -- 'each', 'kg', 'litre', 'pack', 'session'
default_quantity REAL NOT NULL DEFAULT 1,
icon_emoji TEXT, -- Unicode emoji e.g. '🍎'
icon_type TEXT NOT NULL DEFAULT 'emoji'
CHECK (icon_type IN ('emoji', 'svg', 'url')),
icon_value TEXT, -- Phase 8+: SVG filename or CDN URL
search_weight INTEGER NOT NULL DEFAULT 5,
active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_catalog_items_normalized ON catalog_items(normalized_name);
CREATE INDEX idx_catalog_items_category ON catalog_items(category_id);
CREATE INDEX idx_catalog_items_subcat ON catalog_items(subcategory_id);
-- Aliases / synonyms (regional and common alternate names)
-- Also used as the primary localisation lookup for names (e.g. 'Bell pepper' for 'Capsicum' in en-US)
CREATE TABLE catalog_item_aliases (
id SERIAL PRIMARY KEY,
catalog_item_id INTEGER NOT NULL REFERENCES catalog_items(id) ON DELETE CASCADE,
alias TEXT NOT NULL,
normalized_alias TEXT NOT NULL,
locale TEXT NOT NULL DEFAULT 'en-AU', -- BCP-47 locale tag
is_primary_for_locale BOOLEAN NOT NULL DEFAULT false, -- if true, this is the display name for that locale
UNIQUE (normalized_alias, locale)
);
CREATE INDEX idx_catalog_aliases_item ON catalog_item_aliases(catalog_item_id);
CREATE INDEX idx_catalog_aliases_locale ON catalog_item_aliases(locale, is_primary_for_locale)
WHERE is_primary_for_locale = true;
-- Localised display names for categories (shown in the Add panel headers)
CREATE TABLE catalog_category_translations (
id SERIAL PRIMARY KEY,
category_id INTEGER NOT NULL REFERENCES catalog_categories(id) ON DELETE CASCADE,
locale TEXT NOT NULL,
display_name TEXT NOT NULL,
UNIQUE (category_id, locale)
);
-- Localised display names for subcategories
CREATE TABLE catalog_subcategory_translations (
id SERIAL PRIMARY KEY,
subcategory_id INTEGER NOT NULL REFERENCES catalog_subcategories(id) ON DELETE CASCADE,
locale TEXT NOT NULL,
display_name TEXT NOT NULL,
UNIQUE (subcategory_id, locale)
);
-- Tenant preferred locale (overrides device locale when set)
-- Stored on tenant_shopping_settings (see below)
-- Community suggestions (free-text items users add that are not in catalog)
CREATE TABLE catalog_suggestions (
id SERIAL PRIMARY KEY,
suggested_name TEXT NOT NULL,
normalized_name TEXT NOT NULL UNIQUE, -- dedup key
suggested_category_id INTEGER REFERENCES catalog_categories(id),
suggested_subcategory_id INTEGER REFERENCES catalog_subcategories(id),
item_type TEXT NOT NULL DEFAULT 'product',
submitted_by_tenant_ids INTEGER[] NOT NULL DEFAULT '{}', -- distinct tenants
frequency_count INTEGER NOT NULL DEFAULT 1,
status TEXT NOT NULL DEFAULT 'pending'
CHECK (status IN ('pending', 'approved', 'rejected', 'merged')),
merged_into_catalog_item_id INTEGER REFERENCES catalog_items(id),
review_notes TEXT,
reviewed_by INTEGER REFERENCES users(id),
reviewed_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_catalog_suggestions_status ON catalog_suggestions(status);
CREATE INDEX idx_catalog_suggestions_frequency ON catalog_suggestions(frequency_count DESC);
-- Shopping lists (patient-scoped in LynCareOS; tenant-scoped in standalone)
CREATE TABLE shopping_lists (
id SERIAL PRIMARY KEY,
tenant_id INTEGER NOT NULL REFERENCES tenants(id),
patient_id INTEGER REFERENCES patients(id), -- NULL in standalone mode
name TEXT NOT NULL,
list_type TEXT NOT NULL DEFAULT 'general'
CHECK (list_type IN (
'grocery','pharmacy','personal_care',
'household','services','equipment','general'
)),
grouping_mode TEXT NOT NULL DEFAULT 'by_category'
CHECK (grouping_mode IN ('by_category','flat','custom')),
sort_order INTEGER NOT NULL DEFAULT 0,
is_active BOOLEAN NOT NULL DEFAULT true,
created_by INTEGER NOT NULL REFERENCES users(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
-- Exactly one of patient_id or standalone mode must be set
CONSTRAINT chk_shopping_list_owner CHECK (
patient_id IS NOT NULL OR tenant_id IS NOT NULL
)
);
CREATE INDEX idx_shopping_lists_tenant ON shopping_lists(tenant_id);
CREATE INDEX idx_shopping_lists_patient ON shopping_lists(patient_id)
WHERE patient_id IS NOT NULL;
-- Individual items within a list
CREATE TABLE shopping_list_items (
id SERIAL PRIMARY KEY,
list_id INTEGER NOT NULL REFERENCES shopping_lists(id) ON DELETE CASCADE,
tenant_id INTEGER NOT NULL REFERENCES tenants(id),
patient_id INTEGER REFERENCES patients(id),
catalog_item_id INTEGER REFERENCES catalog_items(id), -- NULL for free-text
name TEXT NOT NULL,
category_id INTEGER REFERENCES catalog_categories(id),
subcategory_id INTEGER REFERENCES catalog_subcategories(id),
item_type TEXT NOT NULL DEFAULT 'product',
quantity REAL NOT NULL DEFAULT 1,
unit TEXT,
notes TEXT,
priority TEXT NOT NULL DEFAULT 'normal'
CHECK (priority IN ('critical','high','normal','low')),
supplier_notes TEXT,
is_recurring BOOLEAN NOT NULL DEFAULT false,
recurrence_interval_days INTEGER,
sort_order INTEGER NOT NULL DEFAULT 0,
status TEXT NOT NULL DEFAULT 'active'
CHECK (status IN ('active','purchased','removed')),
added_by INTEGER NOT NULL REFERENCES users(id),
purchased_by INTEGER REFERENCES users(id),
purchased_at TIMESTAMPTZ,
removed_by INTEGER REFERENCES users(id),
removed_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_shopping_items_list_status ON shopping_list_items(list_id, status);
CREATE INDEX idx_shopping_items_tenant ON shopping_list_items(tenant_id);
CREATE INDEX idx_shopping_items_patient ON shopping_list_items(patient_id)
WHERE patient_id IS NOT NULL;
CREATE INDEX idx_shopping_items_purchased ON shopping_list_items(patient_id, purchased_at DESC)
WHERE status = 'purchased';
-- Per-tenant shopping configuration
CREATE TABLE tenant_shopping_settings (
tenant_id INTEGER PRIMARY KEY REFERENCES tenants(id),
default_grouping_mode TEXT NOT NULL DEFAULT 'by_category',
show_category_icons BOOLEAN NOT NULL DEFAULT true,
show_used_before BOOLEAN NOT NULL DEFAULT true,
used_before_limit INTEGER NOT NULL DEFAULT 30,
used_before_days_window INTEGER NOT NULL DEFAULT 90,
notify_critical_add BOOLEAN NOT NULL DEFAULT true,
standalone_mode BOOLEAN NOT NULL DEFAULT false,
preferred_locale TEXT, -- BCP-47 e.g. 'en-AU', 'en-US', 'fr-FR'. NULL = use device locale.
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

This schema is delivered as a single migration file:

backend/migrations/V008__shopping_module.sql

All endpoints require a valid JWT. Module gate: require_module('shopping').

Patient-scoped endpoints enforce patient_access membership. Catalog endpoints are read-only for all authenticated users. Admin catalog management endpoints require is_super_admin.

ModeBase path
LynCareOS integrated/api/patients/{patient_id}/shopping/
Standalone/api/shopping/

Both modes share the same router code; the handler detects mode from tenant_shopping_settings.standalone_mode.

GET /api/patients/{patient_id}/shopping/lists
Response: ShoppingList[]
Auth: any patient_access role
POST /api/patients/{patient_id}/shopping/lists
Body: { name, list_type, grouping_mode? }
Response: ShoppingList
Auth: carer or admin
PATCH /api/patients/{patient_id}/shopping/lists/{list_id}
Body: { name?, grouping_mode?, sort_order?, is_active? }
Response: ShoppingList
Auth: admin only
DELETE /api/patients/{patient_id}/shopping/lists/{list_id}
Response: 204
Auth: admin only
GET /api/patients/{patient_id}/shopping/lists/{list_id}/items
Query: status=active|purchased|removed|all (default: active)
Response: ShoppingListItem[]
Auth: any patient_access role
POST /api/patients/{patient_id}/shopping/lists/{list_id}/items
Body: {
catalog_item_id?, name, category_id?, subcategory_id?,
quantity, unit?, notes?, priority?, supplier_notes?,
is_recurring?, recurrence_interval_days?
}
Response: ShoppingListItem
Auth: patient, carer, or admin
PATCH /api/patients/{patient_id}/shopping/lists/{list_id}/items/{item_id}
Body: Partial<editable fields>
Response: ShoppingListItem
Auth: patient, carer, or admin
POST /api/patients/{patient_id}/shopping/lists/{list_id}/items/{item_id}/purchase
Body: {}
Response: ShoppingListItem
Auth: patient, carer, admin, or observer
POST /api/patients/{patient_id}/shopping/lists/{list_id}/items/{item_id}/unpurchase
Body: {}
Response: ShoppingListItem
Auth: patient, carer, or admin
DELETE /api/patients/{patient_id}/shopping/lists/{list_id}/items/{item_id}
Response: 204
Auth: patient, carer, or admin
POST /api/patients/{patient_id}/shopping/lists/{list_id}/clear-purchased
Body: {}
Response: { archived_count: number }
Auth: admin only
GET /api/patients/{patient_id}/shopping/used-before
Query: limit=30 (default)
Response: UsedBeforeItem[]
Auth: any patient_access role

Catalog (read — all authenticated users)

Section titled “Catalog (read — all authenticated users)”
GET /api/shopping/catalog/categories
Query: locale=BCP47 (optional — falls back to Accept-Language header, then en-AU)
Response: CatalogCategory[] (with subcategories nested, names localised)
Auth: any authenticated user
GET /api/shopping/catalog/search
Query: q=string (min 2 chars), list_type?, limit=20,
locale=BCP47 (optional — same fallback as above)
Response: CatalogSearchResult[] (display_name localised; canonical_name always en-AU)
Auth: any authenticated user
Note: search matches against canonical name, all aliases across all locales,
and the locale-specific primary display name
POST /api/shopping/catalog/suggest
Body: { suggested_name, suggested_category_id?, item_type?, locale? }
Response: 204
Auth: any authenticated user

Platform admin catalog management (super-admin only)

Section titled “Platform admin catalog management (super-admin only)”
GET /api/admin/shopping/catalog/suggestions
Query: status=pending|approved|rejected (default: pending), sort=frequency_desc
Response: CatalogSuggestion[]
POST /api/admin/shopping/catalog/suggestions/{id}/approve
Body: { canonical_name, category_id, subcategory_id, default_unit?, aliases?: string[] }
Response: CatalogItem
POST /api/admin/shopping/catalog/suggestions/{id}/reject
Body: { review_notes? }
Response: 204
POST /api/admin/shopping/catalog/suggestions/{id}/merge
Body: { target_catalog_item_id, add_as_alias: boolean }
Response: 204
POST /api/admin/shopping/catalog/items
Body: { name, category_id, subcategory_id?, item_type, default_unit?, default_quantity?, aliases?: string[] }
Response: CatalogItem
PATCH /api/admin/shopping/catalog/items/{id}
Body: Partial<CatalogItem fields>
Response: CatalogItem
DELETE /api/admin/shopping/catalog/items/{id}
Response: 204 (soft delete — sets active=false)
// frontend/src/lib/api.ts additions
export type ListType =
| 'grocery' | 'pharmacy' | 'personal_care'
| 'household' | 'services' | 'equipment' | 'general';
export type GroupingMode = 'by_category' | 'flat' | 'custom';
export type ItemStatus = 'active' | 'purchased' | 'removed';
export type ItemPriority = 'critical' | 'high' | 'normal' | 'low';
export interface ShoppingList {
id: number;
tenant_id: number;
patient_id: number | null;
name: string;
list_type: ListType;
grouping_mode: GroupingMode;
sort_order: number;
is_active: boolean;
created_by: number;
created_at: string;
updated_at: string;
}
export interface ShoppingListItem {
id: number;
list_id: number;
tenant_id: number;
patient_id: number | null;
catalog_item_id: number | null;
name: string;
category_id: number | null;
category_name: string | null; // joined
subcategory_id: number | null;
subcategory_name: string | null; // joined
item_type: 'product' | 'service';
quantity: number;
unit: string | null;
notes: string | null;
priority: ItemPriority;
supplier_notes: string | null;
is_recurring: boolean;
recurrence_interval_days: number | null;
sort_order: number;
status: ItemStatus;
added_by: number;
added_by_name: string; // joined
purchased_by: number | null;
purchased_by_name: string | null; // joined
purchased_at: string | null;
removed_by: number | null;
removed_at: string | null;
created_at: string;
updated_at: string;
}
export interface UsedBeforeItem {
catalog_item_id: number | null;
name: string;
category_id: number | null;
category_name: string | null;
subcategory_id: number | null;
icon: string | null;
quantity: number;
unit: string | null;
last_purchased_at: string;
purchase_count: number;
}
export interface CatalogCategory {
id: number;
name: string;
slug: string;
icon: string | null;
item_type: 'product' | 'service' | 'both';
sort_order: number;
subcategories: CatalogSubcategory[];
}
export interface CatalogSubcategory {
id: number;
category_id: number;
name: string;
icon: string | null;
sort_order: number;
}
export interface CatalogSearchResult {
catalog_item_id: number;
canonical_name: string; // always en-AU, for DB storage
display_name: string; // localised for the requested locale
category_id: number;
category_name: string; // localised
subcategory_id: number | null;
subcategory_name: string | null; // localised
item_type: 'product' | 'service';
default_unit: string | null;
default_quantity: number;
icon_emoji: string | null; // Unicode emoji e.g. '🍎'
icon_type: 'emoji' | 'svg' | 'url';
icon_value: string | null; // Phase 8+: SVG path or URL
matched_via: 'name' | 'alias' | 'translation'; // for UX
locale_used: string; // which locale was resolved
}

The shopping module follows the mandatory three-layer pattern: Router → Service → Repository. No SQL in routers.

backend/routers/shopping.py
HTTP layer: parse requests, call service, emit SSE, return responses.
Item/catalog photo upload and serve call services/images.py with tenant_id.
backend/services/shopping_service.py
Business logic: access control, Used Before logic, recurring reset,
SSE emission, suggestion dedup, audit writes
backend/repositories/shopping.py
All SQL: queries against shopping_lists, shopping_list_items,
catalog_*, tenant_shopping_settings.
clear_stale_photo_url() — removes orphaned photo_url values when upload
files are missing (dev resets, volume loss).
backend/services/images.py
Shared WebP pipeline for shopping item photos (and prescriptions/dispensing proof).
Persists under UPLOADS_DIR/<tenant_id>/; DB stores filename only.
MethodResponsibility
get_lists(patient_id, user_id)Returns all active lists for patient; enforces patient_access
create_list(patient_id, user_id, data)Creates list; applies tenant default settings
get_items(list_id, patient_id, user_id, status)Returns items with joined names; enforces patient_access
add_item(list_id, patient_id, user_id, data)Creates item; submits catalog suggestion if free-text; emits SSE; syncs consolidated care alert
purchase_item(list_id, item_id, patient_id, user_id)Sets purchased fields; emits SSE; syncs consolidated care alert
unpurchase_item(...)Reverts purchased state; emits SSE; syncs consolidated care alert
remove_item(...)Soft deletes; emits SSE; syncs consolidated care alert
clear_purchased(list_id, patient_id, user_id)Archives purchased items; emits SSE
get_used_before(patient_id, limit)Queries purchase history for quick-add candidates
search_catalog(query, list_type, limit)Full-text + alias search across catalog
submit_suggestion(name, category_id, tenant_id, user_id)Dedup and upsert catalog_suggestions
reset_recurring_items()Scheduler job — daily at 06:00; resets eligible recurring items; syncs consolidated care alert per affected patient

APScheduler job added to main.py lifespan:

scheduler.add_job(
shopping_service.reset_recurring_items,
trigger='cron',
hour=6,
minute=0,
id='reset_recurring_shopping_items'
)

Medication restocking (optional, when medication_dispensing active)

Section titled “Medication restocking (optional, when medication_dispensing active)”

When both shopping and medication_dispensing modules are active, the pharmacy list surface a “Suggested restocks” section. This reads dispensing analytics (unchanged from REQ-SHOP-04 in the retired spec) and surfaces medicines where recent consumption has accelerated. The suggestion is shown within the pharmacy list’s UI only — it does not appear in grocery or other list types.

This integration is optional: the shopping module has no hard import dependency on the dispensing module. The service checks at runtime whether medication_dispensing is active for the tenant before calling the analytics repository.

Shift integration (when care_calendar active)

Section titled “Shift integration (when care_calendar active)”

When a carer is viewing a shift detail screen, a compact shopping widget shows:

  • Count of active items on the patient’s lists: “12 items across 2 lists”
  • Quick-add input to add an item directly from the shift view (auto-assigns added_from_shift_id on the item)
  • Link to open the full shopping screen for the patient

A shopping summary card on the dashboard shows:

  • Total active items across all lists
  • Count of critical/high priority items (pharmacy list)
  • Link to the shopping screen

  • Write backend/migrations/V008__shopping_module.sql — Creates: catalog_categories, catalog_subcategories, catalog_items, catalog_item_aliases, catalog_suggestions, shopping_lists, shopping_list_items, tenant_shopping_settings — Creates all indexes
  • Write backend/scripts/seed_shopping_catalog.py — Seeds all categories, subcategories, and items from this specification — Seeds aliases (regional synonyms) — Idempotent: uses ON CONFLICT DO NOTHING — Runnable standalone or as part of init_db()
  • backend/repositories/shopping.py — list_lists(), create_list(), update_list(), delete_list() — list_items(), get_item(), create_item(), update_item(), remove_item() — purchase_item(), unpurchase_item(), clear_purchased() — get_used_before() — search_catalog(), get_categories() — upsert_suggestion(), list_suggestions(), approve_suggestion(), reject_suggestion(), merge_suggestion()
  • backend/services/shopping.py — All business logic methods listed in §13 — Access control enforcement (patient_access checks) — SSE emission on all mutations — Catalog suggestion dedup logic — Recurring item reset scheduler job
  • backend/routers/shopping.py — All endpoints listed in §12 — Registered in main.py under /api — Module gate: require_module('shopping')
  • backend/routers/admin_shopping.py — Suggestion review queue endpoints — Catalog CRUD endpoints — Super-admin only (require_super_admin)
  • Add to backend/models.py: ShoppingListCreate, ShoppingListUpdate, ShoppingItemCreate, ShoppingItemUpdate, CatalogSearchResult, CatalogSuggestionCreate, CatalogItemCreate, CatalogItemUpdate, SuggestionApprove, SuggestionMerge
  • frontend/src/pages/Shopping.tsx — List selector tabs, active/purchased tabs, shopping screen shell
  • frontend/src/components/shopping/ShoppingListTabs.tsx — Horizontal scrollable list selector with [+ New] button
  • frontend/src/components/shopping/ActiveItemList.tsx — Grouped or flat item display; purchased collapsed section
  • frontend/src/components/shopping/ShoppingItemCard.tsx — Item row: icon, name, qty/unit, [✓] purchase, [✕] remove — Inline expand for notes, edit, priority badge
  • frontend/src/components/shopping/AddItemPanel.tsx — Bottom sheet / inline panel — Search input, Used Before section, category browser — Free-text new item mini-form
  • frontend/src/components/shopping/UsedBeforeGrid.tsx — Horizontal pill/card grid of recent purchases at top of add panel
  • frontend/src/components/shopping/NewListModal.tsx — Create list dialog: name, list_type, grouping_mode
  • frontend/src/components/shopping/ShoppingDashboardWidget.tsx — Dashboard summary card
  • frontend/src/components/shopping/ShoppingShiftWidget.tsx — Compact widget within shift detail panel
  • Add shopping API functions to frontend/src/lib/api.ts — fetchShoppingLists(), createShoppingList(), updateShoppingList() — fetchShoppingItems(), addShoppingItem(), updateShoppingItem() — purchaseItem(), unpurchaseItem(), removeItem(), clearPurchased() — fetchUsedBefore(), searchCatalog(), fetchCatalogCategories() — submitCatalogSuggestion()
  • Add Shopping tab to Layout.tsx nav items (gated by shopping module)
  • Add Shopping widget to Dashboard.tsx
  • Add Shopping widget to shift detail component
  • SSE handler: shopping_list_updated → invalidate and re-fetch list items
  • frontend/src/pages/admin/ShoppingCatalogAdmin.tsx — Suggestion review queue: pending suggestions, frequency ranking, approve/reject/merge — Catalog item CRUD: add item, edit item, manage aliases — Accessible to super-admins only
  • Add Shopping to navItems in Layout.tsx — Icon: ShoppingCart (Lucide) — Route: /shopping — Module gate: shopping — Mobile bottom tab: between Calendar and More
  • backend/tests/test_shopping.py — Add item, purchase, unpurchase, remove, clear — Patient isolation (user cannot access another patient’s lists) — Observer can purchase but cannot add — Module gate returns 402 without subscription — Recurring item reset logic — Catalog search returns aliases
  • backend/tests/test_catalog_admin.py — Suggestion dedup (same name, different tenants increments count) — Approve suggestion creates catalog item — Merge adds alias

ItemPhase
Soft “claiming” state (I’m getting this)Phase 8
Store layout profiles (aisle order per supermarket)Phase 8
Phase 8 icon upgrade: SVG illustration set replacing emojiPhase 8
Machine-translated category/subcategory names (non-English locales)Phase 8
Apple Watch / voice inputPhase 9
Standalone deployment packaging (separate Docker image)Phase 9
List sharing across tenants (e.g. two families sharing care)Phase 10
Barcode scan to add item (maps barcode → catalog_item_id)Phase 10
Integration with external pharmacy delivery APIsPhase 10
RTL layout support (Arabic, Hebrew)Phase 10

The same item has many names depending on where the user is. This is not merely a translation problem — it is a synonym problem that exists within a single language. An Australian user types “capsicum”; an American user types “bell pepper”; a British user types “pepper”. All refer to the same catalog item. The system must resolve all three to the canonical record and display the item back in the user’s own terminology.

en-AU (canonical) en-US en-GB fr-FR
───────────────── ────────────────── ────────────────── ──────────────
Capsicum ──► Bell pepper Pepper Poivron
Zucchini ──► Zucchini Courgette Courgette
Beef mince ──► Ground beef Beef mince Bœuf haché
Prawns ──► Shrimp Prawns Crevettes
Coriander ──► Cilantro Coriander Coriandre
Biscuits ──► Cookies Biscuits Biscuits
Paracetamol ──► Acetaminophen Paracetamol Paracétamol
Nappy ──► Diaper Nappy Couche
Pram ──► Stroller Pram Poussette

When returning item names to the client, the backend resolves display names in this order:

1. Tenant preferred_locale (set in tenant_shopping_settings)
│ if null ↓
2. Request Accept-Language header (or ?locale= query param)
│ if no match ↓
3. Language-family match (e.g. 'fr-CA' → try 'fr-FR' translations)
│ if no match ↓
4. Canonical name (en-AU — always present, never null)

The resolved locale is returned as locale_used in every CatalogSearchResult so the frontend can display a subtle indicator when a fallback was used (e.g. showing the canonical name in brackets for items without a translation in the user’s locale).

Item-level localisation uses catalog_item_aliases with is_primary_for_locale = true. This means the alias table serves two purposes:

  1. Synonym matching (searching “capsicum” also finds “bell pepper” regardless of locale)
  2. Locale display name (for en-US, the primary display name of that item is “Bell pepper”)

This design avoids a separate translations table for items while still supporting arbitrary locales. The canonical_name in catalog_items.name is always en-AU.

Category and subcategory localisation uses dedicated translation tables (catalog_category_translations, catalog_subcategory_translations) since categories have no synonyms — they have one correct name per locale.

Phase 7 seeds the following locales for English-speaking markets. Non-English locales are stored in the schema but machine-translated content is a Phase 8 concern.

LocaleRegionNotable differences from en-AU
en-AUAustraliaCanonical. Capsicum, Zucchini, Prawns, Paracetamol, Nappy, Bin liner
en-USUnited StatesBell pepper, Zucchini, Shrimp, Acetaminophen/Tylenol (generic), Diaper, Trash bag
en-GBUnited KingdomPepper, Courgette, Prawns, Paracetamol, Nappy, Bin bag
en-NZNew ZealandVery close to en-AU; Capsicum, Courgette (NZ uses UK term), Prawns
en-CACanadaBell pepper, Zucchini, Shrimp, Acetaminophen, Diaper, Garbage bag

The client determines the user’s locale at startup:

frontend/src/lib/locale.ts
export function resolveLocale(tenantPreferredLocale: string | null): string {
// 1. Tenant admin has set a preferred locale
if (tenantPreferredLocale) return tenantPreferredLocale;
// 2. Browser / OS locale
const browserLocale = navigator.language; // e.g. 'en-US', 'fr-FR', 'en-AU'
if (browserLocale) return browserLocale;
// 3. Default
return 'en-AU';
}

The resolved locale is sent with every catalog API request:

  • As the Accept-Language HTTP header (standard, handled automatically by browser fetch)
  • Optionally as ?locale=en-US query parameter for explicit overrides

16.6 Alias seeding — Phase 7 priority list

Section titled “16.6 Alias seeding — Phase 7 priority list”

The seed script seeds these aliases as is_primary_for_locale = true for the relevant locale, making them the display name in that region. The same records also function as search synonyms for all locales.

Canonical (en-AU)en-USen-GBen-NZen-CA
CapsicumBell pepperPepperCapsicumBell pepper
ZucchiniZucchiniCourgetteCourgetteZucchini
Beef minceGround beefBeef minceBeef minceGround beef
PrawnsShrimpPrawnsPrawnsShrimp
CorianderCilantroCorianderCorianderCilantro
Rocket (salad)ArugulaRocketRocketArugula
Spring onionScallionSpring onionSpring onionGreen onion
EggplantEggplantAubergineEggplantEggplant
BiscuitsCookiesBiscuitsBiscuitsCookies
Chips (savoury)Chips / CrispsCrispsChipsChips
Chips (frozen)French friesChipsChipsFrench fries
ParacetamolAcetaminophenParacetamolParacetamolAcetaminophen
NappyDiaperNappyNappyDiaper
Bin linerTrash bagBin bagBin linerGarbage bag
Tomato sauceKetchupTomato ketchupTomato sauceKetchup
Caster sugarSuperfine sugarCaster sugarCaster sugarFruit sugar
Bicarbonate of sodaBaking sodaBicarbonate of sodaBaking sodaBaking soda
Fairy flossCotton candyCandyflossFairy flossCotton candy
SultanasRaisins/SultanasSultanasSultanasRaisins
Icing sugarPowdered sugarIcing sugarIcing sugarIcing sugar
Thickened creamHeavy creamDouble creamThickened creamHeavy cream
Sour creamSour creamSoured creamSour creamSour cream
Continence padsIncontinence padsIncontinence padsContinence padsIncontinence pads
Absorbent underwearAdult diapersIncontinence pantsAbsorbent underwearIncontinence briefs
Walking frameWalkerZimmer frameWalking frameWalker
Walking stickCaneWalking stickWalking stickCane
Pressure mattressPressure relief mattressPressure mattressPressure mattressPressure redistribution mattress

The schema and API are fully prepared for non-English translations. Phase 8 will:

  1. Run machine translation (DeepL or Google Translate API) over all canonical names and category names to generate seed translations for fr-FR, de-DE, es-ES, it-IT, zh-CN, vi, ar.
  2. Platform admin reviews and corrects machine-translated catalog names via the super-admin Catalog Admin UI.
  3. RTL layout adjustments (dir="rtl" on the shopping screen shell) for Arabic and Hebrew.
  4. Locale picker in user profile settings (overrides device locale).

17. Expanded Catalog — Full Item Reference

Section titled “17. Expanded Catalog — Full Item Reference”

This section is the master reference for the Phase 7 catalog seed. It maps directly to backend/scripts/seed_shopping_catalog.py. Items are listed with their canonical en-AU name, emoji icon, default unit, and default quantity.

Aliases (regional synonyms) are seeded from §16.6 above. Every item without a personal emoji inherits its subcategory emoji at render time.

ItemEmojiDefault unitDefault qty
Apple🍎each6
Banana🍌bunch1
Orange🍊each4
Pear🍐each4
Grapes🍇bunch1
Strawberries🍓punnet1
Blueberries🫐punnet1
Raspberries🫐punnet1
Blackberries🫐punnet1
Watermelon🍉each1
Rockmelon🍈each1
Honeydew melon🍈each1
Mango🥭each2
Avocado🥑each2
Lemon🍋each4
Lime🍋each4
Mandarin🍊bag1
Kiwifruit🥝each4
Pineapple🍍each1
Passionfruit🍊each4
Nectarines🍑each4
Peaches🍑each4
Plums🍑each4
Apricots🍑each4
Cherries🍒bag1
Figs🍊each4
Pomegranate🍊each1
Dragon fruit🍊each1
Lychee🍊bag1
Papaya🍈each1
Grapefruit🍊each2
ItemEmojiDefault unitDefault qty
Potato🥔kg1
Sweet potato🥔each2
Carrot🥕bunch1
Onion🧅each3
Red onion🧅each2
Shallots🧅bunch1
Spring onion🧅bunch1
Leek🧅each1
Garlic🧄bulb1
Ginger🧄piece1
Broccoli🥦head1
Cauliflower🥦head1
Cabbage🥬head1
Red cabbage🥬head1
Brussels sprouts🥦bag1
Zucchini🥒each2
Eggplant🍆each1
Capsicum🫑each2
Chilli🌶️each4
Corn🌽each2
Asparagus🌿bunch1
Green beans🌿bag1
Snow peas🌿bag1
Sugar snap peas🌿bag1
Bok choy🥬bunch1
Spinach🥬bag1
Baby spinach🥬bag1
Kale🥬bunch1
Silverbeet🥬bunch1
Lettuce🥬head1
Rocket🥬bag1
Wombok🥬head1
Beetroot🟤bunch1
Pumpkin🎃kg0.5
Butternut pumpkin🎃each1
Mushrooms🍄punnet1
Swiss brown mushrooms🍄punnet1
Portobello mushrooms🍄each4
Celery🌿bunch1
Fennel🌿each1
Cucumber🥒each1
Tomato🍅each4
Cherry tomatoes🍅punnet1
Roma tomatoes🍅each4
Radish🌿bunch1
Parsnip🥕each2
Turnip🥔each2
Celeriac🥔each1
Artichoke🌿each2
ItemEmojiDefault unitDefault qty
Mixed salad leaves🥗bag1
Rocket🥬bag1
Coleslaw mix🥗bag1
Parsley🌿bunch1
Coriander🌿bunch1
Basil🌿bunch1
Mint🌿bunch1
Thyme🌿bunch1
Rosemary🌿bunch1
Dill🌿bunch1
Chives🌿bunch1
Lemongrass🌿stalk2
Kaffir lime leaves🌿pack1
Tarragon🌿bunch1
Sage🌿bunch1
Bay leaves (fresh)🌿bunch1
ItemEmojiDefault unitDefault qty
Chicken breast🍗kg0.5
Chicken thighs🍗kg0.5
Chicken wings🍗kg0.5
Chicken drumsticks🍗pack1
Whole chicken🍗each1
Chicken mince🍗kg0.5
Turkey breast🍗kg0.5
Turkey mince🍗kg0.5
Duck breast🦆each2
Quail🦆each2
ItemEmojiDefault unitDefault qty
Beef mince🥩kg0.5
Beef steak🥩each2
Eye fillet🥩each2
Sirloin🥩each2
Rump steak🥩each2
Beef stir fry strips🥩kg0.3
Roast beef🥩kg1
Corned beef🥩kg1
Veal cutlets🥩each2
Osso bucco🥩each2
Beef short ribs🥩pack1
ItemEmojiDefault unitDefault qty
Pork chops🥓pack1
Pork mince🥓kg0.5
Pork belly🥓kg0.5
Pork roast🥓kg1
Bacon🥓pack1
Pancetta🥓pack1
Ham🥓pack1
Prosciutto🥩pack1
Lamb chops🥩pack1
Lamb mince🥩kg0.5
Lamb roast🥩kg1
Lamb shanks🥩each2
Rack of lamb🥩each1
ItemEmojiDefault unitDefault qty
Sausages🌭pack1
Chorizo🌭each2
Salami🌭pack1
Pepperoni🌭pack1
Deli meats🌭pack1
Hot dogs🌭pack1
Kransky🌭pack1
Cabanossi🌭pack1
ItemEmojiDefault unitDefault qty
Salmon🐟fillet2
Tuna fillet🐟fillet2
White fish fillets🐟fillet2
Barramundi🐟fillet2
Snapper🐟fillet2
Flathead🐟fillet2
Bream🐟each1
Prawns🦐kg0.5
Crab🦀each1
Mussels🦪bag1
Oysters🦪dozen1
Scallops🦪pack1
Calamari🦑pack1
Octopus🐙pack1
Fish cakes🐟pack1
ItemEmojiDefault unitDefault qty
Full cream milk🥛litre2
Skim milk🥛litre2
Reduced fat milk🥛litre2
Lactose free milk🥛litre1
A2 milk🥛litre1
Almond milk🥛litre1
Oat milk🥛litre1
Soy milk🥛litre1
Coconut milk (drinking)🥛litre1
Rice milk🥛litre1
Macadamia milk🥛litre1
Hemp milk🥛litre1
ItemEmojiDefault unitDefault qty
Cheddar🧀block1
Mozzarella🧀ball1
Parmesan🧀block1
Tasty cheese🧀block1
Feta🧀block1
Goat cheese🧀log1
Brie🧀wheel1
Camembert🧀wheel1
Cream cheese🧀tub1
Ricotta🧀tub1
Cottage cheese🧀tub1
Haloumi🧀pack1
Colby🧀block1
Gruyère🧀block1
Blue cheese🧀wedge1
Sliced cheese🧀pack1
ItemEmojiDefault unitDefault qty
Free range eggs🥚dozen1
Cage free eggs🥚dozen1
Organic eggs🥚dozen1
Barn laid eggs🥚dozen1
Duck eggs🥚half dozen1
ItemEmojiDefault unitDefault qty
Butter🧈block1
Salted butter🧈block1
Unsalted butter🧈block1
Margarine🧈tub1
Spreadable butter🧈tub1
Ghee🧈jar1
ItemEmojiDefault unitDefault qty
White bread🍞loaf1
Wholemeal bread🍞loaf1
Multigrain bread🍞loaf1
Sourdough🍞loaf1
Gluten free bread🍞loaf1
Rye bread🍞loaf1
Spelt bread🍞loaf1
Low-GI bread🍞loaf1
Seeded bread🍞loaf1
Bread rolls🥖pack1
Bagels🥯pack1
Burger buns🥖pack1
Hot dog rolls🥖pack1
Croissants🥐pack1
Wraps🫓pack1
Tortillas🫓pack1
Naan🫓pack1
Pita bread🫓pack1
Mountain bread🫓pack1
Muffins🧁pack1
Cake🎂each1

17.2 Pharmacy & Medical — complete item list

Section titled “17.2 Pharmacy & Medical — complete item list”

(Selected key items; full list in seed script)

ItemEmojiDefault unitDefault qty
Prescription medication💊(free text)1
Paracetamol tablets💊pack1
Ibuprofen tablets💊pack1
Aspirin tablets💊pack1
Antihistamine tablets💊pack1
Antacid💊pack1
Laxative💊pack1
Cough syrup🍶bottle1
Throat lozenges💊pack1
Nasal spray💉each1
Saline nasal rinse💉pack1
Eye drops👁️bottle1
Ear drops👂bottle1
Vitamin C💊pack1
Vitamin D3💊pack1
Multivitamin💊pack1
Fish oil💊pack1
Magnesium💊pack1
Probiotics💊pack1
Blood glucose strips🩸pack1
Lancets🩸pack1
Insulin pen needles💉box1
Adhesive bandages🩹pack1
Gauze dressings🩹pack1
Antiseptic cream🩹tube1
Disposable pads (continence)🩱pack1
Absorbent underwear🩱pack1
Pull-up pants🩱pack1
Bed underpads🩱pack1
Nitrile gloves🧤box1
Alcohol wipes🧤pack1
Pill organiser💊each1
Digital thermometer🌡️each1
Walking frame tennis balls🦯pack1
Non-slip socks (medical)🧦pair2

(Selected key items)

ItemEmojiDefault unitDefault qty
Body wash🧴bottle1
Soap bar🧼each2
Hand wash🧴bottle1
Shampoo🧴bottle1
Conditioner🧴bottle1
Dry shampoo🧴can1
Toothpaste🦷tube1
Toothbrush🪥each1
Electric toothbrush heads🪥pack1
Dental floss🦷pack1
Mouthwash🦷bottle1
Denture adhesive🦷tube1
Denture cleaner🦷pack1
Moisturiser🌸tub1
Sunscreen SPF50+☀️bottle1
Deodorant🪒each1
Razors🪒pack1
Pads🌺pack1
Tampons🌺pack1
Baby wipes👶pack2
Nappies👶pack1
Socks👕pair3
Non-slip socks🧦pair2
Compression stockings🧦pair1
Pyjamas👕set1
Slippers👟pair1
Incontinence briefs🩲pack1
ItemEmojiItem typeDefault unitDefault qty
House cleaning🧹servicesession1
Deep clean🧹servicesession1
Window cleaning🧹servicesession1
Lawn mowing🌱servicesession1
Garden maintenance🌱servicesession1
Physiotherapy session🏥servicesession1
Occupational therapy🏥servicesession1
Podiatry🏥servicesession1
Speech therapy🏥servicesession1
Dietitian consultation🏥servicesession1
Massage therapy🏥servicesession1
Psychology session🧠servicesession1
Counselling session🧠servicesession1
Hairdresser✂️servicesession1
Mobile hairdresser✂️servicesession1
Barber✂️servicesession1
Nail care💅servicesession1
Medical transport🚑servicebooking1
NDIS transport🚑servicebooking1
Wheelchair-accessible taxi🚑servicebooking1
Medication delivery📦servicedelivery1
Meals on Wheels📦servicedelivery1
Meal delivery service📦servicedelivery1
Respite care🤝servicesession1
Plumber🔧servicevisit1
Electrician🔧servicevisit1
Handyman🔧servicevisit1
Grab rail installation🔧servicejob1
Ramp installation🔧servicejob1

17.5 Equipment & Aids — complete item list

Section titled “17.5 Equipment & Aids — complete item list”
ItemEmojiDefault unitDefault qty
Walking stick🦯each1
Quad cane🦯each1
Walking frame🦯each1
Rollator🦯each1
Manual wheelchair♿each1
Transport wheelchair♿each1
Power wheelchair♿each1
Crutches🦯pair1
Shower chair🚿each1
Shower stool🚿each1
Bath board🚿each1
Raised toilet seat🚿each1
Toilet frame🚿each1
Grab rail🚿each1
Non-slip bath mat🚿each1
Commode chair🚿each1
Pressure cushion🛏️each1
Gel cushion🛏️each1
Pressure mattress overlay🛏️each1
Heel protectors🛏️pair1
Bed rail🛏️each1
Bed wedge pillow🛏️each1
Overbed table🛏️each1
Monkey pole🛏️each1
Slide sheet🛏️each1
Large print calendar👁️each1
Magnifying glass👁️each1
Talking clock👁️each1
Hearing aid batteries👂pack1
Non-slip mat🏠each1
Jar opener🍴each1
Long handled reacher🍴each1
Adapted cutlery🍴set1
Non-slip plate🍴each1
Cup with two handles🍴each1
Sock aid🧦each1
Urinal bottle🚰each1
Bedpan🚰each1
Catheter leg bag🚰each1
Catheter night bag🚰each1