Back to docs
Livestock Module · Full Demo

Livestock Digital Twin — Demo Guide

A complete walkthrough of all 5 phases of the Livestock Module. Each section includes what to test, sample data to seed, and exact phrases to try with the AI Voice feature.

Before You Start

  1. 1.Sign up for an account if you don't have one
  2. 2.Subscribe to the Livestock Digital Twin module (start a 14-day free trial)
  3. 3.Visit /livestock and click Add Animal
  4. 4.If you have no farm yet, the inline farm setup wizard will appear first
Tip: Set the ANTHROPIC_API_KEY environment variable in your deployment for the AI Voice Records feature to work. Without it, you'll see a fallback message.

Phase 1

Edit/Delete + Photo Upload + Weight Tracking

The foundational CRUD lifecycle. Animals get visual identity through photos and trackable weight history.

What to test

1

Add an animal with a photo

Go to /livestock and click Add Animal.

The form opens with a photo upload at the top. Upload a JPG, PNG, or WebP (max 5MB).

Fill in: Name (e.g. Bella), Type (Cattle), Breed (Bonsmara), Sex (Female), Weight (480 kg), DOB (April 2022).

Click Add Animal. The photo appears on the herd list immediately.

2

Edit an existing animal

Click any animal to open its Digital Twin page.

In the top-right action bar, click the Edit button.

Change the name, breed, or upload a new photo. Click Save Changes.

3

Update weight

On the same Digital Twin page, click the Weight button.

Enter a new weight (e.g. 485 kg) and a date.

The form shows the change percentage from the previous weight.

Click Save Weight. This appends to the weight_history JSONB array.

4

Delete an animal

Click the red trash icon in the action bar.

Confirm the dialog. The animal is permanently removed and you're redirected back to the herd list.

Expected results

  • Photos appear on cards in /livestock herd list
  • Photos appear on the Digital Twin header (replaces the icon)
  • Age displays as "Xy Ym" format (e.g. "3y 2m")
  • Weight history persists and shows growth over time
  • Photos stored in Supabase Storage bucket animal-photos

Sample data — seed via Supabase SQL editor

sql
-- Sample herd: 1 mother (Bella), 1 father (Thor), and 2 calves
-- Replace YOUR_USER_ID with your actual user ID from the auth.users table
-- Replace YOUR_FARM_ID with your farm ID from the farms table

INSERT INTO animals (id, farm_id, user_id, name, animal_type, breed, sex, date_of_birth, weight_kg, status)
VALUES
  (gen_random_uuid(), 'YOUR_FARM_ID', 'YOUR_USER_ID', 'Bella',
   'cattle', 'Bonsmara', 'female', '2022-04-15', 480, 'healthy'),
  (gen_random_uuid(), 'YOUR_FARM_ID', 'YOUR_USER_ID', 'Thor',
   'cattle', 'Bonsmara', 'male', '2021-01-10', 720, 'healthy');

