Lesson 3: Data Flow (DFD)
Goal of this lesson
Name the 8 processes and the data stores, and trace a request through the DFD from start to finish.
DFD basics
A Data Flow Diagram shows how data moves, not the order code runs in.
| Symbol | Meaning | LAFINA examples |
|---|---|---|
| External entity | Outside the system, sends or receives data | Student, DeepSeek, Pinecone, ElevenLabs |
| Process (numbered) | Transforms data | 4.0 Answer questions and review actions |
| Data store (D#) | Data at rest | D2 Personal records + sync |
| Arrow | Named data moving | ”Confirmed, validated planner mutations” |
Level 0 (the context diagram, Lesson 1) is one process. Level 1 breaks it into 8 processes.
The 8 processes
| # | Process | What it does |
|---|---|---|
| 1.0 | Manage accounts and preferences | Guest or cloud account, sign-in, profile and voice settings |
| 2.0 | Manage personal plans and notes | Validates and saves planner changes. Record + queued sync change share one SQLite transaction |
| 3.0 | Import / export academic schedules | COR text or OCR, .ics parsing, review before import writes |
| 4.0 | Answer questions and review actions | Rules or a local model for intents, DeepSeek and handbook RAG, student confirmation before writes, Memory |
| 5.0 | Deliver alarms and reminder calls | AlarmManager and recovery, simulated call UI. Acknowledging is not completing the task |
| 6.0 | Synchronize personal account records | Sends the outbox, applies remote changes, tracks conflicts and cursors |
| 7.0 | Recognize speech and provide voice | Whisper + Silero VAD, phone TTS, backend TTS, signed live-voice session |
| 8.0 | Create documents and process recordings | Recording plus local transcription. The backend generates documents and notes |
The data stores
| Store | Contents | Where |
|---|---|---|
| D1 Local identity / settings | Users, session, preferences, local settings | SQLite on the phone |
| D2 Personal records + sync | The 7 core entity types, outbox, sync metadata, conflicts | SQLite on the phone |
| D3 Chat / personal memory | Chat sessions, messages, memories | SQLite on the phone |
| D4 Local handbook | Handbook pack, chunks, FTS5 index | SQLite on the phone |
| D5 Local alarms / delivery | Alarm clocks, delivery jobs, delivery history | SQLite on the phone |
| D6 Local files / metadata | Import batches, recordings, attachments, generated files | Device files + SQLite |
| D7 Cloud database | Accounts, synced records, usage and quota | Neon PostgreSQL |
Two DFD versions
The README version of the DFD groups the stores slightly differently (D1–D6, with D6 as the cloud). The official image below uses D1–D7. The ideas are the same: D1–D6 are on the device, and the last one is the cloud.
Trace 1: “Remind me to submit my lab report tomorrow at 5 PM”
E1 Student → 7.0 Speech Voice becomes text (Whisper)
7.0 → 4.0 Answer & review Transcript in. Intent = create_reminder
4.0 → Student Proposed change shown as a review card
Student → 4.0 → 2.0 Confirmation, then validated planner mutation
2.0 → D2 Reminder row + outbox entry, one transaction
5.0 reads D2 → Android OS Alarm registration for tomorrow 5 PM
Trace 2: the reminder rings
Android OS → 5.0 Due trigger
5.0 → Student Simulated call. 7.0 speaks the reminder
Student → 5.0 "Give me ten minutes" (via 7.0 transcription)
5.0 → D5 and D2 Delivery outcome + snoozed reminder + queued sync change
6.0 → D7 Later, when signed in and online
Check yourself
- What is the difference between a process and a data store?
- Which process enforces “review before write” for imports? For assistant changes?
- Which store holds the outbox? Which one is in the cloud?
- Trace “What’s on my schedule today?” through the DFD. (Hint: 4.0 reads D2 and never goes to 2.0.)
- Why does 2.0 write the record and the sync change in the same transaction?