How praveenkumar-dev-art/gemma-4-competition works
Purpose and entry points
Sanjeevani is a multilingual, voice-first rural-health triage application. The primary web entry is sanjeevani-app/src/main.jsx, which mounts sanjeevani-app/src/App.jsx. It is built as a React/Vite PWA and can be packaged into Android through Capacitor; the Android host starts at sanjeevani-app/android/app/src/main/java/com/sanjeevani/triage/MainActivity.java.
Application shell and safety UI
App.jsx composes the user journey and persistent safety surfaces: disclaimer, header, intake, chat/triage, emergency handling, and reports.
• sanjeevani-app/src/App.jsx
• sanjeevani-app/src/components/Disclaimer.jsx
• sanjeevani-app/src/components/EmergencyModal.jsx
The emergency UI is a control boundary: RED triage escalates to a blocking 108-call overlay rather than normal conversational continuation.
Patient intake and interaction layer
The app collects patient demographics, selected language, and symptom conversation before or during triage. Voice-oriented interaction is implemented in dedicated UI components, while chat renders bilingual clinical guidance.
• sanjeevani-app/src/components/PatientIntakeWizard.jsx
• sanjeevani-app/src/components/VoiceWidget.jsx
• sanjeevani-app/src/components/ChatContainer.jsx
Input crosses from browser/device interaction into shared clinical state; the design supports Tamil, Malayalam, Telugu, Hindi, and English.
Triage state and agentic memory
TriageContext is the central client-side state boundary. It accumulates patient and conversation information across turns, including the documented Patient, Rough, Clean, and concentrated-question memory pages. UI components consume this shared state rather than independently determining care urgency.
• sanjeevani-app/src/context/TriageContext.jsx
• sanjeevani-app/src/components/TriagePanel.jsx
Clinical reasoning pipeline and offline fallback
Clinical logic applies SOCRATES-guided questioning, a symptom ontology, and WHO-aligned severity classification. This local engine is the continuity path when no model API key or network is available; it should remain independent from remote inference.
• sanjeevani-app/src/scripts/clinicalAgent/index.js
• sanjeevani-app/src/scripts/clinicalAgent/clinicalReasoningEngine.js
• sanjeevani-app/src/scripts/clinicalAgent/symptomOntology.js
The outcome controls three principal routes: RED emergency escalation, YELLOW clinic referral, and GREEN self-care guidance.
Remote Gemma inference boundary
Prompt construction and model access are separated from the UI and deterministic clinical fallback. Prompt templates constrain multilingual SOCRATES dialogue and structured output; the service calls Google’s Gemini API for Gemma-compatible model responses, configured through Vite environment variables.
• sanjeevani-app/src/scripts/clinicalAgent/doctorPrompts.js
• sanjeevani-app/src/services/gemmaService.js
Remote output must be interpreted into application triage state, not treated as unbounded presentation content.
Care routing, reports, and external runtime services
Triage results drive clinic discovery/referral, patient-facing triage panels, and a dual report/pass surface. Mock/local data supports development or offline scenarios.
• sanjeevani-app/src/components/ClinicLocator.jsx
• sanjeevani-app/src/components/TriagePass.jsx
• sanjeevani-app/src/data/mockData.js
A separate Node HTTP runtime provides /api/tts audio support on port 3001: sanjeevani-app/server.js. Web builds use Vite (sanjeevani-app/vite.config.js); Android packaging uses Capacitor (sanjeevani-app/capacitor.config.json and sanjeevani-app/android/). CI runs through .github/workflows/ci.yml.
Main entry points: TriageContext.jsx Triage state and memory · App.jsx Application shell · index.js Clinical agent · ChatContainer.jsx Bilingual chat
Components 19
React PWA
- Web entry
sanjeevani-app/src/main.jsx - Application shell · Composes the care journey and persistent safety UI.
sanjeevani-app/src/App.jsx - Patient intake
sanjeevani-app/src/components/PatientIntakeWizard.jsx - Voice interaction
sanjeevani-app/src/components/VoiceWidget.jsx - Bilingual chat
sanjeevani-app/src/components/ChatContainer.jsx - Triage state and memory · Holds patient, conversation, and multi-page agent memory.
sanjeevani-app/src/context/TriageContext.jsx - Triage panel
sanjeevani-app/src/components/TriagePanel.jsx - 108 emergency overlay · Blocks normal conversation for RED outcomes.
sanjeevani-app/src/components/EmergencyModal.jsx - Clinic referral
sanjeevani-app/src/components/ClinicLocator.jsx - Triage report/pass
sanjeevani-app/src/components/TriagePass.jsx - Offline mock data
sanjeevani-app/src/data/mockData.js
Clinical decisioning
- Clinical agent
sanjeevani-app/src/scripts/clinicalAgent/index.js - Offline reasoning engine · SOCRATES and WHO-aligned classification continuity path.
sanjeevani-app/src/scripts/clinicalAgent/clinicalReasoningEngine.js - Symptom ontology
sanjeevani-app/src/scripts/clinicalAgent/symptomOntology.js - Clinical prompts · Constrains multilingual dialogue and structured output.
sanjeevani-app/src/scripts/clinicalAgent/doctorPrompts.js
External services
- Gemma inference service · Calls Gemini API and interprets model output into triage state.
sanjeevani-app/src/services/gemmaService.js - TTS API · Provides /api/tts on port 3001.
sanjeevani-app/server.js
Build and delivery
- Android host
sanjeevani-app/android/app/src/main/java/com/sanjeevani/triage/MainActivity.java - CI pipeline
.github/workflows/ci.yml
Connections 22
- Web entry → Application shell: mounts
- Application shell → Patient intake: renders
- Application shell → Bilingual chat: renders
- Application shell → Triage panel: renders
- Application shell → 108 emergency overlay: renders
- Patient intake → Triage state and memory: stores patient and language
- Voice interaction → Triage state and memory: supplies voice input
- Bilingual chat → Triage state and memory: reads and writes turns
- Bilingual chat → TTS API: requests speech audio
- Triage state and memory → Clinical agent: submits clinical context
- Clinical agent → Offline reasoning engine: uses offline fallback
- Offline reasoning engine → Symptom ontology: consults
- Clinical agent → Clinical prompts: builds constrained prompts
- Clinical agent → Gemma inference service: uses when available
- Clinical agent → Triage state and memory: returns structured outcome
- Triage state and memory → Triage panel: drives guidance
- Triage state and memory → 108 emergency overlay: RED escalation
- Triage state and memory → Clinic referral: YELLOW referral
- Triage state and memory → Triage report/pass: generates report
- Offline mock data → Clinic referral: offline development data
- Android host → Application shell: hosts packaged PWA
- CI pipeline → Web entry: builds and validates