brand: remove all poona references and standardize on XYZ Hospital

This commit is contained in:
Antigravity
2026-11-18 18:27:07 +05:30
parent 5740e9281c
commit d7ee2827db
61 changed files with 273 additions and 272 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Agent Operating Rules — Poona Hospital AMS
# Agent Operating Rules — XYZ Hospital AMS
- Build exactly what the plan and proposal describe. **Out of scope:** QR codes, barcode scanning, SMS/WhatsApp, any AI/LLM features, payment/rent/depreciation modules, multi-hospital tenancy, mobile native apps.
- Work phase by phase. Do not start the next phase until told. Commit at the end of each phase with message `phase-N: <summary>`.
+1 -1
View File
@@ -29,4 +29,4 @@ install:
cd frontend && npm install
package:
git archive --format=zip --output=../poona-ams-delivery.zip HEAD
git archive --format=zip --output=../xyz-ams-delivery.zip HEAD
+7 -7
View File
@@ -125,21 +125,21 @@ python scripts/backup.py restore data/backups/ams_backup_YYYYMMDD_HHMMSS.zip
To schedule automatic nightly backups at 01:00 AM:
- **Linux / Docker (cron):**
```cron
0 1 * * * cd /path/to/poona-ams/backend && /path/to/poona-ams/backend/.venv/bin/python scripts/backup.py backup >> /var/log/ams_backup.log 2>&1
0 1 * * * cd /path/to/xyz-ams/backend && /path/to/xyz-ams/backend/.venv/bin/python scripts/backup.py backup >> /var/log/ams_backup.log 2>&1
```
- **Windows (Task Scheduler / PowerShell):**
```powershell
schtasks /create /tn "PoonaAMS_NightlyBackup" /tr "powershell -ExecutionPolicy Bypass -Command 'cd C:\path\to\poona-ams\backend; .\.venv\Scripts\python.exe scripts\backup.py backup'" /sc daily /st 01:00
schtasks /create /tn "XYZAMS_NightlyBackup" /tr "powershell -ExecutionPolicy Bypass -Command 'cd C:\path\to\xyz-ams\backend; .\.venv\Scripts\python.exe scripts\backup.py backup'" /sc daily /st 01:00
```
## 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 |
| admin@xyz.demo | Demo@123 | System Admin |
| bio@xyz.demo | Demo@123 | Biomedical |
| dept@xyz.demo | Demo@123 | Department User (ICU) |
| mgmt@xyz.demo | Demo@123 | Management |
| coord@xyz.demo | Demo@123 | Coordinator |
## Implemented Application (Phases 0–8 Complete)
- Complete SQLAlchemy 19-table data model across masters, assets, maintenance, complaints, operations, and system modules with performance indexes on foreign keys, status, and date columns
+1 -1
View File
@@ -2,7 +2,7 @@ import logging
from sqlalchemy.engine import Engine
from ..models import Base
logger = logging.getLogger("poona_ams")
logger = logging.getLogger("xyz_ams")
def run_sqlite_migrations(engine: Engine) -> None:
+3 -3
View File
@@ -43,7 +43,7 @@ logging.basicConfig(
format="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
level=logging.INFO,
)
logger = logging.getLogger("poona_ams")
logger = logging.getLogger("xyz_ams")
def _scheduled_alert_job() -> None:
@@ -86,7 +86,7 @@ async def lifespan(app: FastAPI):
scheduler.start()
logger.info("APScheduler daily alert check started (06:00 %s).", app_settings.TIMEZONE)
logger.info("Poona Hospital AMS started.")
logger.info("XYZ Hospital AMS started.")
try:
yield
finally:
@@ -96,7 +96,7 @@ async def lifespan(app: FastAPI):
app = FastAPI(
title="Poona Hospital AMS",
title="XYZ Hospital AMS",
version="0.1.0",
docs_url="/docs",
lifespan=lifespan,
+1 -1
View File
@@ -5,4 +5,4 @@ router = APIRouter(tags=["health"])
@router.get("/health")
def health_check():
return {"status": "ok", "service": "Poona Hospital AMS", "version": "0.1.0"}
return {"status": "ok", "service": "XYZ Hospital AMS", "version": "0.1.0"}
+15 -15
View File
@@ -65,7 +65,7 @@ def _make_placeholder_jpeg(dest: Path, label: str, bg_rgb: tuple[int, int, int])
img = Image.new("RGB", (640, 480), color=bg_rgb)
draw = ImageDraw.Draw(img)
draw.rectangle([20, 20, 620, 460], outline=(255, 255, 255), width=3)
draw.text((40, 200), "Poona Hospital & Research Centre", fill=(255, 255, 255))
draw.text((40, 200), "XYZ Hospital", fill=(255, 255, 255))
draw.text((40, 240), label, fill=(240, 240, 240))
img.save(dest, format="JPEG", quality=80)
return dest.stat().st_size
@@ -205,17 +205,17 @@ def seed_database(db: Session, upload_dir: Path | None = None) -> dict[str, int]
# 7. Users (11: 5 demo + 6 realistic hospital staff)
demo_pw_hash = hash_password("Demo@123")
user_specs = [
("Dr. Rajesh Kulkarni", "admin@poona.demo", "system_admin", None),
("Suresh Deshmukh", "bio@poona.demo", "biomedical", None),
("Sister Kavita Joshi", "dept@poona.demo", "department_user", departments[0].id), # ICU
("Dr. Anjali Gokhale", "mgmt@poona.demo", "management", None),
("Priya Patwardhan", "coord@poona.demo", "coordinator", None),
("Vikram Shinde", "vikram.shinde@poona.demo", "biomedical", None),
("Sneha Kulkarni", "sneha.kulkarni@poona.demo", "biomedical", None),
("Dr. Amit Bhosale", "dr.amit.bhosale@poona.demo", "department_user", departments[1].id), # OT
("Meera Nair", "meera.nair@poona.demo", "department_user", departments[2].id), # RAD
("Rohit Deshpande", "rohit.deshpande@poona.demo", "department_user", departments[3].id), # CARD
("Neha Chavan", "neha.chavan@poona.demo", "coordinator", None),
("Dr. Rajesh Kulkarni", "admin@xyz.demo", "system_admin", None),
("Suresh Deshmukh", "bio@xyz.demo", "biomedical", None),
("Sister Kavita Joshi", "dept@xyz.demo", "department_user", departments[0].id), # ICU
("Dr. Anjali Gokhale", "mgmt@xyz.demo", "management", None),
("Priya Patwardhan", "coord@xyz.demo", "coordinator", None),
("Vikram Shinde", "vikram.shinde@xyz.demo", "biomedical", None),
("Sneha Kulkarni", "sneha.kulkarni@xyz.demo", "biomedical", None),
("Dr. Amit Bhosale", "dr.amit.bhosale@xyz.demo", "department_user", departments[1].id), # OT
("Meera Nair", "meera.nair@xyz.demo", "department_user", departments[2].id), # RAD
("Rohit Deshpande", "rohit.deshpande@xyz.demo", "department_user", departments[3].id), # CARD
("Neha Chavan", "neha.chavan@xyz.demo", "coordinator", None),
]
users: list[User] = []
for uname, uemail, urole, udept in user_specs:
@@ -337,7 +337,7 @@ def seed_database(db: Session, upload_dir: Path | None = None) -> dict[str, int]
criticality=criticality,
requires_calibration=needs_cal,
insurance_applicable=needs_ins,
remarks="Procured under Poona Hospital capital equipment budget." if not is_rented else "Leased medical equipment on monthly rental.",
remarks="Procured under XYZ Hospital capital equipment budget." if not is_rented else "Leased medical equipment on monthly rental.",
created_by_id=admin_user.id,
updated_by_id=admin_user.id,
)
@@ -716,7 +716,7 @@ def seed_database(db: Session, upload_dir: Path | None = None) -> dict[str, int]
description=issue_descriptions[idx % len(issue_descriptions)],
breakdown_details=f"Reported by {asset.department.code} nursing/technical staff during routine shift.",
priority=priority,
notes="Logged via Poona AMS helpdesk.",
notes="Logged via XYZ AMS helpdesk.",
registered_at=reg_at,
registered_by_id=reg_user.id,
received_by_id=recv_user.id,
@@ -820,7 +820,7 @@ def seed_database(db: Session, upload_dir: Path | None = None) -> dict[str, int]
for p in range(6):
fname = f"seed_doc_{p + 1:02d}.pdf"
fpath = target_upload_dir / fname
pdf_bytes = _make_minimal_pdf(f"Poona Hospital Service / Calibration Report #{p + 1}")
pdf_bytes = _make_minimal_pdf(f"XYZ Hospital Service / Calibration Report #{p + 1}")
fpath.write_bytes(pdf_bytes)
db.add(
Attachment(
+1 -1
View File
@@ -1,5 +1,5 @@
"""
Poona Hospital Asset Management System
XYZ Hospital Asset Management System
Bulk Import Template Builders for Contracts, Calibration Plans, and Insurance Policies.
"""
+3 -3
View File
@@ -94,7 +94,7 @@ def _write_styled_sheet(ws, report_payload: dict[str, Any]) -> None:
# Explicitly show grid lines in Excel view
ws.views.sheetView[0].showGridLines = True
title_text = f"Poona Hospital & Research Centre \u2014 {report_payload['title']}"
title_text = f"XYZ Hospital \u2014 {report_payload['title']}"
meta_text = (
f"Generated: {format_datetime(utc_now())} IST | "
f"Filters: {_format_filters_echo(report_payload.get('filters_applied', {}))}"
@@ -218,7 +218,7 @@ def _write_styled_sheet(ws, report_payload: dict[str, Any]) -> None:
ws.page_setup.fitToHeight = 0
ws.sheet_properties.pageSetUpPr.fitToPage = True
ws.print_title_rows = f"{header_row}:{header_row}"
ws.oddHeader.left.text = "&BPoona Hospital & Research Centre&B"
ws.oddHeader.left.text = "&BXYZ Hospital&B"
ws.oddHeader.right.text = report_payload.get("title", "Operational Report")
ws.oddFooter.left.text = "Confidential • Biomedical Asset Management System"
ws.oddFooter.right.text = "Page &P of &N"
@@ -315,7 +315,7 @@ def build_csv(report_payload: dict[str, Any]) -> BytesIO:
sio = StringIO()
writer = csv.writer(sio)
writer.writerow([f"Poona Hospital & Research Centre - {report_payload['title']}"])
writer.writerow([f"XYZ Hospital - {report_payload['title']}"])
writer.writerow(
[
f"Generated: {format_datetime(utc_now())} IST",
+2 -2
View File
@@ -262,7 +262,7 @@ SETTINGS_SCHEMA: list[dict[str, Any]] = [
"type": "str",
"default": "",
"label": "SMTP Host",
"description": "Hospital outbound mail server hostname (e.g. smtp.poonahospital.org).",
"description": "Hospital outbound mail server hostname (e.g. smtp.xyzhospital.org).",
"min": None,
"max": None,
"options": None,
@@ -280,7 +280,7 @@ SETTINGS_SCHEMA: list[dict[str, Any]] = [
{
"key": "smtp_from_email",
"type": "str",
"default": "ams-alerts@poonahospital.org",
"default": "ams-alerts@xyzhospital.org",
"label": "SMTP From Email Address",
"description": "Sender email address displayed on alert notifications.",
"min": None,
+2 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Poona Hospital Asset Management System (AMS)
XYZ Hospital Asset Management System (AMS)
Database & Attachments Backup and Disaster Recovery Utility.
Features:
@@ -277,7 +277,7 @@ def run_restore(
def main() -> int:
default_db, default_uploads, default_backups = get_default_paths()
parser = argparse.ArgumentParser(description="Poona Hospital AMS Backup & Recovery Utility")
parser = argparse.ArgumentParser(description="XYZ Hospital AMS Backup & Recovery Utility")
subparsers = parser.add_subparsers(dest="command", help="Command to execute")
# Backup command
+9 -9
View File
@@ -168,8 +168,8 @@ def test_sqlite_migration_adds_cost_columns_to_old_db(tmp_path):
def test_department_user_never_receives_cost_fields(client):
dept_headers = _auth_headers(client, "dept@poona.demo")
admin_headers = _auth_headers(client, "admin@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
# 1. /api/assets
res_assets = client.get("/api/assets?page_size=20", headers=dept_headers)
@@ -217,12 +217,12 @@ def test_department_user_never_receives_cost_fields(client):
def test_repair_cost_and_cost_editing_role_permissions(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
# Find an ICU complaint visible to dept@poona.demo
# Find an ICU complaint visible to dept@xyz.demo
comp = (
db.query(Complaint)
.join(Asset, Complaint.asset_id == Asset.id)
@@ -279,7 +279,7 @@ def test_repair_cost_and_cost_editing_role_permissions(client, db):
def test_new_ai_cost_settings_present_and_validated(client):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
res = client.get("/api/settings", headers=admin_headers)
assert res.status_code == 200
by_key = {item["key"]: item for item in res.json()["items"]}
@@ -389,7 +389,7 @@ def test_seed_data_meets_cost_and_ai_prerequisites(db):
def test_asset_and_contract_bulk_import_cost_columns(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
cat = db.query(Category).first()
vendor = db.query(Vendor).filter(Vendor.is_active.is_(True)).first()
+3 -3
View File
@@ -144,7 +144,7 @@ def test_coverage_priority_and_expiry_boundaries_and_superseded(db):
def test_complaint_coverage_snapshot_persists_after_contract_expires(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
asset = _create_isolated_asset(db, "PHRC-COV-0002")
vendor = db.query(Vendor).filter(Vendor.is_active.is_(True)).first()
today = effective_today(db)
@@ -224,7 +224,7 @@ def test_complaint_coverage_snapshot_persists_after_contract_expires(client, db)
def test_pm_outsourced_auto_fill_and_no_active_contract_warning(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
vendor = db.query(Vendor).filter(Vendor.is_active.is_(True)).first()
today = effective_today(db)
@@ -279,7 +279,7 @@ def test_pm_outsourced_auto_fill_and_no_active_contract_warning(client, db):
def test_department_user_reads_coverage_tag_without_cost_fields(client, db):
dept_headers = _auth_headers(client, "dept@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
icu_asset = db.query(Asset).filter(Asset.department_id == 1).first()
assert icu_asset is not None
+4 -4
View File
@@ -269,8 +269,8 @@ def test_breakdown_frequency_and_efficiency_pure_math_and_zero_division():
def test_db_loader_department_scoping_and_demo_clock(client, db):
admin = db.query(User).filter(User.email == "admin@poona.demo").first()
dept_user = db.query(User).filter(User.email == "dept@poona.demo").first()
admin = db.query(User).filter(User.email == "admin@xyz.demo").first()
dept_user = db.query(User).filter(User.email == "dept@xyz.demo").first()
today = effective_today(db)
ds_all = load_ai_dataset(db, admin, today - timedelta(days=365), today)
@@ -284,7 +284,7 @@ def test_db_loader_department_scoping_and_demo_clock(client, db):
# Unassigned department_user -> 0 assets
unassigned = User(
name="Unassigned Dept",
email="unassigned.ai3@poona.demo",
email="unassigned.ai3@xyz.demo",
password_hash="x",
role="department_user",
department_id=None,
@@ -298,7 +298,7 @@ def test_db_loader_department_scoping_and_demo_clock(client, db):
cmp_now = compute_comparison_from_dataset(ds_all)
assert len(cmp_now["rows"]) == 10
admin_res = client.post("/api/auth/login", json={"email": "admin@poona.demo", "password": "Demo@123"})
admin_res = client.post("/api/auth/login", json={"email": "admin@xyz.demo", "password": "Demo@123"})
headers = {"Authorization": f"Bearer {admin_res.json()['access_token']}"}
try:
future_date = today + timedelta(days=365 * 2)
+1 -1
View File
@@ -278,7 +278,7 @@ def test_rule_s8_fully_depreciated_and_low_efficiency():
def test_seeded_db_produces_expected_suggestions(db, tmp_path):
seed_database(db, upload_dir=tmp_path)
admin = db.query(User).filter(User.email == "admin@poona.demo").first()
admin = db.query(User).filter(User.email == "admin@xyz.demo").first()
today = effective_today(db)
ds = load_ai_dataset(db, admin, today - timedelta(days=365), today)
res = generate_suggestions(ds)
+1 -1
View File
@@ -291,7 +291,7 @@ def test_ai5_cache_hit_invalidation_and_audit_log(db):
def test_ai5_privacy_no_pii_or_free_text_in_prompt(db):
secret_user = "Dr. Rajesh Deshmukh"
secret_email = "rajesh.deshmukh@poonahospital.org"
secret_email = "rajesh.deshmukh@xyzhospital.org"
secret_desc = "Patient monitor alarm speaker cracked during ICU night shift"
secret_remark = "Confidential nurse note about ward staff conflict"
+8 -8
View File
@@ -39,7 +39,7 @@ AI_EXPORT_SECTIONS = [
def test_ai6_role_matrix_department_user_403_and_viewers_200(client):
dept_hdr = _auth_headers(client, "dept@poona.demo")
dept_hdr = _auth_headers(client, "dept@xyz.demo")
# department_user must get 403 on EVERY /api/ai/* route
for url in AI_GET_ENDPOINTS:
@@ -61,9 +61,9 @@ def test_ai6_role_matrix_department_user_403_and_viewers_200(client):
# management, coordinator, biomedical get 200 on all GETs, 403 on regenerate
for email in (
"mgmt@poona.demo",
"coord@poona.demo",
"bio@poona.demo",
"mgmt@xyz.demo",
"coord@xyz.demo",
"bio@xyz.demo",
):
hdr = _auth_headers(client, email)
for url in AI_GET_ENDPOINTS:
@@ -77,7 +77,7 @@ def test_ai6_role_matrix_department_user_403_and_viewers_200(client):
assert r_regen.status_code == 403, f"Expected 403 for {email} on regenerate"
# system_admin gets 200 on all GETs AND 200 on regenerate
admin_hdr = _auth_headers(client, "admin@poona.demo")
admin_hdr = _auth_headers(client, "admin@xyz.demo")
for url in AI_GET_ENDPOINTS:
r = client.get(url, headers=admin_hdr)
assert r.status_code == 200, f"Expected 200 for admin on {url}: {r.text}"
@@ -95,7 +95,7 @@ def test_ai6_role_matrix_department_user_403_and_viewers_200(client):
def test_ai6_scoping_department_category_and_custom_period(client, db):
mgmt_hdr = _auth_headers(client, "mgmt@poona.demo")
mgmt_hdr = _auth_headers(client, "mgmt@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
cat = db.query(Category).first()
assert icu is not None and cat is not None
@@ -131,7 +131,7 @@ def test_ai6_scoping_department_category_and_custom_period(client, db):
def test_ai6_default_none_provider_shapes_and_real_seeded_data(client, monkeypatch):
from app.core.config import settings
monkeypatch.setattr(settings, "AI_PROVIDER", "none")
admin_hdr = _auth_headers(client, "admin@poona.demo")
admin_hdr = _auth_headers(client, "admin@xyz.demo")
status_res = client.get("/api/ai/status", headers=admin_hdr)
assert status_res.status_code == 200
@@ -169,7 +169,7 @@ def test_ai6_default_none_provider_shapes_and_real_seeded_data(client, monkeypat
def test_ai6_exports_xlsx_three_sheets_and_csv(client):
biomed_hdr = _auth_headers(client, "bio@poona.demo")
biomed_hdr = _auth_headers(client, "bio@xyz.demo")
for sec in AI_EXPORT_SECTIONS:
r_xlsx = client.get(f"/api/ai/{sec}/export?format=xlsx&period=12m", headers=biomed_hdr)
+4 -4
View File
@@ -33,10 +33,10 @@ def _make_xlsx_bytes(headers: list[str], rows: list[list[object]]) -> bytes:
def test_import_template_download_and_rbac(client):
bio_headers = _auth_headers(client, "bio@poona.demo")
admin_headers = _auth_headers(client, "admin@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
for email in ("dept@poona.demo", "coord@poona.demo", "mgmt@poona.demo"):
for email in ("dept@xyz.demo", "coord@xyz.demo", "mgmt@xyz.demo"):
h = _auth_headers(client, email)
assert client.get("/api/assets/import-template", headers=h).status_code == 403
assert (
@@ -66,7 +66,7 @@ def test_import_template_download_and_rbac(client):
def test_bulk_import_dry_run_validation_and_commit(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
# Read a valid sample from template so we match real seeded department/location/category
tmpl_res = client.get("/api/assets/import-template", headers=bio_headers)
+7 -7
View File
@@ -59,8 +59,8 @@ def test_alert_state_and_coverage_status():
def test_asset_crud_and_duplicate_code(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
loc = db.query(Location).filter(Location.department_id == icu.id).first()
cat = db.query(Category).first()
@@ -139,7 +139,7 @@ def test_asset_crud_and_duplicate_code(client, db):
def test_department_user_scoping_on_assets(client, db):
dept_headers = _auth_headers(client, "dept@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
ot = db.query(Department).filter(Department.code == "OT").first()
other_asset = db.query(Asset).filter(Asset.department_id == ot.id).first()
@@ -164,7 +164,7 @@ def test_department_user_scoping_on_assets(client, db):
def test_coordinator_field_level_patch_restrictions(client, db):
coord_headers = _auth_headers(client, "coord@poona.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
asset = db.query(Asset).first()
ok_patch = client.patch(
@@ -195,9 +195,9 @@ def test_coordinator_field_level_patch_restrictions(client, db):
def test_attachments_upload_download_delete_and_security(client, db, tmp_path, monkeypatch):
monkeypatch.setattr(settings, "UPLOAD_DIR", str(tmp_path))
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
ot = db.query(Department).filter(Department.code == "OT").first()
+18 -18
View File
@@ -39,30 +39,30 @@ def _auth_headers(client, email: str, password: str = "Demo@123") -> dict[str, s
def test_login_valid_and_invalid(client, db):
res = client.post("/api/auth/login", json={"email": "admin@poona.demo", "password": "Demo@123"})
res = client.post("/api/auth/login", json={"email": "admin@xyz.demo", "password": "Demo@123"})
assert res.status_code == 200
body = res.json()
assert body["token_type"] == "bearer"
assert body["access_token"]
assert body["user"]["email"] == "admin@poona.demo"
assert body["user"]["email"] == "admin@xyz.demo"
assert body["user"]["role"] == "system_admin"
assert body["user"]["demo_as_of_date"] is None
bad_pw = client.post("/api/auth/login", json={"email": "admin@poona.demo", "password": "wrong"})
bad_pw = client.post("/api/auth/login", json={"email": "admin@xyz.demo", "password": "wrong"})
assert bad_pw.status_code == 401
bad_email = client.post("/api/auth/login", json={"email": "nobody@poona.demo", "password": "Demo@123"})
bad_email = client.post("/api/auth/login", json={"email": "nobody@xyz.demo", "password": "Demo@123"})
assert bad_email.status_code == 401
# Inactive user rejected
user = db.query(User).filter(User.email == "neha.chavan@poona.demo").first()
user = db.query(User).filter(User.email == "neha.chavan@xyz.demo").first()
assert user is not None
user.is_active = False
db.commit()
try:
res_inactive = client.post(
"/api/auth/login",
json={"email": "neha.chavan@poona.demo", "password": "Demo@123"},
json={"email": "neha.chavan@xyz.demo", "password": "Demo@123"},
)
assert res_inactive.status_code in (401, 403)
finally:
@@ -77,11 +77,11 @@ def test_auth_me(client):
bad_tok = client.get("/api/auth/me", headers={"Authorization": "Bearer invalid.token.here"})
assert bad_tok.status_code == 401
headers = _auth_headers(client, "dept@poona.demo")
headers = _auth_headers(client, "dept@xyz.demo")
me = client.get("/api/auth/me", headers=headers)
assert me.status_code == 200
data = me.json()
assert data["email"] == "dept@poona.demo"
assert data["email"] == "dept@xyz.demo"
assert data["role"] == "department_user"
assert data["department_name"] == "Intensive Care Unit"
@@ -89,16 +89,16 @@ def test_auth_me(client):
@pytest.mark.parametrize(
"email",
[
"bio@poona.demo",
"dept@poona.demo",
"mgmt@poona.demo",
"coord@poona.demo",
"bio@xyz.demo",
"dept@xyz.demo",
"mgmt@xyz.demo",
"coord@xyz.demo",
],
)
def test_non_admin_forbidden_on_admin_endpoints(client, db, email):
headers = _auth_headers(client, email)
dept = db.query(Department).first()
target_user = db.query(User).filter(User.email == "dept@poona.demo").first()
target_user = db.query(User).filter(User.email == "dept@xyz.demo").first()
# Masters GET is allowed for authenticated users
assert client.get("/api/departments", headers=headers).status_code == 200
@@ -134,7 +134,7 @@ def test_non_admin_forbidden_on_admin_endpoints(client, db, email):
headers=headers,
json={
"name": "Hack",
"email": "hack@poona.demo",
"email": "hack@xyz.demo",
"password": "Password1",
"role": "biomedical",
},
@@ -172,7 +172,7 @@ def test_non_admin_forbidden_on_admin_endpoints(client, db, email):
def test_admin_masters_and_users_crud(client):
headers = _auth_headers(client, "admin@poona.demo")
headers = _auth_headers(client, "admin@xyz.demo")
# Department create, patch, soft-delete
r = client.post(
@@ -201,7 +201,7 @@ def test_admin_masters_and_users_crud(client):
headers=headers,
json={
"name": "Temp Staff",
"email": "temp.staff@poona.demo",
"email": "temp.staff@xyz.demo",
"password": "InitPassword1",
"role": "biomedical",
},
@@ -218,7 +218,7 @@ def test_admin_masters_and_users_crud(client):
assert u_patch.status_code == 200
login_new = client.post(
"/api/auth/login",
json={"email": "temp.staff@poona.demo", "password": "NewPassword2"},
json={"email": "temp.staff@xyz.demo", "password": "NewPassword2"},
)
assert login_new.status_code == 200
@@ -280,7 +280,7 @@ def test_permissions_matrix_all_roles():
def test_settings_validation_and_demo_date(client, db):
headers = _auth_headers(client, "admin@poona.demo")
headers = _auth_headers(client, "admin@xyz.demo")
res = client.get("/api/settings", headers=headers)
assert res.status_code == 200
+3 -3
View File
@@ -32,7 +32,7 @@ def _make_xlsx_bytes(sheet_name: str, headers: list[str], rows: list[list[object
def test_contracts_bulk_import_lifecycle(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
asset = db.query(Asset).filter(Asset.asset_code.isnot(None)).first()
vendor = db.query(Vendor).filter(Vendor.is_active.is_(True)).first()
@@ -119,7 +119,7 @@ def test_contracts_bulk_import_lifecycle(client, db):
def test_calibration_bulk_import_lifecycle(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
# Find asset without calibration plan
existing_plan_ids = [p.asset_id for p in db.query(CalibrationPlan.asset_id).all()]
@@ -179,7 +179,7 @@ def test_calibration_bulk_import_lifecycle(client, db):
def test_insurance_bulk_import_lifecycle(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
asset = db.query(Asset).filter(Asset.asset_code.isnot(None)).first()
vendor = db.query(Vendor).filter(Vendor.is_active.is_(True)).first()
+14 -14
View File
@@ -85,11 +85,11 @@ def test_clip_downtime_to_month_across_boundary():
def test_complaint_field_level_permissions(client, db):
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
admin_headers = _auth_headers(client, "admin@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
ot = db.query(Department).filter(Department.code == "OT").first()
@@ -181,16 +181,16 @@ def test_complaint_field_level_permissions(client, db):
def test_full_complaint_workflow_and_asset_status_sync(client, db):
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
admin_headers = _auth_headers(client, "admin@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
asset = db.query(Asset).filter(Asset.department_id == icu.id, Asset.status == "in_service").first()
assert asset is not None
bio1 = db.query(User).filter(User.email == "bio@poona.demo").first()
bio2 = db.query(User).filter(User.email == "vikram.shinde@poona.demo").first()
bio1 = db.query(User).filter(User.email == "bio@xyz.demo").first()
bio2 = db.query(User).filter(User.email == "vikram.shinde@xyz.demo").first()
# 1. Dept user raises critical complaint -> asset becomes under_repair
create_res = client.post(
@@ -339,8 +339,8 @@ def test_require_closure_remarks_and_wired_settings(client, db):
from datetime import date
from app.services.calculations import compute_sla_status
admin_headers = _auth_headers(client, "admin@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
asset = db.query(Asset).first()
assert asset is not None
@@ -419,7 +419,7 @@ def test_require_closure_remarks_and_wired_settings(client, db):
def test_close_without_restore_sets_restored_at_and_reopen_recloses(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
asset = db.query(Asset).first()
assert asset is not None
@@ -479,7 +479,7 @@ def test_sla_breach_alert_emitted_and_suppressed_when_restored(client, db):
from app.models import Notification
from app.services.alerts import run_alert_check
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
asset = db.query(Asset).first()
assert asset is not None
+7 -7
View File
@@ -21,7 +21,7 @@ def _auth_headers(client, email: str) -> dict[str, str]:
def test_pm_record_attachment_upload_and_download(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
pm_rec = db.query(PMRecord).first()
assert pm_rec is not None
@@ -52,7 +52,7 @@ def test_pm_record_attachment_upload_and_download(client, db):
def test_complaint_assigned_team_and_location_filter(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
asset = db.query(Asset).filter(Asset.location_id.isnot(None)).first()
assert asset is not None
@@ -92,7 +92,7 @@ def test_complaint_assigned_team_and_location_filter(client, db):
def test_demo_equipment_serial_no(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept = db.query(Department).first()
vendor = db.query(Vendor).first()
today = effective_today(db)
@@ -126,8 +126,8 @@ def test_demo_equipment_serial_no(client, db):
def test_department_visit_new_requirements_and_monthly_report(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
dept = db.query(Department).first()
today = effective_today(db)
@@ -161,7 +161,7 @@ def test_department_visit_new_requirements_and_monthly_report(client, db):
def test_asset_calibration_and_insurance_filters(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
# Filter calibration applicable
res_cal_yes = client.get("/api/assets?requires_calibration=true", headers=bio_headers)
@@ -182,7 +182,7 @@ def test_asset_calibration_and_insurance_filters(client, db):
def test_bulk_import_templates_endpoints(client):
coord_headers = _auth_headers(client, "coord@poona.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
# Contracts template
r_c = client.get("/api/contracts/import-template", headers=coord_headers)
+1 -1
View File
@@ -3,5 +3,5 @@ def test_health_check(client):
assert response.status_code == 200
data = response.json()
assert data["status"] == "ok"
assert data["service"] == "Poona Hospital AMS"
assert data["service"] == "XYZ Hospital AMS"
assert data["version"] == "0.1.0"
@@ -33,11 +33,11 @@ def test_alert_check_dedupe_and_seed_notifications(db):
def test_demo_clock_alert_run_and_admin_only_permission(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
# Non-admins get 403 on POST /api/alerts/run
for h in (bio_headers, dept_headers, mgmt_headers, coord_headers):
@@ -74,9 +74,9 @@ def test_demo_clock_alert_run_and_admin_only_permission(client, db):
def test_per_user_read_state_and_department_scoping(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
admin_list_before = client.get("/api/notifications?limit=100", headers=admin_headers).json()
bio_list_before = client.get("/api/notifications?limit=100", headers=bio_headers).json()
@@ -118,8 +118,8 @@ def test_per_user_read_state_and_department_scoping(client, db):
def test_dashboard_summary_role_scoping_and_charts(client, db):
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
icu_asset_count = db.query(Asset).filter(Asset.department_id == icu.id).count()
+13 -13
View File
@@ -28,9 +28,9 @@ def _make_png_bytes() -> bytes:
def test_contract_create_renew_supersede_history_and_scoping(client, db):
coord_headers = _auth_headers(client, "coord@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
ot = db.query(Department).filter(Department.code == "OT").first()
@@ -136,9 +136,9 @@ def test_contract_create_renew_supersede_history_and_scoping(client, db):
def test_warranty_and_insurance_expiry_and_permissions(client, db):
coord_headers = _auth_headers(client, "coord@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
icu_asset = db.query(Asset).filter(Asset.department_id == icu.id).first()
@@ -228,9 +228,9 @@ def test_warranty_and_insurance_expiry_and_permissions(client, db):
def test_demo_equipment_overdue_detection_and_return(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
icu_loc = db.query(Location).filter(Location.department_id == icu.id).first()
@@ -301,10 +301,10 @@ def test_demo_equipment_overdue_detection_and_return(client, db):
def test_department_visits_permissions_and_multi_linking(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
icu = db.query(Department).filter(Department.code == "ICU").first()
icu_assets = db.query(Asset).filter(Asset.department_id == icu.id).limit(2).all()
+9 -9
View File
@@ -19,10 +19,10 @@ def _auth_headers(client, email: str) -> dict[str, str]:
def test_global_search_grouped_and_department_scoped(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
dept_user = db.query(User).filter(User.email == "dept@poona.demo").first()
dept_user = db.query(User).filter(User.email == "dept@xyz.demo").first()
icu_dept = db.query(Department).filter(Department.id == dept_user.department_id).first()
assert dept_user is not None and icu_dept is not None
@@ -69,13 +69,13 @@ def test_global_search_grouped_and_department_scoped(client, db):
def test_audit_logs_rbac_and_filters(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
for email in ("bio@poona.demo", "mgmt@poona.demo", "dept@poona.demo", "coord@poona.demo"):
admin_headers = _auth_headers(client, "admin@xyz.demo")
for email in ("bio@xyz.demo", "mgmt@xyz.demo", "dept@xyz.demo", "coord@xyz.demo"):
headers = _auth_headers(client, email)
assert client.get("/api/audit-logs", headers=headers).status_code == 403
# Ensure there is at least one distinct AuditLog entry via API/DB
admin_user = db.query(User).filter(User.email == "admin@poona.demo").first()
admin_user = db.query(User).filter(User.email == "admin@xyz.demo").first()
assert admin_user is not None
log_entry = AuditLog(
entity_type="asset",
@@ -110,14 +110,14 @@ def test_login_rate_limiter_429_and_reset(client):
for i in range(MAX_LOGIN_ATTEMPTS):
res = client.post(
"/api/auth/login",
json={"email": "ratelimit@poona.demo", "password": "WrongPassword"},
json={"email": "ratelimit@xyz.demo", "password": "WrongPassword"},
)
assert res.status_code == 401, f"Attempt {i + 1} unexpected status {res.status_code}"
# Attempt 16 triggers 429 RATE_LIMITED
blocked = client.post(
"/api/auth/login",
json={"email": "ratelimit@poona.demo", "password": "WrongPassword"},
json={"email": "ratelimit@xyz.demo", "password": "WrongPassword"},
)
assert blocked.status_code == 429
assert blocked.json()["code"] == "RATE_LIMITED"
@@ -126,7 +126,7 @@ def test_login_rate_limiter_429_and_reset(client):
reset_login_rate_limiter()
ok = client.post(
"/api/auth/login",
json={"email": "admin@poona.demo", "password": "Demo@123"},
json={"email": "admin@xyz.demo", "password": "Demo@123"},
)
assert ok.status_code == 200
+8 -8
View File
@@ -76,9 +76,9 @@ def test_add_months_clamping_and_db_note_n2(db):
def test_outsourced_pm_lifecycle_complete_and_reschedule(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
provider = db.query(Vendor).filter(Vendor.vendor_type == "service_provider").first()
contract = db.query(Contract).filter(Contract.is_superseded.is_(False)).first()
@@ -200,9 +200,9 @@ def test_outsourced_pm_lifecycle_complete_and_reschedule(client, db):
def test_calibration_plan_approval_permissions_and_completion(client, db):
bio_headers = _auth_headers(client, "bio@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
dept_headers = _auth_headers(client, "dept@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
a1 = _create_test_asset(client, bio_headers, db, "001", req_cal=False)
a2 = _create_test_asset(client, bio_headers, db, "002", req_cal=False)
@@ -328,8 +328,8 @@ def test_calibration_plan_approval_permissions_and_completion(client, db):
def test_demo_clock_transitions_statuses_dynamically_on_read(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
asset_id = _create_test_asset(client, bio_headers, db, "CLK", req_cal=True)
agency = db.query(Vendor).filter(Vendor.vendor_type == "calibration_agency").first()
+12 -12
View File
@@ -36,8 +36,8 @@ def _auth_headers(client, email: str) -> dict[str, str]:
def test_all_eight_reports_accessible_for_management_and_admin(client):
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
admin_headers = _auth_headers(client, "admin@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
for headers in (mgmt_headers, admin_headers):
for key in ALL_REPORT_KEYS:
@@ -56,9 +56,9 @@ def test_all_eight_reports_accessible_for_management_and_admin(client):
def test_daily_visit_rbac_and_department_user_scoping(client, db):
dept_headers = _auth_headers(client, "dept@poona.demo")
coord_headers = _auth_headers(client, "coord@poona.demo")
bio_headers = _auth_headers(client, "bio@poona.demo")
dept_headers = _auth_headers(client, "dept@xyz.demo")
coord_headers = _auth_headers(client, "coord@xyz.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
# daily-visit is forbidden for department_user and coordinator (JSON + export)
for headers in (dept_headers, coord_headers):
@@ -69,7 +69,7 @@ def test_daily_visit_rbac_and_department_user_scoping(client, db):
assert client.get("/api/reports/daily-visit", headers=bio_headers).status_code == 200
# Department user attempting to pass another department_id is still scoped to own department
dept_user = db.query(User).filter(User.email == "dept@poona.demo").first()
dept_user = db.query(User).filter(User.email == "dept@xyz.demo").first()
other_dept = db.query(Department).filter(Department.id != dept_user.department_id).first()
assert dept_user is not None and dept_user.department_id is not None
assert other_dept is not None
@@ -93,8 +93,8 @@ def test_daily_visit_rbac_and_department_user_scoping(client, db):
def test_monthly_maintenance_three_complaint_reconciliation(client, db):
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_user = db.query(User).filter(User.email == "admin@poona.demo").first()
admin_headers = _auth_headers(client, "admin@xyz.demo")
admin_user = db.query(User).filter(User.email == "admin@xyz.demo").first()
category = db.query(Category).first()
location = db.query(Location).first()
assert admin_user is not None and category is not None and location is not None
@@ -198,7 +198,7 @@ def test_monthly_maintenance_three_complaint_reconciliation(client, db):
def test_report_exports_xlsx_and_csv(client):
mgmt_headers = _auth_headers(client, "mgmt@poona.demo")
mgmt_headers = _auth_headers(client, "mgmt@xyz.demo")
# Excel export
xlsx_res = client.get(
@@ -211,7 +211,7 @@ def test_report_exports_xlsx_and_csv(client):
wb = openpyxl.load_workbook(BytesIO(xlsx_res.content))
ws = wb.active
assert "Poona Hospital" in str(ws["A1"].value)
assert "XYZ Hospital" in str(ws["A1"].value)
assert "Generated:" in str(ws["A2"].value)
assert "Filters:" in str(ws["A2"].value)
assert "Total Downtime Minutes: 525" in str(ws["A3"].value)
@@ -233,7 +233,7 @@ def test_report_exports_xlsx_and_csv(client):
decoded = csv_res.content.decode("utf-8-sig")
parsed = list(csv.reader(StringIO(decoded)))
assert len(parsed) >= 5
assert "Poona Hospital" in parsed[0][0]
assert "XYZ Hospital" in parsed[0][0]
assert parsed[4][0] == "Complaint No"
# Unsupported export format rejected
@@ -246,7 +246,7 @@ def test_report_exports_xlsx_and_csv(client):
def test_all_eight_reports_export_xlsx_and_csv(client):
"""Verify that all 8 reports export cleanly as both XLSX and CSV without title/slash errors."""
admin_headers = _auth_headers(client, "admin@poona.demo")
admin_headers = _auth_headers(client, "admin@xyz.demo")
for key in ALL_REPORT_KEYS:
# Test XLSX export
+1 -1
View File
@@ -14,7 +14,7 @@ def seeded_task1_db(db, tmp_path_factory):
return upload_dir
def _auth_headers(client, email: str = "admin@poona.demo") -> dict[str, str]:
def _auth_headers(client, email: str = "admin@xyz.demo") -> dict[str, str]:
res = client.post("/api/auth/login", json={"email": email, "password": "Demo@123"})
assert res.status_code == 200, res.text
return {"Authorization": f"Bearer {res.json()['access_token']}"}
+1 -1
View File
@@ -12,7 +12,7 @@ def seeded_task2_db(db, tmp_path_factory):
return upload_dir
def _auth_headers(client, email: str = "admin@poona.demo") -> dict[str, str]:
def _auth_headers(client, email: str = "admin@xyz.demo") -> dict[str, str]:
res = client.post("/api/auth/login", json={"email": email, "password": "Demo@123"})
assert res.status_code == 200, res.text
return {"Authorization": f"Bearer {res.json()['access_token']}"}
+10 -10
View File
@@ -12,7 +12,7 @@ def seeded_task4_db(db, tmp_path_factory):
return upload_dir
def _auth_headers(client, email: str = "admin@poona.demo") -> dict[str, str]:
def _auth_headers(client, email: str = "admin@xyz.demo") -> dict[str, str]:
res = client.post("/api/auth/login", json={"email": email, "password": "Demo@123"})
assert res.status_code == 200, res.text
return {"Authorization": f"Bearer {res.json()['access_token']}"}
@@ -50,20 +50,20 @@ def test_validate_password_unit():
assert "easily guessable" in str(exc5.value) or "at least 8" in str(exc5.value) or "at least one" in str(exc5.value)
# 6. Demo password MUST be allowed
validate_password("demo@123", email="admin@poona.demo")
validate_password("Demo@123", email="admin@poona.demo")
validate_password("demo@123", email="admin@xyz.demo")
validate_password("Demo@123", email="admin@xyz.demo")
# 7. Contains email local part (>= 4 chars)
with pytest.raises(Exception) as exc7:
validate_password("Secureadmin123", email="admin@poona.demo")
validate_password("Secureadmin123", email="admin@xyz.demo")
assert "username" in str(exc7.value).lower()
# Short local part (< 4 chars) does NOT trigger username check
validate_password("Securebio123", email="bio@poona.demo")
validate_password("Securebio123", email="bio@xyz.demo")
def test_api_create_user_password_validation(client, db):
headers = _auth_headers(client, "admin@poona.demo")
headers = _auth_headers(client, "admin@xyz.demo")
# Rejected: no digit
res_bad = client.post(
@@ -71,7 +71,7 @@ def test_api_create_user_password_validation(client, db):
headers=headers,
json={
"name": "Test User",
"email": "test_pw_rule@poona.demo",
"email": "test_pw_rule@xyz.demo",
"password": "NoDigitsPassword",
"role": "biomedical",
},
@@ -85,7 +85,7 @@ def test_api_create_user_password_validation(client, db):
headers=headers,
json={
"name": "Test User 2",
"email": "tester123@poona.demo",
"email": "tester123@xyz.demo",
"password": "tester123Password1",
"role": "biomedical",
},
@@ -99,7 +99,7 @@ def test_api_create_user_password_validation(client, db):
headers=headers,
json={
"name": "Test User 3",
"email": "validuser@poona.demo",
"email": "validuser@xyz.demo",
"password": "ValidPassword123",
"role": "biomedical",
},
@@ -127,7 +127,7 @@ def test_api_create_user_password_validation(client, db):
def test_api_change_password_validation(client, db):
# Log in as bio user
bio_headers = _auth_headers(client, "bio@poona.demo")
bio_headers = _auth_headers(client, "bio@xyz.demo")
# Reject new == current
res_same = client.post(
+2 -2
View File
@@ -37,7 +37,7 @@ def test_resolve_department_scope_rules():
def test_unassigned_department_user_sees_zero_records(client, db):
# Create a department_user with department_id = None
email = "unassigned_dept_user@poona.demo"
email = "unassigned_dept_user@xyz.demo"
user = db.query(User).filter(User.email == email).first()
if not user:
user = User(
@@ -102,7 +102,7 @@ def test_assigned_department_user_scoping_ignores_query_param(client, db):
assert len(depts) >= 2
dept1, dept2 = depts[0], depts[1]
email = "dept1_scoped_user@poona.demo"
email = "dept1_scoped_user@xyz.demo"
user = db.query(User).filter(User.email == email).first()
if not user:
user = User(
+2 -2
View File
@@ -12,7 +12,7 @@ def seeded_task7_db(db, tmp_path_factory):
def test_token_invalidation_on_change_password_and_admin_reset(client, db):
# 1. Login as user and save the initial token
user_email = "bio@poona.demo"
user_email = "bio@xyz.demo"
login_res = client.post(
"/api/auth/login",
json={"email": user_email, "password": "Demo@123"},
@@ -59,7 +59,7 @@ def test_token_invalidation_on_change_password_and_admin_reset(client, db):
# 5. Login as admin, reset that user's password
admin_login = client.post(
"/api/auth/login",
json={"email": "admin@poona.demo", "password": "Demo@123"},
json={"email": "admin@xyz.demo", "password": "Demo@123"},
)
assert admin_login.status_code == 200
admin_token = admin_login.json()["access_token"]
+1 -1
View File
@@ -5,7 +5,7 @@ from pathlib import Path
def test_package_target_creates_clean_delivery_zip(tmp_path):
repo_root = Path(__file__).resolve().parent.parent.parent
zip_path = tmp_path / "poona-ams-delivery.zip"
zip_path = tmp_path / "xyz-ams-delivery.zip"
# Run git archive command (matching Makefile package target)
cmd = ["git", "archive", "--format=zip", f"--output={zip_path}", "HEAD"]
+2 -2
View File
@@ -1,7 +1,7 @@
services:
backend:
build: ./backend
container_name: poona-ams-backend
container_name: xyz-ams-backend
ports:
- "8000:8000"
environment:
@@ -23,7 +23,7 @@ services:
frontend:
build: ./frontend
container_name: poona-ams-frontend
container_name: xyz-ams-frontend
ports:
- "5173:80"
depends_on:
+14 -14
View File
@@ -1,6 +1,6 @@
# Poona Hospital AMS — Acceptance Checklist & UAT Sign-Off Matrix (Proposal §10)
# XYZ Hospital AMS — Acceptance Checklist & UAT Sign-Off Matrix (Proposal §10)
This matrix maps the requirements defined in Section 10 ("Acceptance Criteria") of the Poona Hospital Asset Management System Proposal (Draft 1.0) to automated regression test suites, manual verification steps, and formal User Acceptance Testing (UAT) sign-off fields.
This matrix maps the requirements defined in Section 10 ("Acceptance Criteria") of the XYZ Hospital Asset Management System Proposal (Draft 1.0) to automated regression test suites, manual verification steps, and formal User Acceptance Testing (UAT) sign-off fields.
---
@@ -8,29 +8,29 @@ This matrix maps the requirements defined in Section 10 ("Acceptance Criteria")
| # | Acceptance Criterion | Automated Test Coverage | Manual Verification Steps | UAT Status | Verified Date | Sign-Off / Approver |
|:---:|---|---|---|:---:|:---:|---|
| **1** | **Auth, 5-Role RBAC, Masters & Settings** (`system_admin`, `biomedical`, `department_user`, `management`, `coordinator`, JWT auth, login rate limiting, configurable settings, audit logs) | `backend/tests/test_auth_and_permissions.py`<br>`backend/tests/test_phase8_polish.py`<br>`frontend/src/test/login.test.tsx`<br>`frontend/src/test/permissions.test.ts`<br>`frontend/src/test/smoke.test.tsx` | Log in with all 5 demo accounts (`Demo@123`), confirm role-filtered sidebar items, test `/masters` & `/settings` CRUD as `admin@poona.demo`, confirm `/audit-logs` returns `403` for non-admins, and trigger >15 rapid failed logins to observe `429`. | `[Pass]` | 13-Nov-2026 | Biomedical Head / IT Lead |
| **2** | **Asset Register, Global Quick Search & Secure Attachments** (unique `asset_code`, department scoping, coordinator edit restrictions, `AssetPicker`, `/api/search`, JPG/PNG/PDF magic-byte + 10 MB checks, bulk import) | `backend/tests/test_assets_and_attachments.py`<br>`backend/tests/test_asset_bulk_import.py`<br>`backend/tests/test_phase8_polish.py`<br>`frontend/src/test/asset-picker.test.tsx`<br>`frontend/src/test/bulk-import.test.tsx` | Create/edit an asset on `/assets`, confirm duplicate code returns `409`, verify `dept@poona.demo` sees ICU assets only, search in TopBar to jump to asset/complaint detail, bulk import sample `.xlsx`, and upload attachments. | `[Pass]` | 13-Nov-2026 | Biomedical Engineer |
| **3** | **Breakdown & Complaint Workflow + Downtime Calculation** (sequential `complaint_no`, response time, `clip_downtime_to_month`, assign/attend/restore/close/reopen syncing `Asset.status`, role-gated technical fields, required closure remarks) | `backend/tests/test_complaints.py`<br>`backend/tests/test_time_utils.py`<br>`frontend/src/test/complaint-detail.test.tsx` | Raise a complaint via `AssetPicker`, verify `dept@poona.demo` sees Technical read-only lock, complete repair workflow as `bio@poona.demo`, verify `Asset.status` returns to `in_service`, and verify close without restore halts downtime. | `[Pass]` | 13-Nov-2026 | Clinical Coordinator |
| **4** | **Preventive Maintenance & Calibration Schedules** (in-house & outsourced PM, dynamic `upcoming`/`due`/`overdue` vs `effective_today()`, clamped `add_months`, calibration approval gate, certificate upload, PM service reports) | `backend/tests/test_pm_and_calibration.py`<br>`frontend/src/test/pm-page.test.tsx`<br>`frontend/src/test/calibration-page.test.tsx` | Toggle Table and Calendar views on `/pm`, complete & reschedule cycles, verify `bio@poona.demo` receives `403` on calibration approval while `mgmt@poona.demo` can approve, and upload calibration & PM reports. | `[Pass]` | 13-Nov-2026 | Biomedical Head |
| **1** | **Auth, 5-Role RBAC, Masters & Settings** (`system_admin`, `biomedical`, `department_user`, `management`, `coordinator`, JWT auth, login rate limiting, configurable settings, audit logs) | `backend/tests/test_auth_and_permissions.py`<br>`backend/tests/test_phase8_polish.py`<br>`frontend/src/test/login.test.tsx`<br>`frontend/src/test/permissions.test.ts`<br>`frontend/src/test/smoke.test.tsx` | Log in with all 5 demo accounts (`Demo@123`), confirm role-filtered sidebar items, test `/masters` & `/settings` CRUD as `admin@xyz.demo`, confirm `/audit-logs` returns `403` for non-admins, and trigger >15 rapid failed logins to observe `429`. | `[Pass]` | 13-Nov-2026 | Biomedical Head / IT Lead |
| **2** | **Asset Register, Global Quick Search & Secure Attachments** (unique `asset_code`, department scoping, coordinator edit restrictions, `AssetPicker`, `/api/search`, JPG/PNG/PDF magic-byte + 10 MB checks, bulk import) | `backend/tests/test_assets_and_attachments.py`<br>`backend/tests/test_asset_bulk_import.py`<br>`backend/tests/test_phase8_polish.py`<br>`frontend/src/test/asset-picker.test.tsx`<br>`frontend/src/test/bulk-import.test.tsx` | Create/edit an asset on `/assets`, confirm duplicate code returns `409`, verify `dept@xyz.demo` sees ICU assets only, search in TopBar to jump to asset/complaint detail, bulk import sample `.xlsx`, and upload attachments. | `[Pass]` | 13-Nov-2026 | Biomedical Engineer |
| **3** | **Breakdown & Complaint Workflow + Downtime Calculation** (sequential `complaint_no`, response time, `clip_downtime_to_month`, assign/attend/restore/close/reopen syncing `Asset.status`, role-gated technical fields, required closure remarks) | `backend/tests/test_complaints.py`<br>`backend/tests/test_time_utils.py`<br>`frontend/src/test/complaint-detail.test.tsx` | Raise a complaint via `AssetPicker`, verify `dept@xyz.demo` sees Technical read-only lock, complete repair workflow as `bio@xyz.demo`, verify `Asset.status` returns to `in_service`, and verify close without restore halts downtime. | `[Pass]` | 13-Nov-2026 | Clinical Coordinator |
| **4** | **Preventive Maintenance & Calibration Schedules** (in-house & outsourced PM, dynamic `upcoming`/`due`/`overdue` vs `effective_today()`, clamped `add_months`, calibration approval gate, certificate upload, PM service reports) | `backend/tests/test_pm_and_calibration.py`<br>`frontend/src/test/pm-page.test.tsx`<br>`frontend/src/test/calibration-page.test.tsx` | Toggle Table and Calendar views on `/pm`, complete & reschedule cycles, verify `bio@xyz.demo` receives `403` on calibration approval while `mgmt@xyz.demo` can approve, and upload calibration & PM reports. | `[Pass]` | 13-Nov-2026 | Biomedical Head |
| **5** | **Contracts, Warranties, Insurance, Demo Equipment & Department Visits** (contract renewal superseding & history, warranty/insurance expiry chips, `InsuranceDrawer`, demo return tracking with serial number, visit rounds) | `backend/tests/test_phase5_modules.py`<br>`frontend/src/test/phase5-modules.test.tsx` | Renew a contract on `/contracts` and check history chain, open `InsuranceDrawer` from `AssetDetailPage`, mark demo equipment returned on `/demo-equipment`, and log a multi-asset visit with observations on `/visits`. | `[Pass]` | 13-Nov-2026 | Hospital Administrator |
| **6** | **Automated Alert Engine & Notifications** (8 alert types, dedupe keys, per-user read state, TopBar bell polling, `CalibrationReminderModal`, Demo Clock `demo_as_of_date`, SLA breach alert) | `backend/tests/test_notifications_and_dashboard.py`<br>`frontend/src/test/phase6-modules.test.tsx` | Advance TopBar Demo Clock (+20 days) as `admin@poona.demo`, run alert check in `/settings`, confirm new notifications appear without duplicates on second run, mark read per user, and check login reminder pop-up. | `[Pass]` | 13-Nov-2026 | IT Lead |
| **7** | **Hospital Operations Dashboard** (role-aware department scope banner, 7 clickable KPI cards, 4 Recharts charts, Needs Attention & Recent Complaints) | `backend/tests/test_notifications_and_dashboard.py`<br>`frontend/src/test/phase6-modules.test.tsx` | Compare `/` as `mgmt@poona.demo` (hospital-wide) vs `dept@poona.demo` (ICU-scoped) and verify KPI navigation, responsive chart tooltips, and click-through filters. | `[Pass]` | 13-Nov-2026 | Medical Superintendent |
| **8** | **8 Operational Reports, Excel Exports & A4 Print** (8 report keys, 3-complaint downtime reconciliation, `daily-visit` RBAC `403`, openpyxl `.xlsx` & SheetJS export, `@media print`) | `backend/tests/test_reports.py`<br>`frontend/src/test/reports.test.tsx` | Open `/reports`, verify `daily-visit` is hidden/`403` for `dept@poona.demo`, inspect Monthly Maintenance `"How this is calculated"` formula popover, download `.xlsx` spreadsheets, and open Print Preview. | `[Pass]` | 13-Nov-2026 | Finance / Operations Head |
| **6** | **Automated Alert Engine & Notifications** (8 alert types, dedupe keys, per-user read state, TopBar bell polling, `CalibrationReminderModal`, Demo Clock `demo_as_of_date`, SLA breach alert) | `backend/tests/test_notifications_and_dashboard.py`<br>`frontend/src/test/phase6-modules.test.tsx` | Advance TopBar Demo Clock (+20 days) as `admin@xyz.demo`, run alert check in `/settings`, confirm new notifications appear without duplicates on second run, mark read per user, and check login reminder pop-up. | `[Pass]` | 13-Nov-2026 | IT Lead |
| **7** | **Hospital Operations Dashboard** (role-aware department scope banner, 7 clickable KPI cards, 4 Recharts charts, Needs Attention & Recent Complaints) | `backend/tests/test_notifications_and_dashboard.py`<br>`frontend/src/test/phase6-modules.test.tsx` | Compare `/` as `mgmt@xyz.demo` (hospital-wide) vs `dept@xyz.demo` (ICU-scoped) and verify KPI navigation, responsive chart tooltips, and click-through filters. | `[Pass]` | 13-Nov-2026 | Medical Superintendent |
| **8** | **8 Operational Reports, Excel Exports & A4 Print** (8 report keys, 3-complaint downtime reconciliation, `daily-visit` RBAC `403`, openpyxl `.xlsx` & SheetJS export, `@media print`) | `backend/tests/test_reports.py`<br>`frontend/src/test/reports.test.tsx` | Open `/reports`, verify `daily-visit` is hidden/`403` for `dept@xyz.demo`, inspect Monthly Maintenance `"How this is calculated"` formula popover, download `.xlsx` spreadsheets, and open Print Preview. | `[Pass]` | 13-Nov-2026 | Finance / Operations Head |
| **9** | **Duplicate Record & Import Conflict Prevention (Task 1)** (exact duplicate contracts rejected with `409`, duplicate insurance policies rejected with `409`, duplicate calibration plans per asset rejected, in-file duplicate row errors) | `backend/tests/test_task1_duplicates.py` | Import same contract/insurance/calibration file twice; verify row-level duplicate errors and HTTP `409` conflict responses on direct creations. | `[Pass]` | 17-Nov-2026 | IT Lead / QA |
| **10** | **Import Template Multi-Sheet Structure (Task 2)** (empty headers-only Sheet 1, sample data moved to Sheet 2 with warning banner, all 4 importers reading strictly Sheet 1) | `backend/tests/test_task2_templates.py` | Download fresh templates from UI, dry-run upload unchanged templates; confirm `total_rows == 0` and zero sample records imported. | `[Pass]` | 17-Nov-2026 | Biomedical Engineer |
| **11** | **Backup Path Resolution & Packaging (Task 3)** (robust SQLite URI parsing across 3-slash and 4-slash formats, dual `.tar.gz` and `.zip` archive support with `ams.db` and `db.sqlite3` aliases) | `backend/tests/test_backup_paths.py` | Run `python scripts/backup.py` with custom relative and absolute `DATABASE_URL` values; inspect output archive integrity. | `[Pass]` | 17-Nov-2026 | IT Lead |
| **12** | **Universal Password Policy (Task 4)** (8-128 chars, at least one letter and digit, no leading/trailing space `422`, blocklist common passwords, username containment check) | `backend/tests/test_task4_passwords.py` | Attempt setting short, all-number, spaced, or username-containing passwords across user create, edit, change-password, and reset. | `[Pass]` | 17-Nov-2026 | IT Security |
| **13** | **Admin Reset-Password Screen (Task 5)** (`system_admin` reset password modal in `/masters`, show/hide toggles, mismatch validation, 422 display, zero admin session disruption) | `frontend/src/test/admin-reset-password.test.tsx` | Log in as `admin@poona.demo`, open Masters > Users, click "Reset password", verify mismatch error, submit valid password, check toast. | `[Pass]` | 17-Nov-2026 | System Administrator |
| **13** | **Admin Reset-Password Screen (Task 5)** (`system_admin` reset password modal in `/masters`, show/hide toggles, mismatch validation, 422 display, zero admin session disruption) | `frontend/src/test/admin-reset-password.test.tsx` | Log in as `admin@xyz.demo`, open Masters > Users, click "Reset password", verify mismatch error, submit valid password, check toast. | `[Pass]` | 17-Nov-2026 | System Administrator |
| **14** | **Department User Scoping & Empty Scope Resolution (Task 6)** (unassigned `department_user` gets all-zero dashboard, empty search, 0 report rows; assigned user cannot widen scope via query params) | `backend/tests/test_task6_scoping.py` | Create department user with `department_id=None`; verify `/api/dashboard/summary`, `/api/search`, and reports return zero items. | `[Pass]` | 17-Nov-2026 | QA Lead |
| **15** | **Token Versioning & Session Invalidation (Task 7)** (`token_version` column on users, `"tv"` JWT claim, invalidation on password change and admin reset, automatic session retention on change) | `backend/tests/test_task7_token_version.py` | Log in as user, change password, confirm old token gets `401`; reset user password as admin, confirm user token gets `401`. | `[Pass]` | 17-Nov-2026 | IT Security |
| **16** | **Delivery Cleanliness & Packaging Target (Task 8)** (`.gitattributes` enforcing LF line endings, `.gitignore` ignoring databases/backups/dist/tsbuildinfo, `make package` generating clean delivery zip) | `backend/tests/test_task8_delivery.py` | Run `make package`; inspect `../poona-ams-delivery.zip` to confirm zero `.db`, `dist/`, or `__pycache__` files present. | `[Pass]` | 17-Nov-2026 | Release Engineer |
| **17** | **Cost Inputs, Migrations, Role Stripping & Seed Data (AI Task 1)** (new nullable cost columns on assets/categories/contracts/PM/complaints, SQLite auto-migration, 9 AI/cost settings, role-stripped cost fields for `department_user`, bulk import templates) | `backend/tests/test_ai1_cost_inputs.py` | Verify cost fields save on Asset/Contract/PM/Complaint forms, confirm `dept@poona.demo` receives no cost keys in API JSON, and verify `coord@poona.demo` can edit `contract_value` only. | `[Pass]` | 18-Nov-2026 | Biomedical Head / IT Lead |
| **16** | **Delivery Cleanliness & Packaging Target (Task 8)** (`.gitattributes` enforcing LF line endings, `.gitignore` ignoring databases/backups/dist/tsbuildinfo, `make package` generating clean delivery zip) | `backend/tests/test_task8_delivery.py` | Run `make package`; inspect `../xyz-ams-delivery.zip` to confirm zero `.db`, `dist/`, or `__pycache__` files present. | `[Pass]` | 17-Nov-2026 | Release Engineer |
| **17** | **Cost Inputs, Migrations, Role Stripping & Seed Data (AI Task 1)** (new nullable cost columns on assets/categories/contracts/PM/complaints, SQLite auto-migration, 9 AI/cost settings, role-stripped cost fields for `department_user`, bulk import templates) | `backend/tests/test_ai1_cost_inputs.py` | Verify cost fields save on Asset/Contract/PM/Complaint forms, confirm `dept@xyz.demo` receives no cost keys in API JSON, and verify `coord@xyz.demo` can edit `contract_value` only. | `[Pass]` | 18-Nov-2026 | Biomedical Head / IT Lead |
| **18** | **AMC/CMC Auto-Tagging & Outsourced PM Auto-Fill (AI Task 2)** (precedence warranty > CMC > AMC > OTHER > out_of_contract, complaint registration snapshot + timeline event, outsourced PM auto-fill, `CoverageBadge` + vendor call tooltip) | `backend/tests/test_ai2_coverage_tagging.py` | Open `/assets`, `/complaints`, and `/pm` to confirm color-coded `CoverageBadge` and `"Call: <vendor>, <contact>"` tooltip; raise a complaint and verify `coverage_at_registration` snapshot; filter complaints by `coverage_tag`. | `[Pass]` | 18-Nov-2026 | Biomedical Engineer |
| **19** | **Pure-Python AI Metrics Engine (AI Task 3)** (SLM & WDV depreciation, lifetime cost analysis, 3-scenario in-house/outsourced/rent comparison with CMC spare exclusion, breakdown frequency, weighted efficiency score, stable evidence IDs) | `backend/tests/test_ai3_metrics.py` | Validate worked examples (₹10L 10-yr SLM/WDV, 5-yr comparison ₹7.75L/₹9.75L/₹9.0L), missing inputs returning `"Insufficient data: <input>"`, rented assets, and Demo Clock responsiveness. | `[Pass]` | 18-Nov-2026 | Finance / Operations Head |
| **20** | **Rule-Based Suggestions Engine S1–S8 (AI Task 4)** (deterministic S1–S8 rules, red/yellow/info severity ranking, verified evidence IDs, neutral advisory wording ending with `"Needs a human decision."`) | `backend/tests/test_ai4_suggestions.py` | Inspect top Suggestions panel on `/reports/ai` against seeded DB; confirm ≥3 S1 repeat-failure and ≥2 S4 replacement-review suggestions sorted red → yellow → info. | `[Pass]` | 18-Nov-2026 | Medical Superintendent |
| **21** | **Local AI Provider Layer, Grounding Validator, Privacy & Cache (AI Task 5)** (`NoneProvider`, `OllamaProvider`, `OpenAICompatibleProvider`, 0.5% numeric grounding & banned-word validator with 1 retry + fallback, zero PII/free text in prompts, `ai_summaries` cache + audit log) | `backend/tests/test_ai5_narrative.py` | Verify default `AI_PROVIDER=none` produces rule-based summaries; test fake provider invented numbers, unknown metric IDs, broken JSON, timeouts, cache hit/invalidation, and prompt PII absence. | `[Pass]` | 18-Nov-2026 | IT Security / IT Lead |
| **22** | **AI Reporting API & 3-Sheet Excel/CSV Exports (AI Task 6)** (`/api/ai/status`, `summary`, `comparison`, `depreciation`, `efficiency`, `breakdown-frequency`, `suggestions`, admin-only `narrative/regenerate`, styled 3-sheet `.xlsx` + `.csv` exports) | `backend/tests/test_ai6_api.py` | Verify `dept@poona.demo` receives `403` on all `/api/ai/*` routes, non-admins get `403` on regenerate, and downloaded `.xlsx` workbooks contain Main + `Evidence` + `How calculated` sheets. | `[Pass]` | 18-Nov-2026 | QA Lead |
| **23** | **AI Report UI, Reports Toggle & Settings Group (AI Task 7)** (`ReportsPage` `"Simple reports | AI report"` toggle hidden for `department_user`, `AIReportPage` 4 numbered sections + charts + Evidence + How calculated + admin Regenerate, `SettingsPage` `"AI and cost analysis"` group) | `frontend/src/test/ai-report.test.tsx` | Toggle between Simple and AI reports as `mgmt@poona.demo` and `admin@poona.demo`; confirm `dept@poona.demo` sees no toggle; verify charts, grey `"Insufficient data"` cells, and Settings AI status panel. | `[Pass]` | 18-Nov-2026 | Hospital Administrator |
| **22** | **AI Reporting API & 3-Sheet Excel/CSV Exports (AI Task 6)** (`/api/ai/status`, `summary`, `comparison`, `depreciation`, `efficiency`, `breakdown-frequency`, `suggestions`, admin-only `narrative/regenerate`, styled 3-sheet `.xlsx` + `.csv` exports) | `backend/tests/test_ai6_api.py` | Verify `dept@xyz.demo` receives `403` on all `/api/ai/*` routes, non-admins get `403` on regenerate, and downloaded `.xlsx` workbooks contain Main + `Evidence` + `How calculated` sheets. | `[Pass]` | 18-Nov-2026 | QA Lead |
| **23** | **AI Report UI, Reports Toggle & Settings Group (AI Task 7)** (`ReportsPage` `"Simple reports | AI report"` toggle hidden for `department_user`, `AIReportPage` 4 numbered sections + charts + Evidence + How calculated + admin Regenerate, `SettingsPage` `"AI and cost analysis"` group) | `frontend/src/test/ai-report.test.tsx` | Toggle between Simple and AI reports as `mgmt@xyz.demo` and `admin@xyz.demo`; confirm `dept@xyz.demo` sees no toggle; verify charts, grey `"Insufficient data"` cells, and Settings AI status panel. | `[Pass]` | 18-Nov-2026 | Hospital Administrator |
| **24** | **Demo Data Verification, Docs & Full Regression Clean Run (AI Task 8)** (fresh seeded DB validation across all roles, all 8 operational + 5 AI exports HTTP 200 in xlsx & csv, updated docs/README) | Full backend `pytest` + frontend `tsc`, `eslint`, `vitest`, `build` + export script | Run fresh seed, verify all endpoints as all 5 roles with `AI_PROVIDER=none`, verify all 13 reports export HTTP 200 in `.xlsx` and `.csv`, review updated docs. | `[Pass]` | 18-Nov-2026 | Release Engineer |
---
+2 -2
View File
@@ -1,4 +1,4 @@
# Assumptions Log — Poona Hospital AMS
# Assumptions Log — XYZ Hospital AMS
Items marked "to be confirmed" or left flexible in the proposal are recorded here along with the configurable defaults implemented in Phase 1.
@@ -52,7 +52,7 @@ Items marked "to be confirmed" or left flexible in the proposal are recorded her
28. **Admin Reset Password Interface (Task 5)**: `frontend/src/api/users.ts` and `frontend/src/pages/MastersPage.tsx` expose an administrator password reset modal for users with role `system_admin`. The dialog features password masking toggles, client-side mismatch validation (`Passwords do not match`), universal password policy helper instructions, and displays backend 422 validation errors inline. Successful resets trigger a notification toast and close the modal without affecting the active administrator session.
29. **Department User Scoping & Empty Scope Resolution (Task 6)**: `backend/app/services/scoping.py` implements `resolve_department_scope(user, requested_dept_id)`. Non-department roles are unconstrained and may optionally filter by `requested_dept_id`. Assigned `department_user` accounts are strictly bound to `user.department_id`, ignoring any client-requested department parameter. Unassigned `department_user` accounts (`department_id=None`) resolve to `is_empty=True`, immediately returning 0 counters on Dashboard summary, empty results on global search, and empty row lists across all accessible report endpoints without running hospital-wide queries. Report key aliases are registered to support both canonical paths and audit identifiers (e.g., `equipment-inventory`, `condemned-equipment`, `pm-schedule`).
30. **Token Versioning & Session Invalidation (Task 7)**: A `token_version` integer column (default 0, not null) is added to `users` and reconciled automatically via `run_sqlite_migrations`. Access tokens encode the user's `token_version` in claim `"tv"`. `get_current_user` rejects tokens with mismatched `"tv"` with HTTP 401 (`Token has been invalidated. Please log in again.`). Password changes and administrator password resets increment `user.token_version`, invalidating previous tokens. `POST /api/auth/change-password` returns a renewed access token, and `ChangePasswordModal.tsx` stores the new token in the active auth store to keep the user's session active without re-login.
31. **Delivery Cleanliness, Line Endings & Packaging (Task 8)**: `.gitattributes` enforces standard LF line endings across the repository (`* text=auto eol=lf`). `.gitignore` excludes all SQLite databases (`*.db`), backups, volatile uploads, frontend dist artifacts, and build info files. The `make package` target generates `../poona-ams-delivery.zip` using `git archive` to ensure zero uncommitted, ignored, or temporary files leak into handoff archives.
31. **Delivery Cleanliness, Line Endings & Packaging (Task 8)**: `.gitattributes` enforces standard LF line endings across the repository (`* text=auto eol=lf`). `.gitignore` excludes all SQLite databases (`*.db`), backups, volatile uploads, frontend dist artifacts, and build info files. The `make package` target generates `../xyz-ams-delivery.zip` using `git archive` to ensure zero uncommitted, ignored, or temporary files leak into handoff archives.
32. **Cost Fields & Role-Based Stripping (AI Task 1)**: The fields `purchase_value`, `monthly_rent`, `contract_value`, `cost_per_visit`, `repair_cost`, and `spare_cost_estimate` are classified as cost fields. For `department_user`, these keys are completely stripped from JSON responses across `/api/assets`, `/api/contracts`, `/api/pm/schedules`, and `/api/complaints` via `maybe_strip_costs_response`. For contract bulk imports, both the canonical `contract_value` header and legacy `cost` alias are accepted for backward compatibility. `settings_service` supports a typed `float` setting type for `default_salvage_pct` (0–50) and `replacement_review_ratio` (0.05–2.0).
33. **AMC/CMC Auto-Tagging & Outsourced PM Auto-Fill (AI Task 2)**: Coverage precedence is strictly `active warranty > active CMC > active AMC > active OTHER contract > out_of_contract` where active means `start_date <= on_date <= end_date` and `is_superseded == False`. When registering a complaint, coverage is snapshotted as of `effective_today(db)` into `coverage_tag`, `coverage_contract_id`, and `coverage_provider_id` so historical registration coverage remains immutable even after contracts expire, while `coverage_now` always reflects live coverage. Creating an outsourced PM schedule without `provider_id`/`contract_id` auto-fills them from the asset's highest-priority active AMC/CMC contract (CMC over AMC); if none exists, the schedule is still created with empty provider/contract and `"no_active_contract": true` warning (replacing the legacy 422 rejection).
34. **Metrics Engine Formulas & Edge Cases (AI Task 3)**:
+2 -1
View File
@@ -93,7 +93,8 @@ The color system maintains dual alignment: foundational authority anchored to AI
## 6. Hospital Deployment: XYZ Hospital
- **Tenant Name**: `XYZ Hospital` (formerly Poona Hospital & Research Centre).
- **Tenant Name**: `XYZ Hospital` (formerly XYZ Hospital).
- **System Header**: `XYZ Hospital AMS — MediAsset AI`.
- **Demo Scenarios**: Configured under `XYZ Hospital` administrative umbrella, supporting multisite departmental hierarchies (ICU, Radiology, OT, OPD, Biomedical Workshop).
- **Asset Code Standards**: `XYZ-<DEPT>-<0001>` (e.g. `XYZ-ICU-0001`).
+16 -16
View File
@@ -1,19 +1,19 @@
# Poona Hospital AMS — 10-Minute End-to-End Demo Script
# 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@poona.demo`
- **Biomedical Engineer**: `bio@poona.demo`
- **Department User (ICU)**: `dept@poona.demo`
- **Management**: `mgmt@poona.demo`
- **Coordinator**: `coord@poona.demo`
- **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@poona.demo` / `Demo@123`).
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).
@@ -27,27 +27,27 @@
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@poona.demo` / `Demo@123`).
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@poona.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.
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@poona.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@poona.demo`) or **Coordinator** (`coord@poona.demo`) to approve a calibration plan's frequency.
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@poona.demo`) to review/log a department round linked to multiple assets and complaints; verify `dept@poona.demo` / `coord@poona.demo` cannot access `/visits`.
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@poona.demo`).
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.
@@ -56,7 +56,7 @@
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@poona.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.
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`).
---
@@ -66,7 +66,7 @@
- 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@poona.demo`) or **System Admin** (`admin@poona.demo`) and click the **"AI report"** side of the `"Simple reports | AI report"` segmented toggle (note that `dept@poona.demo` does not see this toggle).
- 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."`.
@@ -74,4 +74,4 @@
- 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@poona.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`.
- 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`.
+1 -1
View File
@@ -1,4 +1,4 @@
# Poona Hospital AMS — Implementation Plan Summary
# XYZ Hospital AMS — Implementation Plan Summary
**Status:** Phases 0–8 complete, plus Excel exports / bulk import / responsive layout as of commit `22fad38`.
+7 -7
View File
@@ -1,12 +1,12 @@
# Poona Hospital AMS — Role-Based User Guide
# XYZ 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.
Welcome to the XYZ 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`)
## 1. System Administrator (`admin@xyz.demo`)
The System Administrator oversees system security, reference masters, user access, and global configuration.
@@ -28,7 +28,7 @@ The System Administrator oversees system security, reference masters, user acces
---
## 2. Biomedical Engineer (`bio@poona.demo`)
## 2. Biomedical Engineer (`bio@xyz.demo`)
Biomedical Engineers handle physical medical assets, breakdown repairs, preventative maintenance schedules, and rounds.
@@ -49,7 +49,7 @@ Biomedical Engineers handle physical medical assets, breakdown repairs, preventa
---
## 3. Department User (`dept@poona.demo` — ICU)
## 3. Department User (`dept@xyz.demo` — ICU)
Department Users (Nurses, In-charges, Technicians) raise and monitor breakdown calls for their own department.
@@ -66,7 +66,7 @@ Department Users (Nurses, In-charges, Technicians) raise and monitor breakdown c
---
## 4. Management (`mgmt@poona.demo`)
## 4. Management (`mgmt@xyz.demo`)
Hospital Management (Medical Superintendent, Directors, Quality Heads) review operational performance, KPIs, and reports.
@@ -84,7 +84,7 @@ Hospital Management (Medical Superintendent, Directors, Quality Heads) review op
---
## 5. Clinical Coordinator (`coord@poona.demo`)
## 5. Clinical Coordinator (`coord@xyz.demo`)
Coordinators manage legal contracts, equipment warranties, insurance coverage, and loaner/demo devices.
+1 -1
View File
@@ -39,7 +39,7 @@ function ProtectedRoute({ children }: { children: React.ReactNode }) {
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="text-center space-y-2">
<div className="h-8 w-8 border-4 border-[#1e3a8a] border-t-transparent rounded-full animate-spin mx-auto" />
<p className="text-sm text-gray-500">Loading Poona Hospital AMS...</p>
<p className="text-sm text-gray-500">Loading XYZ Hospital AMS...</p>
</div>
</div>
);
@@ -76,7 +76,7 @@ async function exportToExcel<TData>(table: TanStackTable<TData>, filename: strin
const headerAddr = XLSX.utils.encode_cell({ r: 0, c });
if (ws[headerAddr]) {
ws[headerAddr].s = {
fill: { fgColor: { rgb: "1E3A8A" } }, // Poona Hospital Deep Navy
fill: { fgColor: { rgb: "1E3A8A" } }, // XYZ Hospital Deep Navy
font: { name: "Calibri", sz: 11, bold: true, color: { rgb: "FFFFFF" } },
alignment: { horizontal: "center", vertical: "center", wrapText: true },
border: {
+1 -1
View File
@@ -288,7 +288,7 @@ export function AssetsPage() {
columns={columns}
loading={assetsQuery.isLoading}
globalFilterPlaceholder="Search by asset code, equipment, department, serial..."
exportFilename="poona-hospital-assets"
exportFilename="xyz-hospital-assets"
emptyMessage="No assets match the current filters."
onRowClick={(row) => navigate(`/assets/${row.id}`)}
/>
+1 -1
View File
@@ -368,7 +368,7 @@ export function ComplaintsPage() {
columns={columns}
loading={complaintsQuery.isLoading}
globalFilterPlaceholder="Quick filter loaded table..."
exportFilename="poona-hospital-complaints"
exportFilename="xyz-hospital-complaints"
emptyMessage="No complaints match the current filters."
onRowClick={(row) => navigate(`/complaints/${row.id}`)}
getRowClassName={(row) =>
+6 -6
View File
@@ -17,11 +17,11 @@ const loginSchema = z.object({
type LoginFormValues = z.infer<typeof loginSchema>;
const DEMO_ACCOUNTS = [
{ label: "System Admin", email: "admin@poona.demo", hint: "Full system control" },
{ label: "Biomedical", email: "bio@poona.demo", hint: "Assets, PM, repairs" },
{ label: "Department User (ICU)", email: "dept@poona.demo", hint: "ICU complaints & assets" },
{ label: "Management", email: "mgmt@poona.demo", hint: "Reports & oversight" },
{ label: "Coordinator", email: "coord@poona.demo", hint: "Contracts, demo, calibration" },
{ label: "System Admin", email: "admin@xyz.demo", hint: "Full system control" },
{ label: "Biomedical", email: "bio@xyz.demo", hint: "Assets, PM, repairs" },
{ label: "Department User (ICU)", email: "dept@xyz.demo", hint: "ICU complaints & assets" },
{ label: "Management", email: "mgmt@xyz.demo", hint: "Reports & oversight" },
{ label: "Coordinator", email: "coord@xyz.demo", hint: "Contracts, demo, calibration" },
];
export function LoginPage() {
@@ -119,7 +119,7 @@ export function LoginPage() {
id="email"
type="email"
autoComplete="email"
placeholder="you@poona.demo"
placeholder="you@xyz.demo"
{...register("email")}
className="w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-[#2E5C9A]"
/>
+4 -4
View File
@@ -403,12 +403,12 @@ export function ReportDetailPage() {
<div className="flex items-center gap-3.5">
<img
src="/logo.jpg"
alt="Poona Hospital and Research Centre"
alt="XYZ Hospital"
className="h-14 w-14 object-contain"
/>
<div>
<div className="text-base font-extrabold text-[#1e3a8a] tracking-tight">
POONA HOSPITAL &amp; RESEARCH CENTRE
XYZ HOSPITAL
</div>
<div className="text-[11px] font-semibold text-gray-800">
NABH Accredited Tertiary Care Hospital &bull; Department of Clinical Engineering
@@ -1035,7 +1035,7 @@ export function ReportDetailPage() {
<div className="hidden print:block mt-8 pt-4 border-t-2 border-gray-300 print-break-inside-avoid">
<div className="flex items-center justify-between text-[10px] font-bold uppercase tracking-wider text-gray-700 mb-4">
<span>Hospital Engineering Audit &amp; Verification Sign-off (NABH Chapter FMS)</span>
<span>Poona Hospital &amp; Research Centre</span>
<span>XYZ Hospital</span>
</div>
<div className="grid grid-cols-3 gap-5 text-[10px]">
<div className="border border-gray-300 rounded p-3 space-y-4 bg-gray-50/50">
@@ -1067,7 +1067,7 @@ export function ReportDetailPage() {
</div>
</div>
<div className="mt-4 pt-2 border-t border-gray-200 text-[9px] text-gray-500 flex items-center justify-between">
<span>Official Hospital Record &bull; Poona Hospital &amp; Research Centre &bull; Confidential &bull; Retain for 7 Years</span>
<span>Official Hospital Record &bull; XYZ Hospital &bull; Confidential &bull; Retain for 7 Years</span>
<span>AMS Portal Generated &bull; NABH Compliant</span>
</div>
</div>
@@ -8,7 +8,7 @@ import { ApiError } from "@/api/client";
const mockUser: MasterUser = {
id: 42,
name: "Dr. Jane Doe",
email: "jane@poona.demo",
email: "jane@xyz.demo",
role: "department_user",
department_id: 2,
department_name: "Cardiology",
+5 -5
View File
@@ -342,7 +342,7 @@ describe("AI Report & Settings (Task 7)", () => {
useAuthStore.setState({
user: {
id: 3,
email: "dept@poona.demo",
email: "dept@xyz.demo",
name: "ICU Nurse",
role: "department_user",
department_id: 1,
@@ -358,7 +358,7 @@ describe("AI Report & Settings (Task 7)", () => {
useAuthStore.setState({
user: {
id: 4,
email: "mgmt@poona.demo",
email: "mgmt@xyz.demo",
name: "Director",
role: "management",
department_id: null,
@@ -387,7 +387,7 @@ describe("AI Report & Settings (Task 7)", () => {
useAuthStore.setState({
user: {
id: 4,
email: "mgmt@poona.demo",
email: "mgmt@xyz.demo",
name: "Director",
role: "management",
department_id: null,
@@ -417,7 +417,7 @@ describe("AI Report & Settings (Task 7)", () => {
useAuthStore.setState({
user: {
id: 1,
email: "admin@poona.demo",
email: "admin@xyz.demo",
name: "System Admin",
role: "system_admin",
department_id: null,
@@ -439,7 +439,7 @@ describe("AI Report & Settings (Task 7)", () => {
useAuthStore.setState({
user: {
id: 1,
email: "admin@poona.demo",
email: "admin@xyz.demo",
name: "System Admin",
role: "system_admin",
department_id: null,
+2 -2
View File
@@ -65,7 +65,7 @@ describe("CalibrationPage", () => {
useAuthStore.setState({
user: {
id: 5,
email: "mgmt@poona.org",
email: "mgmt@xyz.org",
name: "Hospital Director",
role: "management",
department_id: null,
@@ -92,7 +92,7 @@ describe("CalibrationPage", () => {
useAuthStore.setState({
user: {
id: 2,
email: "bio@poona.org",
email: "bio@xyz.org",
name: "Biomed Engineer",
role: "biomedical",
department_id: null,
+2 -2
View File
@@ -89,7 +89,7 @@ describe("ComplaintDetailPage", () => {
user: {
id: 3,
name: "ICU Nurse",
email: "dept@poona.demo",
email: "dept@xyz.demo",
role: "department_user",
department_id: 1,
department_name: "ICU",
@@ -122,7 +122,7 @@ describe("ComplaintDetailPage", () => {
user: {
id: 2,
name: "Bio Eng",
email: "bio@poona.demo",
email: "bio@xyz.demo",
role: "biomedical",
department_id: null,
department_name: null,
+6 -6
View File
@@ -25,11 +25,11 @@ describe("LoginPage", () => {
expect(screen.getByLabelText("Password")).toBeInTheDocument();
expect(screen.getByRole("button", { name: /Sign In/i })).toBeInTheDocument();
expect(screen.getByText("admin@poona.demo")).toBeInTheDocument();
expect(screen.getByText("bio@poona.demo")).toBeInTheDocument();
expect(screen.getByText("dept@poona.demo")).toBeInTheDocument();
expect(screen.getByText("mgmt@poona.demo")).toBeInTheDocument();
expect(screen.getByText("coord@poona.demo")).toBeInTheDocument();
expect(screen.getByText("admin@xyz.demo")).toBeInTheDocument();
expect(screen.getByText("bio@xyz.demo")).toBeInTheDocument();
expect(screen.getByText("dept@xyz.demo")).toBeInTheDocument();
expect(screen.getByText("mgmt@xyz.demo")).toBeInTheDocument();
expect(screen.getByText("coord@xyz.demo")).toBeInTheDocument();
});
it("shows validation errors when submitting empty credentials", async () => {
@@ -56,7 +56,7 @@ describe("LoginPage", () => {
</MemoryRouter>
);
fireEvent.change(screen.getByLabelText("Email Address"), { target: { value: "admin@poona.demo" } });
fireEvent.change(screen.getByLabelText("Email Address"), { target: { value: "admin@xyz.demo" } });
fireEvent.change(screen.getByLabelText("Password"), { target: { value: "wrong" } });
fireEvent.click(screen.getByRole("button", { name: /Sign In/i }));
+1 -1
View File
@@ -32,7 +32,7 @@ describe("Phase 5 Modules", () => {
useAuthStore.setState({
user: {
id: 2,
email: "bio@poona.org",
email: "bio@xyz.org",
name: "Biomed Engineer",
role: "biomedical",
department_id: null,
+1 -1
View File
@@ -118,7 +118,7 @@ describe("Phase 6 Modules", () => {
useAuthStore.setState({
user: {
id: 2,
email: "bio@poona.org",
email: "bio@xyz.org",
name: "Biomed Engineer",
role: "biomedical",
department_id: null,
+2 -2
View File
@@ -37,7 +37,7 @@ describe("Phase 8 Frontend Polish", () => {
user: {
id: 1,
name: "System Admin",
email: "admin@poona.demo",
email: "admin@xyz.demo",
role: "system_admin",
department_id: null,
department_name: null,
@@ -124,7 +124,7 @@ describe("Phase 8 Frontend Polish", () => {
{
id: 1,
name: "System Admin",
email: "admin@poona.demo",
email: "admin@xyz.demo",
role: "system_admin",
department_id: null,
department_name: null,
+1 -1
View File
@@ -56,7 +56,7 @@ describe("PMPage", () => {
useAuthStore.setState({
user: {
id: 2,
email: "bio@poona.org",
email: "bio@xyz.org",
name: "Biomed Engineer",
role: "biomedical",
department_id: null,
+3 -3
View File
@@ -40,7 +40,7 @@ describe("Phase 7 Reports", () => {
useAuthStore.setState({
user: {
id: 5,
email: "mgmt@poona.org",
email: "mgmt@xyz.org",
name: "Director",
role: "management",
department_id: null,
@@ -58,7 +58,7 @@ describe("Phase 7 Reports", () => {
useAuthStore.setState({
user: {
id: 3,
email: "icu@poona.org",
email: "icu@xyz.org",
name: "ICU Nurse",
role: "department_user",
department_id: 1,
@@ -87,7 +87,7 @@ describe("Phase 7 Reports", () => {
useAuthStore.setState({
user: {
id: 5,
email: "mgmt@poona.org",
email: "mgmt@xyz.org",
name: "Director",
role: "management",
department_id: null,
+3 -3
View File
@@ -12,7 +12,7 @@ describe("Phase 1 Frontend Smoke Tests", () => {
user: {
id: 1,
name: "Admin",
email: "admin@poona.demo",
email: "admin@xyz.demo",
role: "system_admin",
department_id: null,
department_name: null,
@@ -63,7 +63,7 @@ describe("Phase 1 Frontend Smoke Tests", () => {
user: {
id: 3,
name: "Dept User",
email: "dept@poona.demo",
email: "dept@xyz.demo",
role: "department_user",
department_id: 1,
department_name: "ICU",
@@ -85,7 +85,7 @@ describe("Phase 1 Frontend Smoke Tests", () => {
user: {
id: 5,
name: "Coordinator",
email: "coord@poona.demo",
email: "coord@xyz.demo",
role: "coordinator",
department_id: null,
department_name: null,