How riteshdev99/medimate works
Project type and purpose
• This is a React Native–based mobile application (“MediMate”) for iOS and Android.
• Purpose: allow users to scan medicine labels, consult an AI doctor, locate hospitals, manage emergency contacts, read health news, and book doctor appointments.
• All business logic lives in the mobile client; it integrates with external services (Gemini API, Google Maps, News API, etc.).
File structure
• Top‐level mobile folders:
– android/ / ios/ — native project files and Gradle/Xcode configuration
– src/ — all React Native code:
· components/ — reusable UI pieces (navBar, newsCard, serviceCard, topBar)
· layout/ — “screens” or feature bundles (scanner, doctorConsult, homeLayout, hospitalLayout, userProfile, setting)
· Utils/ — cameraUtils.ts, prompt generators for AI doctor or scanner
· dto/ — data‐transfer object definitions for appointments, news, services
· mockData/ — static data for local testing
– index.js & App.tsx — entry point and root component
• Config files: babel.config.js, metro.config.js, tsconfig.json, package.json
• Native‐module integrations: react-native-image-crop-picker, Geolocation API, Google Maps API
• No custom backend code—app forwards requests to third‐party REST/GraphQL services.
README for additional insights
• Lists four main user‐facing services: AI Doctor (Gemini API), Nearby Hospitals (Google Maps + Geolocation), Emergency Contacts, Consult a Doctor (appointment & chat/video).
• News feed powered by News API.
• Key mobile tech: React Native, Image Crop Picker, Google Maps, Geolocation.
Main components
a. Mobile Device (iOS / Android)
– React Native JS Layer
– Native modules bridged via the React Native bridge:
• Camera & Image Cropper
• Geolocation
• Maps SDK
b. Application Modules (JS)
– Scanner module (Utils.cameraUtils → image picker → processing)
– AI Doctor module (Utils.doctorPrompt → Gemini API)
– Nearby Hospitals module (Utils.scannerPrompt → Geolocation + Google Maps API)
– News module (newsDto → News API)
– Services module (appointmentDto → “Consult a Doctor” API)
– UI layer (components/ + layout/)
c. External Services
– Gemini API (AI Doctor)
– Google Maps API (hospital locator)
– Geolocation Service (device GPS)
– News API (health news)
– Appointment / Chat / Video‐call API (third‐party medical service)
d. Optional local storage or mock server (for __tests__ and mockData)
Relationships and data flows
• User taps “Scan” → React Native UI → Camera native module → image returned to JS → send image to Gemini API for medicine ID
• User views “Nearby Hospitals” → JS requests device geolocation → calls Google Maps API → map tiles + hospital data returned → rendered in UI
• User reads news → JS issues REST call to News API → JSON feed → mapped into newsDto → newsCard components render articles
• User books appointment/chat → prepare appointmentDto → send to Health Services backend → confirmation → UI update
Architectural patterns and design principles
• Layered architecture:
– Presentation (components/layout)
– Business logic (Utils, DTO transformation)
– Data/Service layer (external API calls via fetch/Axios)
– Native‐bridge (React Native bridge to camera, geolocation, maps)
• Separation of concerns: UI vs. service integration vs. data modeling
• Asynchronous, event‐driven flows for API calls and native events
Essential architectural elements to capture
• React Native entrypoint (index.js → App.tsx)
• Core directories (components vs. layout vs. Utils vs. dto)
• Native SDK integrations (camera, geolocation, maps)
• External API endpoints (Gemini, News, Maps, Appointment service)
• Data flow paths and transformation via DTOs