Functional contract

Visits and whiteboard

A visit is the on-floor encounter for one patient after arrival. An appointment is only the booking. Every visit comes from checking in an appointment; a walk-in is booked first as an appointment with no patient, then checked in once a patient is chosen.

Whiteboard + Visit 360 shipped Home clinic radar shipped Mobile Whiteboard later Source: docs/functional/visits.md, home-clinic-radar.md

Domain

ModelWhat it is
VisitEncounter after arrival. Linked appointment, optional attending staff, optional current room. Code VI-000123 per Organization
VisitStaffStaff on the visit (may differ from the booking)
VisitServiceCatalog item (+ optional appointment type) on the visit; each is a sales-order line source

Charges belong to the Visit. A ready_to_bill card shows Checkout (checkout.manage), which opens or reuses the visit’s home sales order. See Appointment to invoice.

Statuses and place

checked_in → in_room ⇄ waiting → ready_to_bill → completed.

StatusPlaceMeaning
checked_inWaiting roomArrived, not seen
in_roomA roomIn any room (exam, treatment, surgery), first time or again
waitingWaiting roomSeen, waiting for the next step
ready_to_billOff floorCare done, waiting for checkout
completedOff floorClosed

Place is derived (waiting room / a room / off floor), not a column. Illegal pairs are rejected. Room → waiting room sets waiting; waiting room → a room sets in_room. Timestamps: arrived_at, status_changed_at, place_changed_at. There is no “in treatment” status. Room occupancy over the limit warns but still saves.

The Schedule keeps appointment statuses (scheduled, canceled, no-show, checked-in); a checked-in appointment only displays its visit status.

Check-in and undo

ActionWhoBehavior
Check-invisits.manage (API: appointments.manage)Requires a patient. Materializes a virtual occurrence, requires blocking deposits settled, creates the Visit (checked_in, waiting room, staff and type copied), opens the sales order, auto-charges the type’s catalog item. Idempotent. Redirects to the whiteboard
Walk-inappointments.manageBook an appointment with no patient (labeled “Walk-In”). No visit-only walk-in; POST /app/visits is removed
Undo check-invisits.manage (API: appointments.manage)Only while still checked_in in the waiting room. AppointmentUndoCheckIn → Visit#undo_check_in!: unlinks deposits, releases visit-sourced sales lines, destroys the visit (and its emptied order), appointment back to scheduled. Web: whiteboard PATCH /app/visits/:id/undo_check_in or the popover. API: status: "scheduled"
Cancel / no-showappointments.manageTerminal, no Visit. If checked in and still waiting, undoes the visit first

Whiteboard

GET /app/whiteboard (visits.read). Query view: floor (default), pipeline, or list. Today’s arrivals plus still-open prior-day visits. /app/flowboard redirects here.

Cards expose Open (Visit 360 in the drawer), Checkout when ready, and up to two service chips. Live over Action Cable (ClinicBoardChannel), same as Schedule.

Visit services

Check-in from a typed appointment creates the first service and auto-charges it. Staff add more (Vaccination + Dental + Grooming on one encounter). AppointmentType#clinical marks exam-style types; SOAP is never required for ready-to-bill or checkout.

Visit 360 workspace

GET /app/visits/:id and /app/visits/:id/cockpit (visits.read) share one shell: full page, or the app drawer (app_drawer / embed=1).

No Patient 360 rail and no sticky checkout CTA: floor moves and Take payment stay on the Whiteboard / Checkout desk.

Home clinic radar

Home complements the Whiteboard; it does not replace it. Web only (not on the staff API; mobile Home stats are sample data).

RBAC

Location-scoped visits.read / visits.manage. Org admin, location admin, receptionist, and veterinarian may manage. Veterinarian cannot book, cancel, or no-show (appointments.manage) or manage desk checkout (checkout.manage).

Out of scope

Mobile Whiteboard and visit API, visit-only walk-ins, auto no-show, undo after the visit left the waiting room, confirmed status, reminders. Invoices and payments live in Billing.

Full contract: docs/functional/visits.md, home-clinic-radar.md.