-- Then add the calves (after you have Bella and Thor's IDs):
-- INSERT INTO animals (farm_id, user_id, name, animal_type, breed, sex, date_of_birth, mother_id, father_id, weight_kg, status)
-- VALUES
--   ('YOUR_FARM_ID', 'YOUR_USER_ID', 'Daisy', 'cattle', 'Bonsmara', 'female',
--    '2024-09-20', BELLA_ID, THOR_ID, 95, 'healthy'),
--   ('YOUR_FARM_ID', 'YOUR_USER_ID', 'Buster', 'cattle', 'Bonsmara', 'male',
--    '2024-09-20', BELLA_ID, THOR_ID, 102, 'healthy');

Replace placeholders with your actual user_id (from auth.users) and farm_id (from farms).

Phase 2

AI Voice Records

Talk naturally — Claude AI parses your voice into structured records. The killer feature for hands-free use in the field.

What to test

1

Open the Voice Recorder

On any animal's Digital Twin page, click the purple Voice Record button in the action bar.

The browser will ask for microphone permission — allow it.

2

Tap the mic and speak

Click the large violet microphone button. It turns red and starts pulsing.

Speak clearly. Live transcript appears as you speak (with interim text in italic).

Click the red stop button when done.

3

Parse with AI

Click Parse with AI. Claude takes 2-3 seconds to extract structured events.

Each event appears in the review screen with all extracted fields.

Click Save All to commit the records.

Try these voice phrases

You say

"Bella had a fever today, I gave her terramycin, vet visit cost R450"

AI extracts

1 health event — type: illness, severity: medium, treatment: terramycin, vet_name: vet, cost: 450, date: today

You say

"Vaccinated her with brucellosis, two milliliters in the left neck"

AI extracts

1 vaccination — vaccine_name: Brucellosis, dosage: 2ml, site: left neck, date: today

You say

"Her weight is now 485 kilograms"

AI extracts

1 weight measurement — weight_kg: 485, date: today

You say

"AI breeding done today, expected calving in May"

AI extracts

1 breeding record — method: artificial_insemination, breeding_date: today, expected_due_date: May

You say

"Vaccinated her with brucellosis and her weight is now 485"

AI extracts

2 events — vaccination + weight measurement (Claude can extract multiple events from one utterance)

Browser support: Works best in Chrome, Edge, and Safari (macOS/iOS). Firefox doesn't support the Web Speech API but falls back to a manual text input. The AI parsing works in all browsers.

Phase 3

Vaccination Reminders + Dashboard Widget

Never miss a vaccination. The dashboard surfaces upcoming and overdue vaccinations front-and-center.

What to test

1

Add vaccinations with future due dates

On any Digital Twin page, click the Add Vaccination button.

Fill in vaccine name (e.g. Brucellosis), administered date, and most importantly — the next due date.

Repeat for a few vaccinations: one overdue (date in the past), one due this week, one upcoming.

2

Check the dashboard widget

Visit /dashboard.

In the left column, you'll see the new Vaccinations Due widget showing the next 5 upcoming vaccinations.

Color-coded urgency: red overdue · amber today · yellow this week · blue upcoming.

If any are overdue, the header shows an "X overdue" badge.

3

Open the full vaccinations page

Click View all in the widget, OR click Vaccinations in the livestock page header.

Visit /livestock/vaccinations.

5 status tabs: All / Overdue / Due This Week / Upcoming / Completed.

Search by animal name or vaccine, filter by animal type.

Sample data — overdue/due/upcoming mix

sql
-- Sample vaccinations to test the dashboard widget
-- Mix of overdue, due-this-week, and upcoming
-- Replace ANIMAL_ID and YOUR_USER_ID with real values

INSERT INTO vaccinations (animal_id, user_id, vaccine_name, administered_date, next_due_date, dosage)
VALUES
  -- OVERDUE (should show with red badge)
  ('ANIMAL_ID', 'YOUR_USER_ID', 'Brucellosis (RB51)',
   CURRENT_DATE - INTERVAL '180 days',
   CURRENT_DATE - INTERVAL '5 days', '2ml'),

  -- DUE THIS WEEK (should show with amber badge)
  ('ANIMAL_ID', 'YOUR_USER_ID', 'Blackleg',
   CURRENT_DATE - INTERVAL '90 days',
   CURRENT_DATE + INTERVAL '3 days', '5ml'),

  -- UPCOMING (should show with blue badge)
  ('ANIMAL_ID', 'YOUR_USER_ID', 'Anthrax',
   CURRENT_DATE - INTERVAL '60 days',
   CURRENT_DATE + INTERVAL '60 days', '1ml');
Tip: The widget only appears for users who have the Livestock module subscription. If you don't see it, check your subscription status in Settings → Billing.

Phase 4

Health Timeline View

A unified chronological feed of every event in an animal's life — health, vaccinations, breeding, and weight.

What to test

1

Open any animal's Digital Twin

The Timeline tab is now the FIRST and DEFAULT tab.

You'll see a vertical timeline with all events sorted newest-first.

2

Use the filter chips

At the top: All · Health · Vaccinations · Breeding · Weight chips.

Each shows a count badge. Click any to filter the timeline.

Empty types are greyed out and not clickable.

3

Expand event details

Each event card shows: type label, severity badge, title, subtitle, and dates.

Click Show details to expand into key/value pairs (treatment, medication, vet name, cost, etc).

4

Watch weight events appear automatically

Every entry in the weight_history JSONB array becomes a timeline event.

Each weight event shows the change delta: "+3.2 kg from previous" or "First weight recorded".

Color legend

Health Events
Vaccinations
Breeding
Weight

Sample data — populate the timeline

Health events:

sql
-- Sample health events to populate the timeline
INSERT INTO health_events (animal_id, user_id, event_type, title, severity, treatment, vet_name, cost, event_date)
VALUES
  ('ANIMAL_ID', 'YOUR_USER_ID', 'illness', 'Respiratory infection',
   'medium', 'Antibiotics — Terramycin LA, 5 days',
   'Dr. van der Merwe', 850, CURRENT_DATE - INTERVAL '14 days'),

  ('ANIMAL_ID', 'YOUR_USER_ID', 'checkup', 'Routine health check',
   'low', 'All vitals normal', 'Dr. Nkosi', 200,
   CURRENT_DATE - INTERVAL '60 days'),

  ('ANIMAL_ID', 'YOUR_USER_ID', 'injury', 'Hoof trim required',
   'low', 'Trimmed left front hoof', 'Self', 0,
   CURRENT_DATE - INTERVAL '45 days');

Weight history:

sql
-- Add weight history to see the timeline weight events
-- Updates the animal's weight_history JSONB array

UPDATE animals
SET weight_history = '[
  {"date": "2024-01-15", "weight_kg": 420},
  {"date": "2024-04-20", "weight_kg": 442},
  {"date": "2024-07-12", "weight_kg": 458},
  {"date": "2024-10-05", "weight_kg": 471},
  {"date": "2025-01-20", "weight_kg": 480}
]'::jsonb,
weight_kg = 480
WHERE id = 'ANIMAL_ID' AND user_id = 'YOUR_USER_ID';

