How tejasrp24/dbms_proj_backend works
Purpose and entry points
AG-OS is a cognitive-memory assistant for users with short-term memory loss. It combines camera-based face recognition, recorded-audio transcription, LLM-generated interaction summaries, persistent memory, and reminders/calendar data. The documented production API entry point is app/services/face_recognition/main.py; an alternate/duplicated backend layout also exposes backend/app/main.py. The React/Vite client starts at frontend/src/main.jsx and renders frontend/src/App.jsx.
HTTP/API boundary
FastAPI routes organize the core domain API: people, caregivers, sessions, interactions, memory, notes, emotions, audio, and calendar events. Route handlers validate request/response payloads through schemas and delegate domain work to services. Key paths: app/api/routes/persons.py, app/api/routes/interactions.py, app/api/routes/memory.py, app/schemas/interaction.py.
Persistence and domain model
PostgreSQL is the system of record, configured through application database/session modules. SQLAlchemy-style domain models represent users, known persons, caregivers, conversations, face encodings, notes, emotional records, and calendar events; association tables encode relationships. Paths: app/db/session.py, app/models/person.py, app/models/conversation.py, app/models/junction_tables.py. A separate SQL schema exists at database/schema.sql, indicating possible legacy/direct-SQL persistence alongside the ORM-oriented structure.
Recognition and interaction pipeline
The primary assistant flow is camera input → face detection/recognition → person identity or unknown-person handling → interaction creation and memory context. Recognition is isolated behind the face-recognition service and controllers, using bundled OpenCV/Caffe and YOLO assets. Paths: app/services/face_recognition/main.py, app/services/face_recognition/face_service.py, app/controllers/face_controller.py, app/models/face_encoding.py. Material ML assets include yolov8n.pt, deploy.prototxt, and res10_300x300_ssd_iter_140000.caffemodel.
Audio, transcription, and summarization
Audio endpoints/controllers accept or manage recordings, then invoke Whisper/faster-whisper transcription. Interaction and conversation services combine transcripts, recognized-person context, and stored memory; the LLM layer produces summaries or assistant output. Paths: app/api/routes/audio.py, app/controllers/audio_controller.py, app/services/whisper_service.py, app/services/conversation_summarizer.py, app/services/llm_service.py. LLM providers are runtime-selectable: Groq by default, with OpenAI and local Ollama options.
Memory and care workflows
Dedicated services maintain long-lived memory, notes, emotional observations, caregiver relationships, and calendar events. This separates medical/care context from transient recognition and transcription requests. Paths: app/services/memory_service.py, app/services/note_service.py, app/services/emotion_service.py, app/services/caregiver_service.py, app/services/calendar_service.py.
Reminders, scheduling, and external integrations
APScheduler supports scheduled application work, while a Celery-oriented reminders subsystem provides asynchronous reminder tasks. Google Calendar and Google Tasks integrations form an external authorization/API boundary. Paths: app/core/scheduler.py, app/ai_models/reminders/tasks.py, app/ai_models/reminders/celery_config.py, app/services/google_calendar.py, app/services/google_tasks.py.
Runtime and repository shape
The intended runtime is Python 3.11/FastAPI on port 8004 plus a Node 18 React/Vite frontend on port 5173; Docker support is rooted at Dockerfile. PostgreSQL may be local or Neon-hosted. The repository contains overlapping app/ and backend/app/ implementations; use the README’s app/services/face_recognition/main.py entry point unless deployment wiring explicitly targets backend/run.py.
Main entry points: interactions.py Domain routes · memory_service.py Care services · conversation_summarizer.py Conversation AI · main.py Production API entry
Components 20
Client
- React/Vite client
frontend/src/main.jsx - App UI
frontend/src/App.jsx
FastAPI application
- Production API entry · Documented production server entry point.
app/services/face_recognition/main.py - Alternate backend · Overlapping backend implementation.
backend/app/main.py - Domain routes · People, sessions, interactions, memory, audio, and calendar APIs.
app/api/routes/interactions.py - Audio routes
app/api/routes/audio.py - Interaction schemas
app/schemas/interaction.py
Recognition & AI
- Face controller
app/controllers/face_controller.py - Face recognition · Detects and recognizes faces using bundled ML assets.
app/services/face_recognition/face_service.py - Face encodings
app/models/face_encoding.py - Audio controller
app/controllers/audio_controller.py - Transcription
app/services/whisper_service.py - Conversation AI · Combines transcript, identity, and memory context.
app/services/conversation_summarizer.py - LLM providers · Selects Groq, OpenAI, or local Ollama at runtime.
app/services/llm_service.py
Memory & care
- Care services · Maintains memory, notes, emotions, caregivers, and events.
app/services/memory_service.py - PostgreSQL · Stores ORM domain records and relationships.
app/db/session.py - Domain models · People, conversations, and relationship associations.
app/models/person.py
Scheduling & integrations
- Scheduler
app/core/scheduler.py - Reminder workers
app/ai_models/reminders/tasks.py - Google integrations · External authorization and calendar/task boundary.
app/services/google_calendar.py
Connections 22
- React/Vite client → App UI: renders
- App UI → Production API entry: HTTP API
- Production API entry → Domain routes: serves
- Production API entry → Audio routes: serves
- Alternate backend → Domain routes: alternate layout
- Domain routes → Interaction schemas: validates
- Domain routes → Face controller: recognition requests
- Face controller → Face recognition: detects and identifies
- Face recognition → Face encodings: matches
- Audio routes → Audio controller: recordings
- Audio controller → Transcription: transcribes
- Transcription → Conversation AI: transcript
- Face controller → Conversation AI: person context
- Conversation AI → LLM providers: generates summary
- Domain routes → Care services: care operations
- Care services → PostgreSQL: persists
- Domain models → PostgreSQL: maps records
- Face encodings → PostgreSQL: stored in
- Conversation AI → Care services: memory context
- Scheduler → Reminder workers: triggers
- Reminder workers → Care services: reads reminders
- Care services → Google integrations: syncs events