78 lines
7.5 KiB
Markdown
78 lines
7.5 KiB
Markdown
# XYZ Hospital AMS — 10-Minute End-to-End Demo Script
|
||
|
||
**Prerequisites**:
|
||
1. Run `python -m app.seed.seed` inside `backend/` to load realistic hospital demo data (60 assets, 30 complaints, 45 PM schedules, 20 calibration plans, 35 contracts, 20 warranties, 25 insurance policies, 3 demo items, 12 department visits, and 26 alerts).
|
||
2. Start backend (`uvicorn app.main:app --port 8000`) and frontend (`npm run dev` on `http://localhost:5173`), or run `docker compose up --build`.
|
||
3. All demo accounts use password **`Demo@123`**:
|
||
- **System Admin**: `admin@xyz.demo`
|
||
- **Biomedical Engineer**: `bio@xyz.demo`
|
||
- **Department User (ICU)**: `dept@xyz.demo`
|
||
- **Management**: `mgmt@xyz.demo`
|
||
- **Coordinator**: `coord@xyz.demo`
|
||
|
||
---
|
||
|
||
## Step 1 — Login, Role Overview & Calibration Pop-up (1 min)
|
||
1. Open `http://localhost:5173/login`. Use Quick Demo Login or sign in as **Biomedical** (`bio@xyz.demo` / `Demo@123`).
|
||
2. Observe the **Calibration Reminder Pop-up** (`CalibrationReminderModal`) surfacing upcoming/due/overdue calibrations once per login. Click **Go to Calibration** or dismiss it.
|
||
3. Point out the role-filtered sidebar (no Masters/Settings/Audit Log for Biomedical).
|
||
|
||
## Step 2 — Hospital Operations Dashboard & Global Quick Search (1 min)
|
||
1. On `/` (`DashboardPage`), review the 7 clickable KPI cards, the 4 Recharts visualizations (Complaints by Status, Complaints by Department, 6-Month Downtime Trend, PM Planned vs Completed), **Needs Attention**, and **Recent Complaints**.
|
||
2. In the TopBar search box, type `PHRC` or `Ventilator`. Observe the grouped **Assets** and **Complaints** dropdown; click an asset to jump directly to `/assets/:id`.
|
||
|
||
## Step 3 — Asset Register, 8-Tab Detail & Insurance Drawer (1 min)
|
||
1. Navigate to `/assets` and open an ICU asset (`/assets/:id`).
|
||
2. Walk through the tabs (**Overview**, **Contracts**, **Warranty**, **Insurance**, **PM**, **Calibration**, **Complaints**, **Documents**).
|
||
3. Click **View Insurance** to slide open `InsuranceDrawer` showing policy coverage in INR and attached policy PDF.
|
||
|
||
## Step 4 — Breakdown Complaint Lifecycle & Department Scoping (1.5 min)
|
||
1. Sign out and log in as **Department User (ICU)** (`dept@xyz.demo` / `Demo@123`).
|
||
- Notice the ICU-scoped dashboard banner and asset/complaint lists limited to ICU.
|
||
- Click **Raise Complaint** (`/complaints`), select an ICU asset using `AssetPicker` (note warranty/coverage badge), enter a breakdown description, attach an image/PDF, and submit.
|
||
- Open a complaint detail (`/complaints/:id`) and point out the **read-only lock banner** on the Technical / CE / Spares section (`FORBIDDEN_TECHNICAL_FIELDS` for non-biomedical/admin roles).
|
||
2. Switch to **Biomedical** (`bio@xyz.demo`), open the newly raised complaint, assign/attend/restore it, enter technical action & spares, and close it with closure remarks—confirm `Asset.status` syncs back to `in_service` and downtime is calculated in IST.
|
||
|
||
## Step 5 — Preventive Maintenance Table & Calendar Views (1 min)
|
||
1. Open `/pm` (`PMPage`). Review the KPI strip and toggle between **Table View** and the **7-column Mon–Sun Month Calendar View**.
|
||
2. Complete a due PM item (auto-advances next cycle using clamped `add_months`) or reschedule an upcoming PM item.
|
||
|
||
## Step 6 — Calibration Plan Approval Gate (1 min)
|
||
1. Open `/calibration` (`CalibrationPage`) as **Biomedical** (`bio@xyz.demo`). Note that creating/completing calibrations (with certificate PDF upload) is enabled, whereas frequency approval controls are gated (`FORBIDDEN_CALIBRATION_APPROVAL`).
|
||
2. Switch to **Management** (`mgmt@xyz.demo`) or **Coordinator** (`coord@xyz.demo`) to approve a calibration plan's frequency.
|
||
|
||
## Step 7 — Contracts Renewal Chain, Warranties, Demo Equipment & Visits (1 min)
|
||
1. Open `/contracts` (`/contracts`) and renew an expiring AMC/CMC contract—observe the superseded badge on the prior contract and the intact renewal history chain.
|
||
2. Open `/demo-equipment` to view active vs overdue trial equipment and log a return.
|
||
3. Open `/visits` as **Biomedical** (`bio@xyz.demo`) to review/log a department round linked to multiple assets and complaints; verify `dept@xyz.demo` / `coord@xyz.demo` cannot access `/visits`.
|
||
|
||
## Step 8 — Demo Clock ("As of Date") & Live Alert Engine (1 min)
|
||
1. Log in as **System Admin** (`admin@xyz.demo`).
|
||
2. Use the TopBar **"As of Date"** Demo Clock to advance the date by +20 days.
|
||
3. Click **Run alert check now** in `/settings` (or `/notifications`), watch new deduplicated notifications appear in the TopBar bell counter and `/notifications` inbox, then reset Demo Date back to real time.
|
||
|
||
## Step 9 — 8 Operational Reports, Formula Transparency & Excel/CSV/Print (1 min)
|
||
1. Open `/reports` (`ReportsPage`) and click **Monthly Maintenance Summary** (`/reports/monthly-maintenance`).
|
||
2. Inspect the **"How this is calculated"** formula popover (`scheduled_hours_per_day`, `downtime_end_milestone`, `clip_downtime_to_month`), Recharts BarChart/PieChart, export `.xlsx` and `.csv`, and trigger **Print (A4)** preview.
|
||
|
||
## Step 10 — Audit Log Viewer & Rate-Limit Protection (0.5 min)
|
||
1. As **System Admin** (`admin@xyz.demo`), open `/audit-logs` (`AuditLogsPage`) to filter historical entity mutations by Entity Type, User, Action, Date Range, and search query, and inspect the JSON diff modal.
|
||
2. Confirm `/audit-logs` is restricted to `system_admin` only (`403` for other roles) and `POST /api/auth/login` enforces sliding-window rate limiting (`429 RATE_LIMITED`).
|
||
|
||
---
|
||
|
||
## Step 11 — AI Report, Cost Analysis & AMC/CMC Auto-Tagging (2 min)
|
||
1. **Coverage Tag on a New Complaint (25 sec)**:
|
||
- Open `/complaints`, click **Raise Complaint**, and pick an ICU asset in `AssetPicker` (e.g. `PHRC-ICU-0001`).
|
||
- Point out the live **Coverage Badge** (`Under Warranty`, `Under CMC`, `Under AMC`, or `Out of Contract`) and hover to show `"Call: <vendor>, <contact>"`. Submit the complaint and show that the coverage tag is snapshotted on the complaint detail page and timeline.
|
||
2. **Switch to AI Report (15 sec)**:
|
||
- Open `/reports` as **Management** (`mgmt@xyz.demo`) or **System Admin** (`admin@xyz.demo`) and click the **"AI report"** side of the `"Simple reports | AI report"` segmented toggle (note that `dept@xyz.demo` does not see this toggle).
|
||
- Point out the top status chip (`Rule-based summary` by default, or `AI: local model <name>` when Ollama is active).
|
||
3. **Repeat-Failure & Replacement Suggestions (25 sec)**:
|
||
- Scroll to the top **Suggestions** panel. Highlight a red **S1 Repeat Failure** card and an **S4 Replacement Review** card, expand **Supporting evidence** to show the exact metric IDs and values, click an asset code link, and note that every suggestion ends with `"Needs a human decision."`.
|
||
4. **Comparison Table (25 sec)**:
|
||
- Scroll to **1. Comparison: in-house vs outsourced vs rent**. Show the 10 latest equipment rows comparing 5-year In-House vs Outsourced (AMC/CMC) vs Rent costs in INR, the highlighted lowest-cost option, difference vs next option, and any grey `"Insufficient data: <input>"` cells.
|
||
5. **Depreciation Example & Rule-Based vs AI Summary (30 sec)**:
|
||
- Scroll to **2. Depreciated price and cost analysis**. Click an asset row to display its Book Value curve over useful life and point out red maintenance-ratio flags (≥ 40%).
|
||
- Open **Evidence** and **How this is calculated** on any section, and demonstrate the **Rule-based summary** badge (plus **Regenerate summary** as `admin@xyz.demo`, and if Ollama is enabled in `/settings`, show an `AI summary` badge or automatic fallback). Export Excel (`.xlsx`) to show the 3 sheets: main report, `Evidence`, and `How calculated`.
|