# Assumptions & Fixes Log — Dr Dutta Booking CRM

> Running log of anything not explicitly specified in the design HTML or logic PDF.
> Format: **[ID] Finding → Decision/Fix → Status** (`ASSUMED` = proceeding, `NEEDS-CONFIRM` = awaiting your call).
> Created during pre-build review. Updated every phase.

---

## A. Data / theme mismatches (design HTML vs logic PDF)

- **[F1] Admin HTML is a dental-clinic template with hardcoded dummy data** — fixed doctor names (Dr. Sarah Jenkins / Marcus Vance / Emily Watson), some `$` currency, dental-only tags (Root Canal Follow-up, Teeth Whitening), a "Tooth / Area" column.
  → Treat the HTML strictly as **layout/structure** reference. All data is DB-driven and dynamic. Remove hardcoded doctors and demo tags; replace with seeded/real data. `ASSUMED`

- **[F2] Currency is inconsistent** — staff form & services use `₹`; billing modal & add-patient use `$`.
  → Standardize on **₹ (INR)**, stored as a config value on the Clinic Practice Profile so it can be changed in one place. `NEEDS-CONFIRM` (assuming INR)

- **[F3] Department naming is inconsistent** — allocation/services list "Dental / Skin / Hair"; staff form lists "Dental / Dermatology / Hair & Trichology" **plus** operational units (Front Desk, Billing & Accounts, Patient Care, Administration).
  → Split into **two concepts**: (a) **Clinical Departments** — Dental, Dermatology, Hair & Trichology (used for services, doctors, allocation); (b) **Staff Teams** — Front Desk, Billing, etc. (used only for staff records). `NEEDS-CONFIRM`

- **[F4] "Site / Area" column** — the billing "Tooth / Area" column is dental-specific and meaningless for skin/hair.
  → Rename to a generic **optional "Site / Area"** field. `ASSUMED`

## B. Workflow / entity gaps

