Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added prescription notification #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

louissosthenes9
Copy link
Collaborator

Bug Description

Yes, the bug is related to the problem: the lack of notifications when a new prescription is described. See the detailed issue below:
Image


Proposed Solution

To address this issue, we propose using Server-Side Events (SSE) to create an endpoint in the server that allows the client UI to subscribe and listen for notifications. This is demonstrated in the following steps, as shown in the referenced pull request:

Step 1: Create a Prescription Notification Module

The solution begins with the creation of the Prescription Notification Module, including the following key components:

  1. Controller: Exposes the SSE endpoint for client subscriptions.
  2. Prescription Message Constructor: Constructs a standardized notification message.
  3. Prescription Service: Handles business logic, including fetching patient names from the Patient Model.

See the implementation snapshots below:
Controller:
Image

Message Constructor:
Image

Prescription Service:
Image


Step 2: Dispatch Notifications

Notifications are dispatched each time a prescription is triggered by modifying the iCare service implementation:
Image


Step 3: Client-Side Notification Handling

On the UI side, we added:

  1. Notification Service (notification.service.ts): Listens for events from the server.
  2. Notification Component: Displays notifications conditionally when a dose is prescribed, pushing updates into the UI.

Implementation preview:
Notification Component UI


Final Results

With mock data, the notification system functions as expected, displaying notifications in the UI:
Notification Example


Alternatives Considered

Backend Alternatives:

  • Spring WebSocket: A more complex approach for this use case.
  • Polling: Cumbersome to implement and resource-intensive.

UI Alternatives:

  • Adding a Notification Window Tab for the Pharmacist Module.
  • Using Modals for displaying prescriptions.
  • Utilizing the Sonner Library for well-designed notifications.


Contributors

The following team members contributed to the solution:

  • Louis Sosthenes Konyoka (2022-04-04729)
  • Khafsa Hassan Lulela (2021-04-04973)
  • Diana Modest Deo (2022-04-01537)
  • Keneth Martin Kilimba (2022-04-04249)
  • Arnold Andrew Masmini (2022-04-06484)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant