How bisman-singh/twiceheard works
Twiceheard is a clinic phone and browser voice-intake product. Its main workflow captures and reads back patient details, offers and books appointments, then reconstructs and checks the chart after the call before presenting it to clinic staff. The graph also includes the clinic desk, privacy controls, and the voice-platform integration. Relationships for unsampled modules are included only where the README or SOURCE INDEX supports them; source details beyond the supplied excerpts were not inspected.
Main entry points: handlers.ts Intake tool handlers · process.ts Post-call processing · record.ts Call records · deps.ts Server dependencies
Components 28
Calling
- Browser call UI
components/call/call-panel.tsx - Browser call session
lib/call/session-client.ts - Session API
app/api/voice/session/route.ts - AssemblyAI voice platform
- Tool relay
app/api/voice/tool/route.ts - Phone tool endpoint
app/api/tools/[clinicId]/[tool]/route.ts
Intake and booking
- Intake tool handlers
lib/tools/handlers.ts - Intake chart
lib/intake/chart.ts - Field normalization
lib/intake/fields.ts - Appointment slots
lib/scheduling/slots.ts - Medication lookup
lib/medication/rxnorm.ts
Post-call verification
- Call result API
app/api/call/result/route.ts - Post-call processing
lib/postcall/process.ts - Timeline replay
lib/postcall/replay.ts - Recording verification
lib/verify/hearing.ts - Chart grading
lib/intake/grade.ts
Clinic desk
- Clinic desk pages
app/desk/page.tsx - Call detail page
app/desk/calls/[sessionId]/page.tsx - Forget call API
app/api/call/forget/route.ts
Platform and services
- Intake store
lib/intake/store.ts - AssemblyAI transcription
lib/verify/transcribe.ts - Call records
lib/postcall/record.ts - Clinic configuration
lib/clinic/config.ts - Server dependencies
lib/server/deps.ts - Redis stores
lib/store/redis.ts - SMS messenger
lib/notify/sms.ts
Other components
- Caller
- Clinic staff
Connections 30
- Caller → Browser call UI: starts call
- Browser call UI → Browser call session: starts session
components/call/call-panel.tsx - Browser call session → AssemblyAI voice platform: streams audio
lib/call/session-client.ts - Session API → AssemblyAI voice platform: mints token
app/api/voice/session/route.ts - AssemblyAI voice platform → Tool relay: requests tools
- AssemblyAI voice platform → Phone tool endpoint: calls tools
- Tool relay → Intake tool handlers: dispatches tools
app/api/voice/tool/route.ts - Phone tool endpoint → Intake tool handlers: dispatches tools
app/api/tools/[clinicId]/[tool]/route.ts - Intake tool handlers → Intake chart: saves fields
lib/tools/handlers.ts - Intake chart → Field normalization: normalizes values
lib/intake/chart.ts - Intake tool handlers → Intake store: loads and saves
lib/tools/handlers.ts - Intake tool handlers → Appointment slots: offers slots
lib/tools/handlers.ts - Intake tool handlers → Medication lookup: checks medication
lib/tools/handlers.ts - Intake tool handlers → Clinic configuration: uses clinic details
lib/tools/handlers.ts - Caller → Call result API: requests chart
- Call result API → Post-call processing: processes session
app/api/call/result/route.ts - Post-call processing → Timeline replay: replays timeline
- Post-call processing → Recording verification: checks recording
- Recording verification → AssemblyAI transcription: transcribes audio
- Post-call processing → Chart grading: grades chart
- Post-call processing → Call records: stores result
app/api/call/result/route.ts - Clinic staff → Clinic desk pages: opens desk
- Clinic desk pages → Call records: lists calls
app/desk/page.tsx - Clinic desk pages → Call detail page: opens chart
app/desk/calls/[sessionId]/page.tsx - Clinic staff → Forget call API: requests erasure
- Forget call API → Call records: removes record
app/api/call/forget/route.ts - Server dependencies → Intake store: configures store
lib/server/deps.ts - Server dependencies → Call records: configures store
lib/server/deps.ts - Server dependencies → Redis stores: selects Redis
lib/server/deps.ts - Intake tool handlers → SMS messenger: sends confirmation
lib/tools/handlers.ts