Phase 5

Lineage Tree Visualization

Visualize family trees for breeding decisions. Walks ancestors up 3 generations and children one generation down.

What to test

1

Set up parent relationships

To see a meaningful lineage tree, you need animals with mother_id and/or father_id filled in.

The Edit Animal form doesn't expose these yet, so use the Supabase SQL editor to set them. See the SQL example below.

2

Open a child animal's Digital Twin

Visit any animal that has parents recorded.

Click the Lineage tab (with the Users icon).

The animal appears centered with a violet ring. Mother is upper-left, father upper-right.

3

Walk the tree

Click any ancestor to navigate to their Digital Twin page.

That ancestor becomes the new root, and you can see THEIR parents and children.

Hover any node for a scale + shadow effect.

4

Open a parent animal

Visit Bella's Digital Twin and click the Lineage tab.

Now you'll see Bella centered with her children (Daisy and Buster) below her.

Sex icons

Male
Female
?Unknown

Sample data — set up parent relationships

sql
-- Link Daisy and Buster to Bella (mother) and Thor (father)
-- First, get the IDs:
SELECT id, name FROM animals
WHERE name IN ('Bella', 'Thor', 'Daisy', 'Buster')
  AND user_id = 'YOUR_USER_ID';

-- Then update the calves with their parents:
UPDATE animals
SET mother_id = 'BELLA_ID', father_id = 'THOR_ID'
WHERE name IN ('Daisy', 'Buster')
  AND user_id = 'YOUR_USER_ID';

You've seen it all

The Livestock Digital Twin is a complete farm management workflow built on real Supabase data, IoT-ready architecture, and Claude AI. Every feature is production-quality and scales with your herd.

Reference: LIVESTOCK_ROADMAP.md · Built with Next.js 16, Supabase, Claude AI · POPIA-compliant