Patients
3 min
Same split as Clients: pet is the full demographic record, patients is the clinic-specific record (with the physical patient number). See Database Overview for the general pattern.
pet — demographic record
- nickname = patient name
- species_id → species.id, breed_id → breeds.id (doc previously had breed_is, which isn't a real column — it's breed_id)
- blood_type_id → blood_types.id
- birthday, birthday_estimated, gender, chip_number, weight, weight_unit_id, allergies
- merged_into_pet_id — set when duplicate pet records get merged; filter on this if you need to avoid counting merged-away records
- deleted_at — standard soft delete
patients — clinic-specific record
- pet_id → pet.id
- clinic_id → clinics.id
- number — the Digitail patient number used on physical records/labels
- archived_at — not previously documented; distinct from deleted_at on pet — a patient can be archived at one clinic without the underlying pet record being deleted globally
userpetmapping — client-to-patient relationship
- user_id → users.id
- pet_id → pet.id
vetpetmapping vs vetpetarchive
Two different things with similar names:
- vetpetmapping — active vet-to-pet assignment (pet_id, vet_id, clinic_id)
- vetpetarchive — records why a pet left active care: archive_type_id — 1 = deceased, 2 = moved away, 3 = changed owner, 4 = other, plus a free-text reason
Use vetpetarchive to build an "active vs. inactive patient" filter rather than relying on pet.deleted_at, since a pet can be archived (deceased, moved, transferred) without the record itself being deleted.
Reference tables
- species — id, name (plus per-locale name columns), joins from pet.species_id
- breeds — id, name, species_id, joins from pet.breed_id
- blood_types — id, species_id, blood_type, joins from pet.blood_type_id
All three are global reference tables, not client-prefixed.