# Interview: PetCare (Smart Multi-Pet Scheduler)

**Role:** Intermediate Developer (3–4 yr Android → Web)
**Mockup:** `petcare-mockup.html`
**Duration:** ~60 min

---

## Setup (5 min)

Show mockup. Say:

> "This is a smart multi-pet care scheduler. A household with multiple pets manages feeding, medication, walks, and health tracking in one dashboard. There's an AI advisor for health questions and a pet sitter mode. You need to build this as a web application. Let's talk through the design."

---

## Part 1: Sub-system Decomposition (15 min)

> **"How would you break PetCare into sub-systems or services? Walk me through the architecture."**

### What they should surface:

| Sub-system | Key Responsibility |
|------------|-------------------|
| **Scheduling Engine** | Recurrence rule evaluation, task instance generation, overdue detection, snooze logic. Core complexity — harder than meal planner |
| **Pet Profile Service** | CRUD per pet, species-specific fields, medical history, weight tracking |
| **Care Task Service** | Task definitions (template with recurrence), per-pet dosing, supply tracking |
| **Health Records Service** | Vet visits, vaccinations, weight history, photo attachments |
| **Notification Service** | Push reminders at task time, overdue escalation (yellow → red), sitter notifications |
| **Sitter Access Service** | Token generation, expiry, access scope enforcement, audit log |
| **AI Advisor Service** | Symptom triage, care suggestion, health scan analysis. Thin orchestration layer over LLM API |
| **Inventory Service** | Food, medication, supply tracking — auto-refill detection |

### Push deeper:

> **"The scheduling engine needs to handle 'insulin every 12 hours' AND 'heartworm pill first Monday of every month' AND 'walk twice a day but skip if raining.' How do you model recurrence rules?"**

