MongoDB Atlas:
- Accessed through Motor (AsyncIOMotorClient), so every DB call is async/await and non-blocking under FastAPI
- Single process-wide client, created lazily on first use
- Importing the app (CI, unit tests, type-checks) never requires a live database
- Connection configured via pydantic-settings
Collections:
- people - one document per person you've met: local_id, avatar_params (6 sprite axes), face_embedding (512-d), voice_embedding, tags, favorite, first/last-seen
- events - an append-only interaction log; each row is a person seen or a line spoke, carrying ts, person_id, day_id, text
Deterministic identity:
- People are keyed by local_id (the stable, edge-assigned identity from the Pi)
- The same face → the same _id → one document, forever
- Re-seeing someone is an upsert-by-key (replace_one(..., upsert=True)), not a duplicate
- Days keyed by ISO date (2026-07-19), recaps keyed by ":", wearer-voice keyed by the literal "you"
- Events are append-only with a random uuid4 _id
Architecture:
- A typed repository layer wraps Motor: every method returns Pydantic models, never raw BSON, with _id ↔ id mapping isolated in one base class
- All four workstreams evolve the shape together without migrations.
- Privacy by construction: only derived data is ever persisted
- Sprite params, embeddings, transcript text
- No raw photos, video, or audio ever touch the database for security
Log in or sign up for Devpost to join the conversation.