Functional contract
Patients and patient parents
Staff register an animal (the patient) with one or more patient parents (client contacts). Charts are Organization-scoped and visible from every Location. Required fields use in-form checks instead of the browser’s native validation bubble.
Records
| Model | What it is | Scope |
|---|---|---|
Patient | The animal | Organization |
Client | Patient parent contact (not a User) | Organization |
PatientParent | Join of a patient to a parent | Patient |
Breed | Shared dog / cat / other catalog | Platform |
PatientTag | Handling / temperament tag | Platform defaults + Organization custom |
PatientNote | Dated chart note with author | Patient |
PatientVaccine | Vaccine + certificate file | Patient |
Veterinarian | Patient’s vet (staff or external): name, business, phone, email | Patient |
MedicalCondition | Condition catalog | Platform |
PatientMedicalCondition | Reported condition | Patient |
One primary client per patient (the first parent) plus optional additional parents. A client may have many patients. Admission searches existing parents by name, email, or phone, or creates new ones in the same form.
Patient — required: name, species. Dog / Cat / Other shortcuts on admission. Optional: profile photo (S3; choose a file, or the Take photo menu: this device or a single-use QR code — see Architecture → Hands-off uploads), breed, hair type/color, DOB (or age in years → estimated DOB), sex, spayed (female only), neutered (male only), weight (kg stored; metric/imperial display), tags, notes, vaccines, veterinarian, and medical conditions. Soft-delete via disabled_at; deceased via deceased_at. Default directory and booking pickers are enabled and living (Patient.bookable); new bookings (or a patient newly set on a booking, e.g. a walk-in) reject disabled or deceased patients.
Client — required: first name, last name, and a phone number or email. Optional remaining contact fields, address (geocoded when possible), email/SMS/SMS-marketing toggles (on by default; off is opt-out), and disabled_at (stays on charts, omitted from the existing-parent picker).
Mobile lists, shows, creates, and edits patients and clients through /api/v1/patients, /api/v1/clients, and /api/v1/patient_catalog.
Workspace
Patients live at /app/patients, clients at /app/clients. Super admins manage breeds at /admin/breeds.
| Route | Who | Behavior |
|---|---|---|
GET /app/patients | patients.read | Table: avatar, name + badges, species / breed, age + sex, parent + contact, attention. Status filters with counts (enabled living by default) |
GET/POST /app/patients/new | patients.manage | Admission form with chart-matching sections (Overview, Vaccines, Medical conditions, Vets, Notes) |
GET /app/patients/:id | patients.read | Identity card + tabs (?tab=): Overview (profile, tags, parents, change history), Appointments, Vitals, SOAP, Diagnostic orders, Vaccines, Treatment plans, Medical conditions, Vets, Notes, History |
GET/PATCH /app/patients/:id/edit | patients.manage | Same tabbed sections as admission |
POST /app/patients/:id/invite | patients.manage | Email or SMS the parent an intake magic link |
GET/PATCH /intake/:token | Public (signed token, 48 h) | Parent-facing intake form; /intake/:token/thanks confirms |
Destroy is not offered. Disabled and deceased are timestamp flags. Cross-organization ids return 404. The History tab is the clinical timeline (visits, appointments, diagnostic orders and results); Overview and the client page end with a collapsed Change history (audits).
Patient intake link
Staff send a magic link (template patient_intake.invite, email or SMS) so the parent fills the patient form on their own device. The link is for one patient, signed, and valid 48 hours. Public intake pages do not offer the QR upload option.
Reading order
The chart is read in one pass. The identity card answers who is this animal (avatar, name, status badges, species). The vitals strip answers what is stable (age, sex, weight, primary parent with contact). The alert strip answers what needs attention now and only appears when there is something: expired vaccines (danger), vaccines expiring within 60 days (caution), caution tags, and recorded medical conditions. The list repeats those alerts in its attention column.
Colour carries meaning, never decoration: danger for expired, caution for due soon, success for verified or opted in, brand for identity, neutral for plain facts. This section defines the shared layout for the rest of the platform — see Architecture → Section design.
Appointments tab
Shown when the plan includes schedule and the Staff may read appointments at any granted Location. Upcoming: every stored booking not yet ended (all Locations) plus the next three dates of each active series; first 20 with Show all. Past: ended bookings, newest first. Rows at the current Location link to that day on the schedule.
Header search
The /app header typeahead (GET /app/search?q=, ClinicSearch) looks up patients and clients across the whole Organization, in Location or Organization workspace. It is not the roster ILIKE filter.
- Starts at 3 trimmed characters; at most 10 mixed hits ranked by accuracy, with a leftover count in the footer.
- Postgres FTS (
simpleconfig), word-start prefixes ("mar"matches Maria,"ari"does not). Three or more digits match anywhere in a phone number. - Patient rows: name · species/breed, primary parent contact. Client rows: name, email · phone · pet names. Disabled/deceased included.
- Requires
patients.read; otherwise the input is disabled. Appointments are a deferred source (patient, staff, rooms, status, appointment type name). - Mobile header search stays a placeholder until the API exposes it.
RBAC
Org admin, location admin, receptionist, and veterinarian may read and manage. Because charts are Organization-scoped, the action counts when held org-wide or at any granted Location, whichever workspace Location is selected.
Out of scope
Voice-to-text, two-way messaging, save draft, hard-deleting patients, customer portal.
Full acceptance: docs/functional/patients.md, search.md.