Look for: RRULE / iCalendar format awareness, exception handling, timezone sensitivity (insulin time doesn't shift with DST). Strong candidate will say "use a library" but also describe data model and querying: pre-generate instances for near future or compute on-the-fly with a cron-like evaluator.

> **"Where do overdue calculations live — are they computed on read or persisted as state?"**

Good answers: persisted as state (status field on TaskInstance), updated by a lightweight tick. Read-time computation works for small scale but breaks with 50+/day tasks per household. Offline editing complicates read-time evaluation.

---

## Part 2: Identify System Challenges (12 min)

> **"Pick two sub-systems. What's the hardest technical challenge in each — the one that could fail in production?"**

### Key challenges to surface:

**Challenge: Recurrence engine at scale**
- Pre-generate task instances for N days ahead, or compute on-the-fly and cache?
- If pre-generate: how far ahead? 7 days? 30 days? What happens when user changes recurrence — retroactive or forward-only? Re-generate all future instances or diff?
- Exception rules compound: "Every day except vet days" → recurrence + exception set
- If on-the-fly: query for a date range involves iterating rules × pets — slow at 1000+ households

**Challenge: Overdue detection with offline users**
- User marks "done" offline at 8am. Another user's device shows it overdue until sync completes.
- Conflict: user A marks done offline at 8am, user B marks overdue and re-snoozes at 8:05. Sync at 8:10 — whose state wins?
- Good answer: last-write-wins with activity log for audit. Or: task goes to "completed" only when both agree (problematic for sitter handoff)

**Challenge: Multi-species care normalization**
- Dog feeding: 2 cups kibble, twice daily. Cat: ½ can wet food + dry available all day. Rabbit: unlimited hay + daily veg + water change.
- How does one data model represent these? Species-specific templates with a common "care action" abstraction layer?

**Challenge: Sitter access security**
- Share link → anyone with URL can access household schedule. URL shared in WhatsApp → leaks. PIN adds friction.
- JWT in URL parameter = logged in server logs, referer headers. Good: hash fragment (#) or magic link flow (one-time token, server-side validation + immediate invalidation on use).
- Expiry must be server-enforced, not client-only.

**Challenge: AI health scanner liability**
- Photo shows a lump. AI says "likely benign." User delays vet visit. Turns out malignant.
- Who is liable? How to disclaim without undermining trust?
- Good answer: clear UI disclaimers, hard fallback thresholds (AI never says "diagnosis"), language matching urgency to recommend vet visit. Vet referral gate at certain confidence levels.

### Push for opinion:

> **"If you have limited engineering resources, which challenge do you solve first — the recurrence engine or the sitter access security?"**

Look for: trade-off reasoning, not just "both." Good candidate weighs: security defect = trust/reputation damage, recurrence defect = poor UX. Recurrence is harder to retrofit. Security is easier to bolt on but harder to fix after a breach.

---

## Part 3: Coding Agent / AI Best Practices (10 min)

(Same structure as MealPlan — re-use for consistency. Ask again if they gave different answers in MealPlan interview. Note: if this is a separate interview with different candidate, use standalone.)

> **"Let's talk about using AI coding tools to build PetCare. What's your approach?"**

### Watch for:

**Patterns that carry over from MealPlan OR show new depth:**
- AI for generating test fixtures for the recurrence engine (date math edge cases = great AI task)
- AI for writing the RRULE parser wrapper (well-defined input/output = great AI task)
- AI for generating the token-validation middleware for sitter access (security-critical → human review mandatory)
- AI for generating UI components across 3 pet types (good — repetitive patterns)
- AI for nutrition/medication dose calculations (bad — high-risk numeric logic, hallucinations matter)

**PetCare-specific AI best practices:**
- AI-written sitter token generation → MUST reseed RNG properly. Common AI mistake: `Math.random()` for security tokens
- AI-written overdue logic → date math across timezone boundaries. Timezone-naive code is very common AI mistake
- AI for CRUD boilerplate across 8 entities → good. High leverage, low risk.
- AI for health record schema → review carefully. Labelling fields incorrectly (e.g. "last_vaccination" vs "next_due") is common.

### If they haven't used coding agents:

> **"Your teammate generated the sitter access middleware with Claude Code. As reviewer, what do you inspect?"**

Look for: token randomness quality, expiry enforcement (server-side, not trusting client claims), rate limiting, audit logging, revoked token check.

---

## Part 4: Building an AI Feature (15 min)

> **"Design the Health Scanner AI feature. User takes a photo of their pet's skin/eye/ear issue. System helps assess urgency. Walk me through UX, model, data flow, error handling."**

### UX Layer:

- **Entry:** button "Scan Health Issue" in health records or AI sidebar. Camera opens in-app (not system camera, to add guidance overlay).
- **Guidance overlay:** frame the affected area, good lighting icon, hold steady. Close-up guide.
- **Processing states:**
  1. "Analyzing photo..." (0–3s)
  2. "Checking for known patterns..." (3–6s)
  3. Results appear incrementally: detected features first, then assessment, then care steps
- **Confidence UX:**
  - High confidence item → displayed directly with green checkmark
  - Medium → yellow badge, "likely" language
  - Low → "I'm not sure — here's what it could be" with list
- **Result card:** photo thumbnail + detected condition name + description + urgency level (routine/watch/vet-visit/emergency) + care steps + "When to see a vet" section
- **Actions:** Save to health records, set follow-up reminder, share with vet (download/email summary)
- **Fallbacks:**
  - Dark/blurry photo → "Please retake with better lighting"
  - Partial obstruction (fur blocking) → "I can only see part of the area — try parting the fur"
  - No match → "I can't identify this. When in doubt, consult your vet." + option for human remote vet consultation (v2)
  - Network failure → "Can't process photo right now. Save draft and try again later."

### System Architecture:

```
┌─────────────────────────────────────────────┐
│  [Camera] → Image Compressor (max 4MB)       │
│       ↓                                      │
│  Moderation Check (NSFW / gore filter)       │
│       ↓                                      │
│  Multimodal LLM (Claude Vision / GPT-4o)     │
│  Prompt: "Describe the skin condition shown  │
│  in this pet photo. Be specific about        │
│  appearance, location, severity indicators.  │
│  DO NOT give a diagnosis."                   │
│       ↓                                      │
│  Structured Output Extraction                │
│  {features[], suggested_conditions[],        │
│   urgency, confidence, care_steps[]}         │
│       ↓                                      │
│  Post-processing:                            │
│  - Urgency classifier override (safety net)  │
│  - Disclaimers injected                      │
│  - Vet threshold check → referral prompt     │
│       ↓                                      │
│  UI rendering                                │
└─────────────────────────────────────────────┘
```

### Key considerations they should surface:

1. **Model choice:** Multimodal LLM over fine-tuned CNN. More flexible, handles wide variation (species × body part × lighting × breed). Cost per scan is the trade-off.
2. **Image moderation:** Pet photos shouldn't need NSFW filter, but zoomed-in skin issues can look medical/graphic. A filter prevents edge cases from reaching the model.
3. **Structured output:** Don't let LLM free-text the diagnosis. Use schema-enforced output (tool use / function calling) to get consistent fields for UI rendering and safety checks.
4. **Safety net layer:** AI says "likely allergy." But image matches "ringworm (fungal)" with 30% confidence — urgency classifier should still flag it "recommend vet" even if primary suggestion is low-urgency.
5. **Fallback escalation path:** System fails at photo analysis → offer text symptom input instead. "Tell me what you see — redness? swelling? discharge? how long?"
6. **Compliance:** Veterinary telemedicine regulations vary by jurisdiction. Features that recommend treatment may be regulated. Must consult legal before rolling out.
7. **Feedback loop:** "Was this helpful?" after each scan → used to improve prompts, not retrain model. Track: accepted vs dismissed suggestions, follow-up visits.
8. **Bias across species:** Model trained mainly on dog/cat photos → rabbit/guinea pig skin issues may perform worse. Need per-species confidence calibration.

### Edge case test:

> **"User takes photo of their cat. AI says 'likely allergic dermatitis.' They skip the vet. Two weeks later it's worse. Who is at fault?"**

Strong: "The app needs to communicate this is not a diagnosis — it's a triage tool. Language matters: 'consistent with allergic dermatitis. See your vet for diagnosis.' Hard fallback thresholds ensure ambiguous or high-urgency cases default to vet recommendation. The photo result screen must not look like a medical report — it should look like a preliminary assessment with prominent referral call-to-action."

---

## Part 5: UI/UX Critique (if time, 5 min)

> **"Look at the mockup again. What would you change?"**

### What to look for:

- **Multi-pet filter clarity:** Pet tabs filter schedule but leave health panel showing Cooper's data when Luna is selected — this is inconsistent
- **Notification overload:** 3 pets × 8 tasks = 24 notifications/day. Need quiet hours, per-pet notification toggle, or batch summary
- **Timeline density:** When all 3 pets in one timeline, rows are dense. Some tasks are per-pet, some shared. How to visually distinguish?
- **Task grouping:** "Breakfast — Cooper & Luna" is grouped in mockup but "Luna's insulin" is separate. Is the grouping deterministic or user-configurable?
- **Missing sitter view:** No mockup of what sitter sees — important to show simplified interface
- **Overdue vs upcoming visual distinction:** Overdue tasks (red) and upcoming (blue) are clearly different, but what about late-night tasks? Dark mode consideration?
- **Empty state:** First-time user adds pet → empty timeline? Could show sample schedule to demonstrate value
- **Accessibility:** Timeline uses color-only urgency (red/yellow/green). Colorblind users need patterns or text labels.

---

## Scoring Rubric

| Area | Minimum (Hire Signal) | Strong (Accelerate Signal) |
|------|----------------------|---------------------------|
| Decomposition | 4+ sub-systems with clear boundaries, mentions scheduling complexity | 7+, explains data flow between services, describes pre-generate vs compute-on-fly tradeoff for recurrence |
| Challenges | 2+ challenges with plausible approach | Identifies recurrence engine pre-generation vs on-fly, sitter token expiry enforcement, multi-species normalization |
| Coding Agent | Has used AI tools, reviews output, describes specific practice | Articulates "danger zones" (security tokens, timezone math, numeric logic), tests AI-generated code differently by domain risk |
| AI Feature | End-to-end flow with UX states, model choice, disclaimers | Mentions moderation gate, structured output extraction, safety net layer, species bias, compliance, feedback loop |
| UI/UX Sense | 2+ improvements with rationale | Spots inconsistency (pet filter doesn't change health panel), notification overload, sitter view absence, accessibility gaps |

---

## Decision Flow

```
Can they design?     → Part 1 & 2  → ≥4 sub-systems + 2 challenges with depth
Can they build?      → Part 4     → full flow with safety and fallback layers
Can they use AI?     → Part 3     → specific practices, risk-aware
Can they design UX?  → All parts  → do they surface multi-pet complexity without prompting?

Hire if at least 3/4 "minimum" with 1 "strong."
Strong hire if 3+/4 "strong."
```
