Files
poona-ams/README.md
T

84 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Poona Hospital Asset Management System
![Poona Hospital and Research Centre](frontend/public/logo.jpg)
A centralized Hospital Asset Management and Maintenance System for Poona Hospital and Research Centre.
## Quick Start
### Prerequisites
- Python 3.11+
- Node.js 18+
### Backend
```bash
cd backend
python -m venv .venv
# Windows PowerShell: .venv\Scripts\Activate.ps1
# macOS/Linux: source .venv/bin/activate
.venv/Scripts/pip install -r requirements.txt # or pip install -r requirements.txt once activated
.venv/Scripts/uvicorn app.main:app --reload --port 8000
```
- Health check: http://localhost:8000/api/health
- API docs: http://localhost:8000/docs
### Frontend
```bash
cd frontend
npm install
npm run dev
```
- App: http://localhost:5173
### Run both servers (with Make)
```bash
make dev
```
### Run tests
```bash
make test
# Or directly:
cd backend
.venv/Scripts/python -m pytest tests/ -v
```
### Seed demo data
```bash
cd backend
.venv/Scripts/python -m app.seed.seed
```
## Demo Accounts
| Email | Password | Role |
|---|---|---|
| admin@poona.demo | Demo@123 | System Admin |
| bio@poona.demo | Demo@123 | Biomedical |
| dept@poona.demo | Demo@123 | Department User (ICU) |
| mgmt@poona.demo | Demo@123 | Management |
| coord@poona.demo | Demo@123 | Coordinator |
## What exists now (Phase 5)
- Complete SQLAlchemy 19-table data model across masters, assets, maintenance, complaints, operations, and system modules
- JWT authentication (`/api/auth/login`, `/api/auth/me`), RBAC permission matrix for 5 roles, and Quick Demo Login
- Admin Master Lists CRUD (`/masters`: Departments, Locations, Categories, Vendors, Users)
- Typed System Settings (`/settings`) and TopBar "As of Date" Demo Clock (`POST /api/settings/demo-date`)
- Asset Register (`/assets` & `/assets/:id`): full CRUD with duplicate asset code check (`409`), department scoping, coordinator field-level edit restrictions, 8-tab Asset Detail Overview, and audit logging
- Breakdown & Complaint Register (`/complaints` & `/complaints/:id`): sequential complaint numbering, `AssetPicker` raise modal with multi-file attachments, response time & ongoing/milestone downtime calculations, assign/attend/restore/close/reopen workflow with asset status sync, event timeline, admin timestamp correction, and role-enforced technical/CE/spares section (`FORBIDDEN_TECHNICAL_FIELDS` 403 + read-only lock banner)
- Preventive Maintenance (`/pm`): in-house & outsourced PM schedules (`/api/pm/schedules`), dynamic read-time `upcoming`/`due`/`overdue`/`completed`/`rescheduled` status & severity evaluation against `effective_today()`, KPI summary strip, Table View & 7-column Mon–Sun Month Calendar View, Complete (auto-advancing next cycle via `add_months`) and Reschedule workflows, plus Asset Detail PM tab actions
- Calibration (`/calibration`): single & bulk calibration plan creation (`/api/calibration/plans/from-asset/:assetId`, `/bulk-from-assets`), management/admin/coordinator-gated frequency edit & approval (`FORBIDDEN_CALIBRATION_APPROVAL` 403 for biomedical), dynamic read-time status/severity computation, completion with certificate file upload (`calibration_record` attachments) and auto-generated next due cycle, plus Asset Detail Calibration tab wiring
- Contracts & Warranties (`/contracts`): AMC/CMC/OTHER contract CRUD, expiry chips (`amc_cmc_lead_days`, `red_threshold_days`), renewal workflow (`POST /api/contracts/:id/renew` marking prior contract `is_superseded=True` and linking `renewed_from_id`), renewal history chain (`/api/contracts/history/:assetId`), warranty tracking with auto-computed editable end date, and inline document attachments (`contract`/`warranty`)
- Asset Insurance (`/insurance`) & Slide-Over `InsuranceDrawer`: insurance policy register with INR coverage display, expiry alerts, policy attachments (`insurance`), and `"View Insurance"` drawer accessible from `AssetDetailPage`, `AssetPicker`, and `ComplaintDetailPage`
- Demo Equipment (`/demo-equipment`): trial equipment register with dynamic `on_demo`/`overdue_return`/`returned` status relative to `effective_today()`, return logging (`POST /api/demo-equipment/:id/return`), and `demo_equipment` attachments
- Department Visits (`/visits`): biomedical/admin round logs with management read access (403 for `department_user` and `coordinator`), department-filtered multi-asset checklist, observations, and complaint creation/linking (`POST /api/visits/:id/link-complaint`)
- Reusable `AssetPicker` (`/api/assets/lookup`) with warranty/condemned status badges
- Secure Document Attachments (`/api/attachments`: JPG/PNG/PDF validation with magic-byte check, 10 MB limit, authenticated preview/download, role-based upload/delete)
- Idempotent deterministic seed script (`python -m app.seed.seed`) populating realistic hospital demo data
- React + TypeScript frontend app shell with role-filtered sidebar, route guards, DataTable, and Tailwind CSS + shadcn/ui
- Makefile for common tasks
## Modules (all phases)
Phase 0: Scaffold | Phase 1: Auth & Masters | Phase 2: Assets | Phase 3: Complaints
Phase 4: PM & Calibration | Phase 5: Contracts, Warranty, Insurance, Demo, Visits
Phase 6: Notifications & Dashboard | Phase 7: Reports | Phase 8: Polish