- **[F5] Add-Patient form vs PDF creation flow** — PDF requires Patient → Doctor → Department → Service → Appointment (auto-lands on doctor's dashboard). The HTML form has "Assigned Dentist" + "Last Treatment Procedure" but **no Department, Service, or appointment date/time**.
  → Extend Add-Patient to capture Clinical Department + Service + Appointment date/time so it creates patient + appointment + allocation in one action, per the PDF. Keep the extra allergies/conditions/medication-history block from the HTML (bonus clinical value, not in PDF). `ASSUMED`

- **[F6] Public booking captures date only, no time** — PDF's allocation display expects appointment time.
  → Add **time-slot selection** to the public booking wizard, driven by clinic operating hours + a configurable slot length. Alternative: keep date-only and let staff set time at allocation. `NEEDS-CONFIRM` (which approach + slot length)

- **[F7] "Clinical Disease / Diagnosis" vs "Service" are conflated** in PDF §6 (titled "Diagnosis Management" but the form is actually "Add Service": name/department/cost-per-sitting/status). Diagnosis (§11) is separately a searchable clinical-condition list the doctor selects.
  → Model as **two entities**: **Services/Treatments** (billable, cost per sitting, department) and **Diagnoses** (clinical condition list, non-billable, searchable). `NEEDS-CONFIRM`

- **[F8] Doctor signature** — PDF says the signature auto-attaches to the prescription if uploaded on the doctor profile, else left blank for manual signing. The Add Doctor/Staff form has "Profile Picture" but **no signature upload**.
  → Add a **Signature Image** upload to the doctor profile; auto-embed on generated prescriptions when present. `ASSUMED`

- **[F9] No prescription layout provided** in either zip, but PDF §14 requires auto-generated prescriptions (patient/doctor/diagnosis/meds/dosage/freq/duration/instructions/date + signature).
  → Build a **prescription view + PDF export** using a clean clinical layout with the clinic logo (`logo.jpeg` is present). `NEEDS-CONFIRM` (fields/branding OK?)

- **[F10] Procedures vs service-sitting billing** — billing has a "Treatment Procedures" tab (manual: procedure, site, unit cost, qty) and PDF §19 "Add New Procedure", which overlaps with the auto service×sittings cost (§12).
  → Support **two billing sources** feeding one ledger: (a) auto treatment cost = service cost/sitting × sittings (set by doctor), (b) manual procedures added by staff. `NEEDS-CONFIRM` (are procedures additive line items on top of sitting cost?)

- **[F11] "Next-sitting fee" / installments** — billing shows "Next Month Expected Fee", "Upcoming Payment Plan", "Total Installments"; PDF §16 mentions "Next Sitting Expected Fee" only.
  → Compute **next-sitting expected fee = cost per sitting** (or remaining sittings × cost). Treat "payment plan" as a computed view, not a formal installment schedule, unless you want a real plan. `NEEDS-CONFIRM`

## C. Roles, auth & permissions

- **[F12] Three roles only, no patient login** — confirmed by the login page (Admin / Staff / Doctor). Patients book via the public form with no account.
  → Roles = Admin, Staff, Doctor. No patient/customer authentication. `ASSUMED`

- **[F13] Admin-created accounts, no self sign-up** — PDF stresses admin/staff create doctor & staff accounts directly.
  → **Disable/remove the public register route.** Accounts are created inside the panel only. `ASSUMED`

- **[F14] Dynamic module access** — PDF: admin "can edit dynamically their role module access."
  → Implement a **permission matrix** (role → module toggles), not hardcoded `if role ==` checks. Seed Admin (all), Staff (all except Reports), Doctor (Doctor Dashboard only) per PDF. Enforce with Policies/Gates. `NEEDS-CONFIRM` (per-role defaults only, or also per-user overrides?)

- **[F15] Appointment status set** — HTML shows CONFIRMED / IN CONSULTATION / COMPLETED / CANCELLED.
  → Propose enum: `pending_allocation → allocated → confirmed → in_consultation → completed`, plus `cancelled` and `no_show`. `NEEDS-CONFIRM`

## D. Comms, storage, security

- **[F16] Dual-channel broadcasting** — dev-prompt §5 specifies Airtel + Tubelight SMS; PDF §22 adds Email. Bulk-broadcasts HTML has both composers, templates, segments, and campaign history.
  → Build **SMS (SmsGatewayInterface → TubelightGateway)** + **Email (Laravel Mail)**, both queued via Redis, with `sms_logs` + campaign history. Credentials via `.env`/`config/sms.php`. `NEEDS-CONFIRM` (awaiting Airtel/Tubelight docs+creds; email provider/SMTP?)

- **[F17] Document storage** — patient documents (reports/prescriptions/etc.) with mime+size validation.
  → Store on a configured disk. `NEEDS-CONFIRM` (local disk vs S3?)

- **[F18] Audit logging** — dev-prompt §6 requires audit trail for cancellations, role changes, broadcasts. No UI provided.
  → Add activity/audit logging and **propose a small audit-viewer screen** under Reports/Settings. `ASSUMED`

- **[F19] Auth scaffold** — dev-prompt asks to recommend the lighter Blade option and confirm before installing.
  → Recommend **Laravel Breeze (Blade stack)** with the register route removed. `NEEDS-CONFIRM` (approve before install)

---

_Last updated: end of Phase 11 — final QA. Full static integrity sweep clean (routes/components/views/controllers/requests all resolve). All 26 PDF sections covered; adaptations logged above. Build complete.

---

## Decisions finalized (user, entering Phase 3)

- **F2** Currency = INR ₹ (configurable in Clinic Profile). ✅
- **F3** Departments: clinical (Dental/Dermatology/Hair & Trichology) vs staff teams. ✅ (Claude's call kept)
- **F6** Booking is **date-only** — no time slots. Staff may set a time at allocation. ✅
- **F7 + F10 + F11** "Service" and "Clinical Disease / Diagnosis" are **one entity**. The word "service" is removed everywhere. One billable catalog: **Clinical Disease / Diagnosis**, each with a department + **cost per sitting**. Procedures and consultation treatments are the same thing. **All billing = cost_per_sitting × sittings**; no separate payment-plan/installment concept. `services` + `procedures` tables dropped; FKs repointed to `diagnosis_id`. ✅
- **F9** Prescription layout will match an **image the user will attach** (applied in Phase 6). ⏳ awaiting image
- **F12** No patient login. ✅
- **F14** Per-user module-access overrides. ✅
- **F15** Status enum: pending_allocation → allocated → confirmed → in_consultation → completed, + cancelled, no_show. ✅
- **F16** SMS via **TubelightGateway**; email via **Gmail/webmail SMTP** (Phase 8). ✅
- **F17** Uploads stored on server; **images auto-converted to WebP**; other document formats allowed. ✅ (via App\Support\ImageConverter)
- **F19** Lean custom Blade auth (no Breeze). ✅

_Last updated: end of Phase 11 — final QA. Full static integrity sweep clean (routes/components/views/controllers/requests all resolve). All 26 PDF sections covered; adaptations logged above. Build complete.
