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.

SymbolMeaningLAFINA examples
External entityOutside the system, sends or receives dataStudent, DeepSeek, Pinecone, ElevenLabs
Process (numbered)Transforms data4.0 Answer questions and review actions
Data store (D#)Data at restD2 Personal records + sync
ArrowNamed 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

#ProcessWhat it does
1.0Manage accounts and preferencesGuest or cloud account, sign-in, profile and voice settings
2.0Manage personal plans and notesValidates and saves planner changes. Record + queued sync change share one SQLite transaction
3.0Import / export academic schedulesCOR text or OCR, .ics parsing, review before import writes
4.0Answer questions and review actionsRules or a local model for intents, DeepSeek and handbook RAG, student confirmation before writes, Memory
5.0Deliver alarms and reminder callsAlarmManager and recovery, simulated call UI. Acknowledging is not completing the task
6.0Synchronize personal account recordsSends the outbox, applies remote changes, tracks conflicts and cursors
7.0Recognize speech and provide voiceWhisper + Silero VAD, phone TTS, backend TTS, signed live-voice session
8.0Create documents and process recordingsRecording plus local transcription. The backend generates documents and notes

The data stores

StoreContentsWhere
D1 Local identity / settingsUsers, session, preferences, local settingsSQLite on the phone
D2 Personal records + syncThe 7 core entity types, outbox, sync metadata, conflictsSQLite on the phone
D3 Chat / personal memoryChat sessions, messages, memoriesSQLite on the phone
D4 Local handbookHandbook pack, chunks, FTS5 indexSQLite on the phone
D5 Local alarms / deliveryAlarm clocks, delivery jobs, delivery historySQLite on the phone
D6 Local files / metadataImport batches, recordings, attachments, generated filesDevice files + SQLite
D7 Cloud databaseAccounts, synced records, usage and quotaNeon 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.

LAFINA Level 1 data flow diagram
Official Level 1 DFD: 8 processes with their external entities and data stores. Open full size ↗

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?