How knut-capstone-design-team-1/wip-application-v2 works
Project Type and High-Level Purpose
• This is a mobile application (supporting both Android and iOS) built with React Native. The application focuses on scanning/searching for pills (medications) using pill images.
• The README highlights external API integrations (Google Cloud for image search, drug details; CloudFlare for resource storage) and a local database with encryption (Realm).
Main Components
a. Mobile Frontend (React Native UI)
• Components: All UI elements under the “src/components” directory (atoms, organisms, screens, etc.).
• Navigation: “src/navigation” – handling screen stacking and navigation flows.
• State and Hooks: “src/hooks”, “src/provider”, “src/selectors” to manage state, alerts, and queries.
• Utilities and Styling: “src/utils”, “src/style”, “src/constants” for data management, utility functions, and global styles.
b. API and Data Layer
• API Clients: “src/api/client” indicates a layer to handle HTTP requests (authentication, DB responses, etc.).
• Database Models & Queries: “src/api/db/models” for pill-related data and “src/api/db/query” to handle local data storage operations.
• Server Logic: “src/api/server.ts” possibly centralizes route definitions or handles middleware.
• Update Mechanism: “src/api/update.ts” to manage data updates.
c. External Services Integration
• Google Cloud: Several environment variables reference Google Cloud endpoints (for init-info, image search, drug details).
• CloudFlare: Environment setup to manage resource downloads from CloudFlare.
• Local Database: The use of a Realm encryption key implies secure local storage for offline use.
d. Native Platform Components
• Android-specific native code and build configurations under “android” (build.gradle files, native Java/ Kotlin code).
• iOS-specific native code and configurations under “ios” (Xcode project files, storyboard, Podfile).
e. Build and Infrastructure
• Configuration Files: Scripts for linting (.eslintrc.js, .prettierrc.js), testing (“__tests__”), and build scripts (npm run android:dev, android:prod, ios:dev, ios:prod).
• CI/CD: GitHub workflows for Android builds are defined under “.github/workflows”.
Relationships and Data Flow
• The primary data flow starts from the mobile frontend (React Native layers in “src”) where user actions on UI screens trigger API calls.
• The API client layer (src/api/client) communicates with external services (Google Cloud and CloudFlare) to retrieve images, search results, and drug details.
• The local database (Realm) handles storing relevant pill data. Data flows from the API to the local storage and then back to UI components.
• The native layers (Android and iOS directories) wrap the React Native app, ensuring platform-specific native integrations and build processes.
• Testing and CI/CD workflows maintain code quality and streamline app deployment.
Architectural Patterns and Technologies
• Separation of Concerns: The project is clearly divided into UI components, business logic (API clients, DB models, hooks), and native platform code.
• Modular Componentization: The “atoms”, “organisms”, and “screens” follow a structured component-based architecture.
• Data Abstraction: The use of separate API and DB directories abstracts the data layer from the presentation logic.
• Cross-Platform Development: React Native is used to maintain a single codebase for both iOS and Android while allowing native customizations.
• External Integration: Incorporates RESTful API calls to Google Cloud endpoints as well as secure data storage from CloudFlare services.