{"ok":true,"module":"module-3-pharmacy","meta":{"title":"Module 3 — Pharmacy & E-Commerce","moduleRegistryPrefix":"PhA / EC","sourcePath":"reference/concept-platform/Platform pahse 3 mvp/Module 3","specStack":"healthcare_platform_api (FastAPI)","layers":5,"overallCompletionPct":58,"orderPipeline":"payment_pending → paid → packed → shipped → delivered","integratedWith":"hospitalnode.in — catalog-browse, cart, Razorpay, logistics","updated":"June 2026"},"integration":{"layers":5,"completionPct":58,"liveLayers":1,"partialLayers":3,"gapLayers":1},"layers":[{"layer":1,"id":"catalogue","name":"Catalogue & batch inventory","status":"partial","routes":[{"label":"Pharmacy browse","href":"/shop?view=paramedics&service=pharmacy","status":"live"},{"label":"Drug index / OpenSearch","href":"/shop/pharmacy","status":"partial"},{"label":"780 normalized products","href":"/api/products","status":"live"},{"label":"Admin catalog","href":"/admin/catalog","status":"partial"},{"label":"Vendor listings","href":"/vendor","status":"partial"}],"gaps":["No Batch table with expiry-driven available_stock","schedule_type (OTC/Schedule H/H1) not unified on all browse cards","Public browse OK; pharmacist-only product create split across admin/vendor","780 products_master → vendor_products bridge for orderable cards","9L OpenSearch sync requires Docker running"]},{"layer":2,"id":"cart-gates","name":"Cart + Schedule H / KYC gates","status":"partial","routes":[{"label":"Cart","href":"/cart","status":"live"},{"label":"Server cart API","href":"/api/cart","status":"live"},{"label":"Module 1 KYC","href":"/module1","status":"gap"}],"gaps":["GET /cart response missing requires_prescription + requires_kyc + can_checkout booleans","requires_kyc not enforced (Module 1 Layer 4 gap)","Per-item prescription coverage status not live on cart","Stock atomicity: verifyInventory partial — not FOR UPDATE like spec"]},{"layer":3,"id":"rx-review","name":"Prescription upload + pharmacist review","status":"gap","routes":[{"label":"Hospital AI Rx OCR","href":"/shop?view=ai","status":"partial"},{"label":"Rx API","href":"/api/shop/hospital-ai/rx","status":"partial"},{"label":"Admin pharmacy","href":"/admin/pharmacy","status":"partial"},{"label":"Vendor dispense","href":"/vendor","status":"gap"}],"gaps":["PhC-01: Rx verification before dispense — not built","No Prescription/PrescriptionItem tables snapshotted from cart","Pharmacist-only review (admin blocked) — not implemented","Cannot review own prescription (conflict check)","Magic-byte PDF/JPG validation on Rx upload — partial","S3 private Rx storage — gap"]},{"layer":4,"id":"order-placement","name":"Order placement + FEFO stock deduct","status":"live","routes":[{"label":"Checkout","href":"/checkout","status":"live"},{"label":"Place order API","href":"/api/orders","status":"live"},{"label":"Razorpay webhook","href":"/api/payments/razorpay/webhook","status":"live"},{"label":"Track order","href":"/customer/track-order","status":"partial"}],"gaps":["Fresh re-check of Rx approval + KYC at place-order (spec) — KYC missing","FEFO batch deduction + OrderItemBatchAllocation","Order status enum differs: pending vs payment_pending → paid pipeline","Prescription not marked consumed after order (spec known limitation)","Multi-vendor checkout_group_id — spec is single-pharmacy cart"]},{"layer":5,"id":"fulfillment","name":"Dispatch & fulfillment pipeline","status":"partial","routes":[{"label":"Customer track order","href":"/customer/track-order","status":"partial"},{"label":"Vendor orders","href":"/vendor","status":"partial"},{"label":"Logistics / hospitalnode.in · hnorder.in","href":"/checkout","status":"partial"},{"label":"Blockchain commerce","href":"/blockchain","status":"planned"}],"gaps":["No GET /fulfillment/queue FIFO by status","No pharmacist pack/ship/deliver transitions with JWT attribution","Courier tracking manual — no Delhivery/India Post API","Open-box AI ≥₹500 (blockchain spec) — gap","VHG commission auto-credit (step 14 EC spec) — gap"]}],"gateComposition":[{"gate":"requires_prescription","source":"Module 3 L3","platformRoute":"requiresPrescription on items; order prescription_status","status":"partial"},{"gate":"requires_kyc","source":"Module 1 L4","platformRoute":"Not on cart API — see /module1","status":"gap"},{"gate":"can_checkout","source":"Module 3 L2","platformRoute":"Checkout proceeds without both gates clear","status":"gap"},{"gate":"stock_sufficient","source":"Module 3 L1+L4","platformRoute":"reserveInventory / verifyInventory","status":"partial"}],"orderJourney":[{"step":"Browse catalogue","layer":"L1","route":"/shop?view=paramedics&service=pharmacy","status":"live"},{"step":"Add to cart","layer":"L2","route":"/cart","status":"live"},{"step":"Upload Rx (Schedule H)","layer":"L3","route":"/shop?view=ai","status":"partial"},{"step":"Pharmacist approve","layer":"L3","route":"/vendor","status":"gap"},{"step":"Checkout + pay","layer":"L4","route":"/checkout","status":"live"},{"step":"Pack → ship → deliver","layer":"L5","route":"/customer/track-order","status":"partial"}],"apiMap":[{"spec":"GET /pharmacy/products","platformRoute":"GET /api/catalog/browse · /api/products","status":"live"},{"spec":"GET /cart","platformRoute":"GET /api/cart","status":"partial"},{"spec":"POST /prescriptions","platformRoute":"POST /api/shop/hospital-ai/rx","status":"partial"},{"spec":"POST /prescriptions/{id}/approve","platformRoute":"—","status":"gap"},{"spec":"POST /orders","platformRoute":"POST /api/orders","status":"live"},{"spec":"POST /fulfillment/.../pack","platformRoute":"vendor order actions partial","status":"gap"},{"spec":"mark_paid() stub","platformRoute":"Razorpay webhook (real)","status":"live"}],"dashboard":"/module3","paymentNote":"hospitalnode uses real Razorpay — spec mark_paid() stub replaced"}