This React Native application, developed using Expo, demonstrates a patient management system.
You must install the app on an simulator (Android or iOS) before executing it. You can use Android Studio to download an Android simulator or Xcode to download an iPhone simulator.
-
Install dependencies
npx expo install
-
Start the app
npx expo start
-
Select where to run the app by choosing the corresponding option: Android, iOS, or Web options a | i | w respectively.
- Retrieve Patient Records: Fetches a list of patient records from the provided API.
- Display Patient Cards: Displays each patient’s record individually in a user-friendly card format.
- Expand/Collapse Details: Each card includes a button to expand or collapse additional patient details.
- Edit and Add Patients: Users can edit existing patient data or add new patients to the list using a modal component.
- Form Validation: Implements form validation to ensure the accuracy and completeness of patient data.
- Search Functionality: A search bar is added to allow users to quickly find specific patients by name (added to improve usability).
- User Notifications: Provides user-friendly notifications for successful or failed data modifications.
- Interactive Design: Ensures the application is responsive and interactive.
- Some patients' avatar icons, which use their initials as a placeholder, display a gray background color instead of showing the initials. This appears to be an inconsistency in rendering.
- The list does not use persistent data storage, meaning patient information resets after the app is closed.
- Search Bar: I implemented the search functionality to enable users to quickly locate specific patients, improving overall usability.
- Avatar Customization: Patient cards include avatar icons. When no avatar image is available, initials are displayed as placeholders for better visual identification.
This section outlines potential improvements for future development:
-
Avatar URL Management: The application currently uses hardcoded URLs for generating avatars. These URLs should be moved to a
.env
file for better security and maintainability. This will allow for easier configuration and prevent sensitive information from being exposed in the codebase. -
Code Encapsulation: Some logic within the
index.tsx
files could be further encapsulated into separate modules or utility functions within a dedicated directory (e.g.,services
). This would improve code organization, readability, and maintainability by making the file cleaner and more focused on composition. -
Controlled Scrolling for Lazy Loading Demonstration: The current implementation might load a large number of patients at once, making it difficult to observe the effects of lazy loading. Limiting the initial number of patients loaded and implementing proper pagination or infinite scrolling would better demonstrate the benefits of lazy loading.
- Implementation suggestions:
- Implement pagination on the backend to fetch patients in smaller chunks.
- Use a library or implement custom logic to detect when the user has scrolled near the bottom of the list.
- Fetch the next set of patients when the scroll threshold is reached.
- Implementation suggestions:
By addressing these points, the application's codebase will become more robust, maintainable, and efficient.