Milestone 2: State Machine Diagrams (Draft) - SENG-350-2024-fall/Team-13 GitHub Wiki

Medical System Diagrams

This Wiki provides an overview of the different actors in the medical system: Doctor, Pharmacist, Nurse, Receptionist, and Patient. Each section contains a clickable link to the corresponding diagram and detailed code.

Links


Diagrams and Code

Doctor Diagram

Doctor

Click to view code
@startuml
[*] --> LoginPrompt

state LoginPrompt {
    [*] --> WaitingForCredentials
    WaitingForCredentials --> AuthenticatingCredentials : Enter Credentials
    AuthenticatingCredentials --> WaitingForCredentials : Invalid Credentials
}

state Dashboard {
    [*] --> ViewingPatientList
    ViewingPatientList --> PatientSelected : Select Patient
}

state TriageManagement {
    [*] --> ReviewingTriageResults
    ReviewingTriageResults --> EditingTriageResults : Need Changes
    EditingTriageResults --> ConfirmingTriageResults : Edits Complete
    ReviewingTriageResults --> ConfirmingTriageResults : No Changes Needed
    ConfirmingTriageResults --> TriageComplete : Results Confirmed
}

state TreatmentManagement {
    [*] --> AssessingPatient
    AssessingPatient --> OrderingLabTests : Tests Needed
    AssessingPatient --> ProvidingMedicalAdvice : Advice Needed
    AssessingPatient --> PrescribingMedication : Medication Needed
    
    OrderingLabTests --> ViewingLabResults : Test Results Ready
    ViewingLabResults --> AssessingPatient : Review Complete
    
    ProvidingMedicalAdvice --> AssessingPatient : Advice Given
    
    state PrescribingMedication {
        [*] --> WritingPrescription
        WritingPrescription --> SendingToPharmacist : Prescription Complete
        SendingToPharmacist --> PrescriptionComplete : Notification Sent
    }
}

state AppointmentManagement {
    [*] --> ViewingSchedule
    ViewingSchedule --> CheckingAvailability : New Appointment
    CheckingAvailability --> SchedulingAppointment : Slot Available
    SchedulingAppointment --> AppointmentComplete : Appointment Scheduled
}

LoginPrompt --> Dashboard : Successful Login

Dashboard --> TriageManagement : Review Triage
Dashboard --> TreatmentManagement : Treat Patient
Dashboard --> AppointmentManagement : Manage Appointments

TriageComplete --> Dashboard
PrescriptionComplete --> Dashboard
AppointmentComplete --> Dashboard

Dashboard --> LoginPrompt : Logout
@enduml

Pharmacist Diagram

Pharmacist

Click to view code
@startuml
[*] --> LoginPrompt

state LoginPrompt {
    [*] --> WaitingForCredentials
    WaitingForCredentials --> AuthenticatingCredentials : Enter Credentials
    AuthenticatingCredentials --> WaitingForCredentials : Invalid Credentials
}

state Dashboard {
    [*] --> ViewingQueue
}

state PrescriptionManagement {
    [*] --> ReviewingPrescription
    ReviewingPrescription --> QueryingPrescriber : Need Clarification
    QueryingPrescriber --> ReviewingPrescription : Received Response
    ReviewingPrescription --> PreparingMedication : Approved
    PreparingMedication --> MedicationReady : Preparation Complete
}

state PatientInteraction {
    [*] --> CalculatingWaitTime
    CalculatingWaitTime --> NotifyingPatient : Medication Ready
    CalculatingWaitTime --> UpdateWaitTime : Status Changed
    UpdateWaitTime --> CalculatingWaitTime
}

state OTCPrescribing {
    [*] --> ReviewingPatientHistory
    ReviewingPatientHistory --> SelectingMedication
    SelectingMedication --> EnteringDosage
    EnteringDosage --> PreparingMedication
}

LoginPrompt --> Dashboard : Successful Login
Dashboard --> LoginPrompt : Logout

Dashboard --> PrescriptionManagement : Handle Prescription
Dashboard --> PatientInteraction : Patient Request
Dashboard --> OTCPrescribing : OTC Medicine Request

PrescriptionManagement --> Dashboard : Complete
PatientInteraction --> Dashboard : Complete
OTCPrescribing --> Dashboard : Complete
@enduml

Nurse Diagram

Nurse

Click to view code
@startuml
[*] --> NotLoggedIn

state NotLoggedIn {
  [*] --> LoginPrompt
  LoginPrompt --> AuthenticatingCredentials : Enter Credentials
  AuthenticatingCredentials --> LoginPrompt : Invalid Credentials
}

state LoggedIn {
  [*] --> Dashboard
  
  state VirtualTriage {
    [*] --> InterviewingPatient
    InterviewingPatient --> DocumentingSymptoms : Gather Information
    DocumentingSymptoms --> AssessingPriority : Complete Documentation
    AssessingPriority --> DecidingAction : Priority Assessed
  }
  
  state MonitoringED {
    [*] --> ReviewingWaitingQueue
    ReviewingWaitingQueue --> AdjustingPriorities : Queue Reviewed
    AdjustingPriorities --> CoordinatingWithReceptionist : Priorities Adjusted
  }
  
  state ManagingBeds {
    [*] --> CheckingBedAvailability
    CheckingBedAvailability --> UpdatingBedStatus : Bed Status Changed
    UpdatingBedStatus --> CoordinatingAdmissions : Status Updated
  }
  
  state PatientMonitoring {
    [*] --> CheckingPatientStatus
    CheckingPatientStatus --> DocumentingObservations : Patient Checked
    DocumentingObservations --> ConsultingDoctor : Complications Detected
    DocumentingObservations --> UpdatingRecords : No Complications
  }
  
  state PreparingForConsultation {
    [*] --> ReviewingPatientRecords
    ReviewingPatientRecords --> UpdatingMissingInfo : Information Missing
    UpdatingMissingInfo --> NotifyingDoctor : Patient Ready
    ReviewingPatientRecords --> NotifyingDoctor : Records Complete
  }
  
  Dashboard --> VirtualTriage : Start Triage
  Dashboard --> MonitoringED : Check ED Queue
  Dashboard --> ManagingBeds : Manage Beds
  Dashboard --> PatientMonitoring : Monitor Patient
  Dashboard --> PreparingForConsultation : Prepare for Doctor
}

NotLoggedIn --> LoggedIn : Successful Login
LoggedIn --> NotLoggedIn : Logout
@enduml

Receptionist Diagram

Receptionist

Click to view code
@startuml
[*] --> NotLoggedIn

state NotLoggedIn {
  [*] --> LoginPrompt
  LoginPrompt --> AuthenticatingCredentials : Enter Credentials
  AuthenticatingCredentials --> LoginPrompt : Invalid Credentials
}

state LoggedIn {
  [*] --> Dashboard
  
  state PatientRegistration {
    [*] --> GatheringInformation
    GatheringInformation --> VerifyingInformation : Information Collected
    VerifyingInformation --> AddingToWaitlist : Information Verified
    VerifyingInformation --> RequestingMissingInfo : Information Incomplete
    RequestingMissingInfo --> VerifyingInformation : Additional Info Received
    AddingToWaitlist --> RegistrationComplete : Patient Added
  }
  
  state AppointmentScheduling {
    [*] --> CheckingDoctorSchedule
    CheckingDoctorSchedule --> ProposingAppointmentSlots : Available Slots Found
    ProposingAppointmentSlots --> ConfirmingAppointment : Slot Selected
    ConfirmingAppointment --> UpdatingSchedule : Appointment Confirmed
    ProposingAppointmentSlots --> CheckingDoctorSchedule : No Suitable Slot
  }
  
  state PatientNotification {
    [*] --> ComposingNotification
    ComposingNotification --> SendingNotification : Notification Composed
    SendingNotification --> ConfirmingDelivery : Notification Sent
    ConfirmingDelivery --> ResendingNotification : Delivery Failed
    ResendingNotification --> ConfirmingDelivery : Resend Attempt
  }
  
  state WaitlistManagement {
    [*] --> ViewingCurrentList
    ViewingCurrentList --> UpdatingList : Changes Needed
    UpdatingList --> ReorderingPriorities : Urgent Case
    ReorderingPriorities --> ViewingCurrentList : List Updated
    ViewingCurrentList --> RemovingPatient : Patient Seen
  }
  
  Dashboard --> PatientRegistration : New Patient
  Dashboard --> AppointmentScheduling : Schedule Appointment
  Dashboard --> PatientNotification : Notify Patient
  Dashboard --> WaitlistManagement : Manage Waitlist
}

NotLoggedIn --> LoggedIn : Successful Login
LoggedIn --> NotLoggedIn : Logout
@enduml

Patient Diagram

Patient

Click to view code
@startuml
[*] --> NotLoggedIn

state NotLoggedIn {
  [*] --> LoginPrompt
  LoginPrompt --> AuthenticatingCredentials : Enter Credentials
  AuthenticatingCredentials --> LoginPrompt : Invalid Credentials
  LoginPrompt --> RegistrationForm : New User
}

state LoggedIn {
  [*] --> Dashboard
  
  state AccountManagement {
    [*] --> ViewingProfile
    ViewingProfile --> UpdatingHealthProfile : Edit Profile
    UpdatingHealthProfile --> ViewingProfile : Save Changes
  }
  
  state HospitalServices {
    [*] --> SearchingHospitals
    SearchingHospitals

 --> ViewingHospitalDetails : Select Hospital
    ViewingHospitalDetails --> ViewingWaitTimes : Check Wait Times
  }
  
  state EmergencyServices {
    [*] --> InitiatingEmergencyCall
    InitiatingEmergencyCall --> OnEmergencyCall : Connect to Hotline
  }
  
  state VirtualTriage {
    [*] --> EnteringSymptoms
    EnteringSymptoms --> AwaitingResults : Submit Symptoms
    AwaitingResults --> ViewingTriageResults : Results Ready
  }
  
  state WaitlistManagement {
    [*] --> CheckingWaitlistPosition
    CheckingWaitlistPosition --> LeavingWaitlist : Choose to Leave
  }
  
  state MedicalRecords {
    [*] --> ViewingMedicalHistory
    ViewingMedicalHistory --> FilteringRecords : Search/Filter
  }
  
  Dashboard --> AccountManagement
  Dashboard --> HospitalServices
  Dashboard --> EmergencyServices
  Dashboard --> VirtualTriage
  Dashboard --> WaitlistManagement
  Dashboard --> MedicalRecords
}

NotLoggedIn --> LoggedIn : Successful Login
LoggedIn --> NotLoggedIn : Logout
RegistrationForm --> LoggedIn : Account Created
@enduml
⚠️ **GitHub.com Fallback** ⚠️