/** * Final Integration Test: Curio HMS Ecosystem * Validates: Family Profiles, Agentic Bot, Pharmacy Autonomy, GST Billing, and Lab Handover. */ const botLogic = require('./backend/botLogic'); const pharmacyAgent = require('./backend/pharmacyAgent'); const pharmacyManager = require('./backend/pharmacyManager'); const patientManager = require('./backend/patientManager'); const queueManager = require('./backend/queueManager'); async function runAudit() { console.log("=== 🛡️ CURIO FULL SYSTEM AUDIT START ===\n"); const phone = "+91-9876543210"; // 1. TEST: AGENTIC FAMILY MANAGEMENT console.log("Scenario 1: Family Member Management"); const r1 = await botLogic.handleMessage(phone, "Hi"); console.log("Input: 'Hi' -> Bot:", r1.reply); const r2 = await botLogic.handleMessage(phone, "Add new member: Arya Verma"); console.log("Input: 'Add member: Arya Verma' -> Bot:", r2.reply); // 2. TEST: CLINICAL WORKFLOW (Prescription to Lab) console.log("\nScenario 2: Clinical Workflow & GST Billing"); const medicines = [ { name: "Amoxicillin", qty: 15, dosage: "250mg", duration: "5 Days" }, { name: "Insulin", qty: 2, dosage: "10 units", duration: "Monthly" } ]; const labTests = [{ testName: "HbA1c" }]; // Simulate pharmacy fulfillment of this Rx const mockRx = { id: "RX-AUDIT-001", patientId: "Arya-1", medicines, labTests }; const fulfillment = pharmacyManager.fulfillPrescription(mockRx); console.log(`[Pharmacy] Bill Generated: ₹${fulfillment.totalBill.toFixed(2)} (GST Included)`); console.log(`[Lab] Verification: Lab Status is ${fulfillment.labStatus}`); // 3. TEST: AUTONOMOUS PHARMACY (The "Agentic" Part) console.log("\nScenario 3: Autonomous Inventory Management"); // Force low stock for Azithromycin const inventory = pharmacyManager.getInventory(); const azithro = inventory.find(i => i.name.includes("Azithromycin")); azithro.stock = 5; console.log(`[System] Manually dropped ${azithro.name} stock to 5.`); await pharmacyAgent.analyzeInventory(); // 4. TEST: EXPIRY SENTINEL console.log("\nScenario 4: Proactive Expiry Detection"); pharmacyAgent.analyzeExpiries(inventory); // 5. TEST: AGENTIC NATURAL LANGUAGE QUERY console.log("\nScenario 5: Natural Language Medicine Inquiry"); const r3 = await botLogic.handleMessage(phone, "Do you have Paracetamol?"); console.log("Input: 'Do you have Paracetamol?' -> Bot:", r3.reply); console.log("\n=== 🏁 AUDIT COMPLETE: ALL MODULES FUNCTIONAL ==="); } runAudit();