# ISP360 Phase 0 — Project Reset Inventory

**Version:** 1.0  
**Date:** 2026-06-13  
**Prepared by:** Polakis Technologies  
**Status:** Complete

---

## Purpose

This document records the Phase 0 workspace reset that removed the legacy **Prodigy ENT hospital management system** and prepared a clean scaffold for **ISP360** — an enterprise multi-tenant ISP management platform.

---

## Reset Strategy

| Approach | Detail |
|----------|--------|
| Strategy | Greenfield replace — hospital domain code removed |
| UI layout | Flat root pages (no `/admin` or `/customer` folders) |
| Support dirs | `/includes`, `/layouts`, `/ajax`, `/api`, `/assets`, `/cron`, `/install`, `/templates`, `/uploads`, `/backups`, `/logs`, `/sql`, `/docs`, `/vendor` |

---

## Retained (Reference / Direct Reuse)

### Directories

| Directory | Files | Purpose |
|-----------|-------|---------|
| `/assets` | 3,914 | Bootstrap 5, jQuery, Chart.js, DataTables, icons, fonts |
| `/vendor` | 1,119 | PHPMailer, PHPSpreadsheet (invoices, reports, email) |
| `/uploads` | 0 (cleared) | User/tenant file uploads scaffold |
| `/logs` | 0 (cleared) | Application log storage scaffold |

### Includes (Reference Only — Rewrite for ISP360)

| File | Lines | Reuse Notes |
|------|-------|-------------|
| `includes/auth.php` | ~387 | Session helpers, `hasPermission()` patterns — rewrite for ISP360 RBAC + PDO |
| `includes/rbac_system.php` | ~660 | `RoleBasedAccessControl` class — rewrite for permission-based (not page-based) ISP roles |
| `includes/mpesa_helper.php` | ~538 | Daraja OAuth + STK Push patterns — rewrite for PDO + per-tenant credentials |

These files are **not production-ready for ISP360**. They are kept as reference during Phase 4 (RBAC) and Phase 8 (Payments) implementation.

---

## Removed — Hospital Domain Code

### Root PHP Pages (8 files)

| File | Description |
|------|-------------|
| `index.php` | Hospital dashboard |
| `login.php` | Hospital login UI |
| `login_process.php` | Hospital login handler |
| `logout.php` | Session logout |
| `forgot_password.php` | Password recovery |
| `reset_password.php` | Password reset handler |
| `reset_password_page.php` | Password reset UI |
| `role_permissions.php` | Hospital role/page permissions UI |

### Directories Removed

| Directory | Files Removed | Former Purpose |
|-----------|---------------|----------------|
| `/actions` | 15 | Form action handlers (hospital workflows) |
| `/ajax` | 226 | Hospital AJAX endpoints (queue, pharmacy, billing, HR) |
| `/api` | 33 | Hospital REST APIs (patient, doctor, M-Pesa, SMART) |
| `/app` | 4 | Legacy app module |
| `/classes` | 6 | Hospital OOP helpers |
| `/config` | 2 | AI + SMART insurance config |
| `/cron` | 1 | Hospital auto-requisition cron |
| `/dashboard_templates` | 1 | Hospital dashboard templates |
| `/databank` | 4 | Analytics databank module |
| `/docs` | 2 | Prodigy ENT documentation (replaced by this file) |
| `/documents` | 1 | Document storage |
| `/edi` | 0 | EDI module (empty) |
| `/email_templates` | 1 | Hospital email templates |
| `/export` | 1 | Data export utility |
| `/fpdf` | 120 | FPDF library (hospital PDFs) |
| `/imports` | 17 | Patient/data import scripts |
| `/js` | 1 | Standalone JS (assets/ retained) |
| `/layouts` | 168 | Hospital layout templates + PHPMailer vendor subset |
| `/lpo_pdfs` | 4 | LPO PDF storage |
| `/quotations` | 5 | Quotation module |
| `/reports` | 9 | Hospital reconciliation reports |
| `/scssphp` | 59 | SCSS compiler |
| `/smart` | 2 | SMART insurance API handler |
| `/sql` | 5 | Hospital incremental migrations |
| `/tests` | 1 | API verification test |
| `/utils` | 1 | Utility scripts |
| `/chat_files` | 0 | Chat attachments (empty) |

