This project addresses critical challenges in the Egyptian healthcare system by implementing a scalable, secure, and AI-integrated EHR platform. It leverages advanced technologies and a microservices architecture to enhance patient data management, diagnostic support, and clinical workflows.
Centralized Patient Data Management: Securely stores comprehensive patient medical histories in a structured format within MongoDB. Data is organized by key entities (see ERD diagram below) allowing granular data management and efficient retrieval through a RESTful API.
AI-Powered Medical History Summarization: Leverages the power of Llama3-OpenBioLLM-70B to generate concise summaries of patient medical histories. This feature extracts key information from diverse data sources within the patient record, reducing information overload for physicians and aiding in faster, more informed decision-making. The summarization workflow is illustrated below:
Automated Medical Report Generation: Automates the generation of standardized medical reports based on the last patient visit, incorporating patient demographics, visit summaries, diagnoses, prescribed medications, vital signs, lab results, and AI-powered recommendations. This feature streamlines documentation and frees up physicians' time for patient care.
AI-Driven Diagnostics (X-Ray Analysis): Integrates a fine-tuned ViT X-Ray Pneumonia Classification model to analyze chest X-rays, providing diagnostic support to radiologists. The model outputs a classification label (Pneumonia or Normal) with a confidence score, facilitating faster and more accurate diagnoses. Example of the results:
Interactive Chatbot: Provides an AI-powered chatbot (Llama3-OpenBioLLM-70B) integrated into both patient and physician dashboards for intuitive access to information and support. The chatbot enables:
Secure Role-Based Access Control (RBAC): Employs Auth0 for authentication and authorization, implementing granular access control based on user roles (Administrator, Doctor, Patient). This ensures data privacy and compliance with regulatory requirements. JWT tokens and scopes are used for secure inter-service communication within the microservices architecture. The system also utilizes an admission/discharge mechanism for further access control, aligning with Egypt's Data Protection Law.
Scalable Microservices Architecture: The backend is built using a microservices architecture with Node.js, Express.js, and a polyglot persistence strategy (PostgreSQL for user data, MongoDB for patient records and AI results, Redis for caching). This approach ensures scalability, maintainability, and fault isolation. The architecture diagram below illustrates the interaction between microservices:
The AI-powered medical summarization feature was rigorously evaluated using ROUGE (Recall-Oriented Understudy for Gisting Evaluation) and BERTScore. ROUGE measures lexical overlap between generated summaries and reference summaries, while BERTScore assesses semantic similarity.
The results of these evaluations are visualized in the following figures:
Performance testing was conducted using k6 to assess the system's scalability and stability under realistic user loads. The tests simulated concurrent users accessing the user profile retrieval endpoint (/api/user/profile). Results demonstrated excellent performance, with consistently low response times and minimal error rates, even during peak loads. This validates the effectiveness of the chosen microservices architecture and the Kubernetes-based deployment on AKS. The graph below shows the correlation between virtual users and response times:
This project aims to have a significant positive impact on the Egyptian healthcare system by:
The frontend of the EHR system is designed with a focus on user experience and efficient access to information. It provides distinct views tailored to the roles of administrators, doctors, and patients, ensuring a streamlined and intuitive workflow for each user group.
Technology Stack: The frontend is built using modern web technologies:
User Interfaces: The frontend provides distinct user interfaces tailored to specific roles:
Administrator View: Provides functionalities for managing access control, user accounts, hospital information, and patient data addition requests.
Doctor View: Offers tools for accessing patient histories, generating AI summaries, reviewing medical records, conducting examinations, uploading medical data, and accessing the chatbot.
Patient View: Allows patients to view their medical history, request data additions, access lab results and X-ray reports, schedule appointments, and communicate with healthcare providers through the chatbot.
User Authentication and Registration: Employs a secure and user-friendly authentication system powered by Auth0. Users can register with personal information, and National ID is used as a key identifier for patient registration, enabling quick access to information in case of emergencies.
Chatbot Integration: The chatbot is seamlessly integrated into both the patient and doctor views, providing real-time support and medical advice.
Contributions are welcome! Please fork the repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change. See CONTRIBUTING.md for more details.
This project is licensed under the MIT License.