# Poona Hospital AMS — Role-Based User Guide Welcome to the Poona Hospital Asset Management & Maintenance System. This quick-start guide details the day-to-day operations, permissions, and typical workflows for each user role. All demo accounts share the password: `Demo@123` --- ## 1. System Administrator (`admin@poona.demo`) The System Administrator oversees system security, reference masters, user access, and global configuration. ### Key Capabilities - **Master Data Management (`/masters`)**: Maintain active Departments, Physical Locations, Equipment Categories, Vendors/Suppliers, and System Users. Masters use soft deletion to preserve historical linkage. - **Admin Password Reset**: Admins can click "Reset password" on any user row on the Users tab to set a new password directly from the UI. Resetting invalidates all existing active sessions of that user immediately via token versioning. - **Universal Password Policy**: Passwords must be 8–128 characters, contain at least one letter and one number, have no leading/trailing spaces, avoid common blocklisted passwords, and cannot contain the user's email username. - **System Settings (`/settings`)**: Configure hospital-wide business rules: - SLA thresholds (`critical_complaint_sla_hours`, `non_critical_complaint_sla_hours`) - Alert lead times for Contracts, PM, Calibration, Insurance, and Demo Equipment - Mandatory closure remarks toggle (`require_closure_remarks`) - Downtime calculation milestone (`attendance`, `restoration`, or `closure`) - Demo Clock (`demo_as_of_date`) to simulate future dates for testing alerts - **Audit Logs (`/audit-logs`)**: Search, filter, and inspect detailed JSON diffs of all system mutations and user actions. - **Bulk Imports & Duplicate Prevention**: - Download official templates for Assets, Contracts, Calibration Plans, and Insurance Policies (templates include empty headers on Sheet 1 and example rows on Sheet 2). - Exact duplicates in file uploads or direct creations (duplicate contracts with matching asset/type/dates, duplicate insurance policy numbers, or duplicate calibration plans per asset) are rejected with clear line-item error messages or HTTP 409 status. - **Database Backup & Recovery**: Execute `python scripts/backup.py` to create a safe online snapshot (.tar.gz or .zip) of the database and uploaded attachments. --- ## 2. Biomedical Engineer (`bio@poona.demo`) Biomedical Engineers handle physical medical assets, breakdown repairs, preventative maintenance schedules, and rounds. ### Key Workflows - **Asset Registration & Maintenance (`/assets`)**: - Register new medical equipment with full technical, procurement, warranty, and vendor details. - View comprehensive 8-tab overview for any asset (PM, Calibration, Contracts, Insurance, History). - **Breakdown Complaint Management (`/complaints`)**: - Attend assigned complaints and log attendance timestamps. - Document technical actions: Company Engineer (CE) details, action taken, spare parts required, root cause, and corrective action. - Mark equipment as **Restored** when functioning (automatically returning asset to `in_service`). - Close complaints with mandatory closure remarks. - **Preventive Maintenance (`/pm`)**: - View planned PM in Table or 7-column Calendar views. - Execute PM records, attach vendor service reports/job sheets, and automatically advance next planned cycle. - **Department Rounds (`/visits`)**: - Conduct daily/weekly rounds, inspect equipment by department, log observations, note new equipment requirements, and link or spawn breakdown complaints directly from the visit sheet. --- ## 3. Department User (`dept@poona.demo` — ICU) Department Users (Nurses, In-charges, Technicians) raise and monitor breakdown calls for their own department. ### Key Workflows - **Scoped View**: Automatically restricted to seeing only assets and complaints belonging to their assigned department (e.g., ICU). - If a department user account is created without an assigned department (`department_id=None`), the user is scoped to an empty dataset by default (seeing zero assets, zero complaints, and zero dashboard metrics) to prevent unintended access to hospital-wide data. - **Raising Complaints (`/complaints`)**: - Click **Raise Complaint**, search for the faulty equipment using `AssetPicker` (which highlights warranty and condemnation status), choose Priority (`Critical` or `Non-Critical`), and enter the problem description. - Attach photos or fault screenshots directly. - **Tracking Progress**: - Monitor real-time status chips (`Open`, `In Progress`, `Closed`). - View assignment details and attendance timestamps. - Technical engineering fields, spare parts costs, and master configurations are safely locked (read-only). --- ## 4. Management (`mgmt@poona.demo`) Hospital Management (Medical Superintendent, Directors, Quality Heads) review operational performance, KPIs, and reports. ### Key Capabilities - **Hospital Operations Dashboard (`/`)**: - High-level KPI summary: Total Assets, Equipment Under Repair, Open Complaints, Critical Breakdown Calls, and PM Compliance rate. - Interactive charts: Complaints by Status, Complaints by Department, 6-Month Downtime Trend, and PM Performance. - Clickable "Needs Attention" list highlighting urgent overdue items. - **Calibration Plan Approvals (`/calibration`)**: - Review and approve calibration frequencies set on critical biomedical equipment (gated specifically to Management and Administration). - **8 Operational Reports (`/reports`)**: - Monthly Maintenance Summary with downtime minutes and Uptime % calculations. - Monthly Department Performance, PM Compliance, Calibration Due, AMC/CMC Validity, and Breakdown Analytics. - One-click Excel spreadsheet (`.xlsx`) export and print-ready A4 landscape layouts. --- ## 5. Clinical Coordinator (`coord@poona.demo`) Coordinators manage legal contracts, equipment warranties, insurance coverage, and loaner/demo devices. ### Key Workflows - **Contracts & Warranties (`/contracts`)**: - Register AMC and CMC service agreements, coverage periods, and vendor contacts. - Upload signed contract PDFs or warranty certificates. - Renew expiring contracts with automatic superseding of prior contracts and full history chain retention. - **Asset Insurance (`/insurance`)**: - Record policy numbers, insurance companies, coverage sums in INR, and effective dates. - Quick-access **Insurance Drawer** lets users inspect policy details directly from any asset or breakdown record. - **Demo & Trial Equipment (`/demo-equipment`)**: - Track evaluation and trial machines on loan from vendors. - Record serial numbers, trial durations, expected return dates, and log official returns. - **Notifications & Expiry Alerts (`/notifications`)**: - Receive automated 30-day advance alerts for expiring contracts, warranties, and insurance policies. --- ## 6. Cost Inputs, AMC/CMC Auto-Tagging & AI Report ### Cost Fields & Role Visibility - Assets support `acquisition_mode` (`purchased` or `rented`), `monthly_rent` (INR/month), `useful_life_years`, `salvage_pct` (0–50%), and `depreciation_method` (`straight_line` or `written_down`). Categories support `default_useful_life_years`, Contracts store `contract_value` (INR), PM schedules store `cost_per_visit` (INR), and Breakdown Complaints store `repair_cost` (INR, restricted to Biomedical and System Admin alongside technical fields). - **Role Access**: Cost fields are visible to `system_admin`, `biomedical`, `management`, and `coordinator`, and are automatically stripped from all API responses for `department_user`. Editing cost fields is restricted to `system_admin` and `biomedical` (`coordinator` may edit `contract_value` on contracts only). ### AMC / CMC Auto-Tagging - Every asset, breakdown complaint, and PM schedule automatically displays a color-coded **Coverage Badge** (`Under Warranty` blue, `Under CMC` green, `Under AMC` teal, `Other Contract` grey, `Out of Contract` red) with a hover tooltip showing `"Call: , "`. - Precedence is strictly: **Active Warranty > Active CMC > Active AMC > Active OTHER Contract > Out of Contract**. - When a breakdown complaint is registered, the live coverage tag, contract, and provider are snapshotted onto the complaint and logged to its event timeline. Creating an outsourced PM schedule auto-fills the active AMC/CMC contract and service provider (or surfaces a `"No active contract"` warning if none exists). ### AI Report & Cost Analysis (`/reports/ai`) - Available via the **"Simple reports | AI report"** toggle on `/reports` for `system_admin`, `biomedical`, `management`, and `coordinator` (`department_user` gets HTTP `403` and sees no toggle). - All numbers are computed deterministically by Python code; any connected language model only writes narrative words about pre-computed evidence and is strictly checked against the underlying numbers and banned decision words. - Includes a top **Suggestions** panel (rules `S1`–`S8` with red/yellow/info severity and `"Needs a human decision."`) and four numbered sections: 1. **Comparison: in-house vs outsourced vs rent** (latest equipment cost table, grouped bar chart, grey `"Insufficient data: ..."` cells). 2. **Depreciated price and cost analysis** (book value, accumulated depreciation, maintenance ratio highlighted red above threshold, lifetime cost, interactive book-value curve). 3. **Efficiency** (uptime %, MTTR, MTBF, PM compliance %, composite 0–100 score, stacked department chart). 4. **Breakdown frequency and average breakdowns** (total breakdowns, average per equipment, repeat-failure count, top-10 table, monthly trend & department/category bar chart). - Every section includes a narrative card (`Rule-based summary` or `AI summary`), an **Evidence** accordion, a **How this is calculated** formula popover, styled 3-sheet Excel (`.xlsx`) & CSV exports (main sheet, `Evidence`, `How calculated`), and A4 Print support. `system_admin` also sees a **Regenerate summary** button. ### Enabling an Optional Local AI Model - By default (`AI_PROVIDER=none`), the application uses fast, deterministic rule-based summaries with zero external dependencies. - To enable local AI narratives on hospital-controlled infrastructure: 1. Run a local model server such as [Ollama](https://ollama.com) (`ollama pull llama3.2`) or a local OpenAI-compatible endpoint. 2. Set `AI_PROVIDER=ollama` (or `openai_compatible`), `AI_BASE_URL=http://localhost:11434`, and `AI_MODEL=` in `.env` (or `docker-compose.yml`) and restart the backend. 3. Log in as `system_admin`, open `/settings`, scroll to **AI and cost analysis**, confirm **Provider Reachable** shows `Yes`, toggle **Enable AI Narrative (`ai_enabled`)** on, and save. 4. If the local server stops, times out, or produces an ungrounded number, the app automatically falls back to the rule-based summary and displays a small rejection warning without failing the page.