### Includes Removed (34 files → 3 retained)

Removed hospital-specific includes including:

- `EtimsIntegration.php` — Kenya eTIMS tax
- `ZKTecoConnector.php` — Biometric attendance
- `menu_config.php` — Hospital navigation (~2000 lines)
- `accounting_posting.php` — Hospital GL posting
- `sos_helper.php`, `service_department_helper.php` — Hospital modules
- `config.php` — JWT secret (hospital)
- `hr_*.php` — HR/payroll modules
- All other hospital helpers, handlers, backups, and temp files

**Total files removed:** ~5,700+ (excluding retained assets/vendor)

---

## New Scaffold Created

### Support Directories

```
/ISP
├── ajax/                  # AJAX endpoints (.gitkeep)
├── api/
│   └── v1/                # REST API v1 (.gitkeep)
├── assets/                # RETAINED — frontend libraries
├── backups/               # Backup storage (.gitkeep)
├── cron/                  # Scheduled jobs (.gitkeep)
├── docs/                  # Specifications (this file)
├── includes/              # Core PHP — 3 reference files only
├── install/
│   ├── steps/             # Install wizard steps (.gitkeep)
│   └── migrations/        # DB migrations (.gitkeep)
├── layouts/               # Header, sidebar, footer (.gitkeep)
├── logs/                  # Log files (.gitkeep)
├── sql/                   # database_schema.sql destination (.gitkeep)
├── templates/             # Captive portal themes (.gitkeep)
├── uploads/               # File uploads (.gitkeep)
└── vendor/                # RETAINED — PHPMailer, PHPSpreadsheet
```

### Project Root (UI Pages)

No UI pages exist yet. During implementation, all pages will be created at the project root:

| Prefix | Examples |
|--------|----------|
| *(none)* | `dashboard.php`, `customers.php`, `routers.php` |
| `portal_` | `portal_login.php`, `portal_dashboard.php` |
| `report_` | `report_revenue.php`, `report_usage.php` |
| `settings_` | `settings_general.php`, `settings_payments.php` |

---

## Standard Page Include Pattern (Target)

Every root page will use:

```php
require_once('includes/config.php');
require_once('includes/auth.php');
require_once('layouts/session.php');  // when session/layout needed
```

---

## What Was NOT Retained (Intentional)

| Item | Reason |
|------|--------|
| `layouts/dbconn.php` (MySQLi) | ISP360 requires PDO per master plan |
| `includes/config.php` (hospital JWT) | New tenant-aware config in Phase 1 |
| `includes/menu_config.php` | Hospital menu incompatible; new ISP360 menu in Wave 1 |
| `/fpdf/` | Will use PHPSpreadsheet + new PDF strategy in reporting phase |
| Hospital `/sql/` migrations | Replaced by `sql/database_schema.sql` in Phase 1 |
| `/reports/` directory | Reports will be root-level `report_*.php` pages |

---

## Post-Reset Verification

| Check | Status |
|-------|--------|
| No hospital root PHP files | Pass |
| No `/admin` or `/customer` directories | Pass |
| `includes/` contains only 3 reference files | Pass |
| `assets/` and `vendor/` intact | Pass |
| All support scaffold directories exist | Pass |
| `uploads/` and `logs/` cleared | Pass |

---

## Next Step

**Phase 1 — Database Architecture**

Generate `sql/database_schema.sql` (200–300 tables) and `docs/DATABASE_DESIGN.md`.

---

## Change Log

| Version | Date | Change |
|---------|------|--------|
| 1.0 | 2026-06-13 | Initial Phase 0 reset complete |
