How intelehealth/intelehealth-fhw-mobileapp works
Project type and purpose
• This is a full-stack Android application (Intelehealth FHW MobileApp) for community health workers (CHWs) to collect patient data, run decision trees, conduct exams, and sync information + video calls with remote doctors.
• It includes two Gradle modules:
• “app” – the primary Android client with UI, local database, sync, API clients, and background services.
• “webrtc” – a library for video/RTC interactions (peer connection, Firebase signaling, chat UI).
File structure
• Top-level “app” folder contains:
• src/main/java – UI Activities, Adapters, Utilities, Data Models, DAO, Sync and Network packages
• src/main/res – layouts, drawables, menus, values, xml configs
• services – download/upload/sync IntentServices, FirebaseMessaging
• syncModule – WorkManager, SyncUtils, LastSyncWork
• database/dao – SQLite helper, DAOs for Encounters, Patients, Visits, Images, Sync, RTCConnection
• appointment/api & networkApiCalls – Retrofit/OkHttp API interfaces and clients
• knowledgeEngine – clinical decision tree nodes
• “webrtc” module contains:
• apprtc services, activities, adapters, Manager for peer connections
• SocketBackgroundService for signaling, FirebaseUtils
• resources for chat UI and camera toggles
README
• Confirms a low-bandwidth telemedicine mobile client that:
• collects clinical data via guided flows
• uploads to a cloud EHR backend
• supports real-time video/voice via WebRTC and Firebase
• uses offline storage and scheduled sync
Main components
a. MobileApp UI Layer
• Activities & Fragments (Intro, Login, PatientDetail, PhysicalExam, Prescription, VideoLibrary, AppointmentListing…)
• knowledgeEngine for dynamic flows
b. Local Data Layer
• SQLite DB (InteleHealthDatabaseHelper + DAOs)
• SharedPreferences / SessionManager
c. Sync & Background Services
• SyncModule (WorkManager jobs: LastSyncWork, VisitSummaryWork)
• IntentServices: DownloadService, MyIntentService, UpdateDownloadPrescriptionService
• OfflineLogin, NetworkChangeListener
d. Network Layer
• Retrofit clients: ApiClient, ApiClientAppointment, ApiInterface, Appointment APIs
• PushRequestApiCall & PushResponseApiCall DTOs
• AppointmentSync, ActivitySync, EventManager
e. Real-Time Communication
• webrtc module: PeerConnection Manager, ChatActivity, SocketBackgroundService
• FirebaseMessaging for signaling (MyFirebaseMessagingService, CallListenerBackgroundService)
f. External Services / Servers
• Cloud EHR Server (OpenMRS REST endpoints)
• Firebase Cloud Messaging (FCM)
• WebRTC STUN/TURN servers
• Remote Doctor Web UI / API
Relationships & data flow
• UI → Local DB: writes form data, images, patient visits
• UI → Network Layer: triggers API calls (login, patient search, upload survey, appointment booking)
• SyncModule ↔ Local DB: reads pending records → uploads via network clients → marks synced
• Background Services → Network Layer: periodic download of protocols, prescriptions, and survey configs
• webrtc module ↔ Firebase → PeerConnection: call signaling messages → establish P2P media streams
• MobileApp ↔ Cloud EHR: RESTful JSON over HTTPS
• MobileApp ↔ Firebase FCM: push notifications for call invites, sync acknowledgements
Architectural patterns & principles
• MVVM/MVP-style separation: Activities/Adapters ≠ Data Models ≠ API/DAO
• Repository pattern: DAO + API clients feed ViewModels/Activities
• WorkManager for reliable background sync
• IntentService for on-demand tasks
• Modularization: core app + RTC module
• Notes on protocols: HTTPS/REST, WebRTC P2P, FCM push
• Key design patterns (Repository, WorkManager scheduling)