Week 8/40 — CatAtlas: Identity Layer + Tests

Tech stack (this week)

  • Backend: FastAPI + SQLite + schema evolution

  • Testing: pytest + FastAPI TestClient

  • Frontend: React + TypeScript

  • “GenAI-style”: aggregation + templating for cat profiles

New topic: separating observations from identity + adding tests.

Why this week?

To make CatAtlas scalable, I needed “cats” as entities — not just sightings — and I wanted guardrails (tests) so I can evolve safely.

What I shipped

  • Added a cats table (identity) separate from sightings (facts)

  • Sightings can optionally link to a cat

  • Photo support via photo URLs (for now)

  • A generated “cat profile” that aggregates multiple sightings

  • First automated tests with pytest + TestClient

The One Feature Rule

One feature: identity layer + tests (foundation upgrade).
Not doing: real photo uploads, vision matching, complicated UI flows.

What I learned

A lot of “GenAI features” start as aggregation + structured templates, not magic models. And tests make iteration less scary.

Follow along (code it yourself): This week’s task

Task: Separate “observations” from “identity” and add your first tests.

  1. Add a cats table (identity).

  2. Add cat_id to sightings (nullable).

  3. Build two endpoints (keep boundaries clean):

    • POST /cats (create identity)

    • POST /sightings/{id}/assign (assignment happens after creation)

  4. Add a “cat profile” endpoint that aggregates sightings into a readable summary.

  5. Write 2 tests:

    • creating a cat works

    • assigning a sighting updates cat_id

Success criteria: You can create a cat, assign a sighting, and tests pass.

Extra help & hints

  • This is a key AI-engineering pattern: entities vs events.

  • Keep tests integration-style: call the real API with a temporary DB.

  • If tests break due to schema changes: that’s the point—tests protect your iteration speed.

Previous
Previous

Week 09/40: CatAtlas Insight Engine

Next
Next

Week 7/40 — CatAtlas: Same-Cat Matching v0