Skip to content

Sequence Diagrams

AhmetCemCalik edited this page Mar 8, 2026 · 14 revisions

Sequence Diagram 1

sequenceDiagram
    autonumber
    actor User as Expert User
    participant Server as :Server
    participant Service as :AccountService
    participant API as :ExternalBadgeAPI
    participant DB as :Database
    participant Expert as newExpert :Expert

    User->>Server: Request Sign-up (Expert)
    activate Server

    Server->>Service: verifyCredentials(email, password)
    activate Service
    Service->>DB: Check for existing email
    activate DB
    DB-->>Service: No duplicates
    deactivate DB
    Service-->>Server: Credentials OK
    deactivate Service

    Server->>Expert: Instantiate(details)
    activate Expert
    Expert-->>Server: expertInstance
    deactivate Expert

    Server->>Service: verifyExpertBadge(expertInstance)
    activate Service
    Note right of Service: Calls imaginary third-party<br/>verification service
    Service->>API: validateProfessionalID(expertInstance.id)
    activate API
    API-->>Service: Status: VALID (Badge Token)
    deactivate API

    Service->>Expert: setBadgeVerified(true)
    activate Expert
    Expert-->>Service: Success
    deactivate Expert

    Service-->>Server: Badge Verified Successfully
    deactivate Service

    Server->>Service: verifyAccount(expertInstance)
    activate Service
    Note right of Service: Triggers activation email
    Service-->>Server: Account Activated
    deactivate Service

    Server->>DB: Save Complete Expert Profile
    activate DB
    DB-->>Server: Commit Success
    deactivate DB

    Server-->>User: Display Dashboard (Verified Badge Active)
    deactivate Server
Loading

Sequence Diagram 2

sequenceDiagram
    actor Expert as Expert (User)
    participant AS as AccountService
    participant US as UserService
    participant DB as Database

    Expert->>AS: logIn(email, password)
    AS->>DB: Check for existing user by email
    DB-->>AS: User found (userType=EXPERT)
    AS-->>Expert: Login successful, return user session

    Expert->>US: getExpertProfile(userId)
    US->>DB: findExpertByUserId(userId)
    DB-->>US: expert: Expert (existing profile)
    US-->>Expert: expertProfile returned

    loop For each expertise field
        Expert->>US: selectExpertiseField(field: String)
        US->>DB: appendExpertiseField(expertId, field)
        DB-->>US: updated expertiseFields: List<String>
        US-->>Expert: field added
    end

    loop For each skill
        Expert->>US: addSkill(name, description)
        US->>DB: findOrCreateSkill(name, description)
        DB-->>US: skill: Skill (skillId assigned)
        US->>DB: appendSkill(expertId, skill)
        DB-->>US: updated skills: List<Skill>
        US-->>Expert: skill added
    end

    Expert->>AS: verifyExpertBadge(expert)
    AS->>DB: getExpert(expertId)
    DB-->>AS: expert: Expert
    
    alt Verification passed
        AS->>DB: setBadgeVerified(expertId, true), setBadgeLabel(expertId, label)
        DB-->>AS: expert updated
        AS-->>Expert: badgeVerified=true, Badge verified successfully
    else Verification failed
        AS-->>Expert: badgeVerified=false, Show failure reason & prompt to complete profile
    end

    Expert->>US: updateAvailabilityStatus(expertId, AVAILABLE)
    US->>DB: updateAvailabilityStatus(expertId, AVAILABLE)
    DB-->>US: status updated
    US-->>Expert: Profile live
Loading

Sequence Diagram 3

sequenceDiagram
    title SD3: User Creates a Forum Post
    actor E as User
    participant FS as ForumService
    participant Post as ForumPost
    participant DB as Database

    E->>FS: createPost(title, content, tags)
    FS->>FS: validatePostContent()
    alt content is valid
        FS->>Post: new ForumPost(author, title, content, isExpertPost=false)
        Post->>DB: save()
        DB-->>Post: postId
        Post-->>FS: post
        FS-->>E: postCreatedSuccess(post)
    else content is invalid
        FS-->>E: validationError(errorMessage)
    end
Loading

Sequence Diagram 4 — Search, Filter and Interaction with a Forum Post

sequenceDiagram
    title SD4: User Searches, Filters and Interacts with a Forum Post

    actor U as User (Ali)
    participant FSS as ForumSearchService
    participant Post as ForumPost
    participant V as Vote
    participant DB as Database


    Note over U, DB: Search in Forum
    U->>FSS: browseAll()
    FSS->>DB: fetchAllPosts()
    DB-->>FSS: posts
    FSS-->>U: postList

    U->>FSS: search("earthquake")
    FSS->>DB: queryPostsByKeyword("earthquake")
    DB-->>FSS: filteredPosts
    FSS-->>U: searchResults
    

    Note over U, DB: Filter by Poster Type
    U->>FSS: filterByPosterType(EXPERT)
    FSS->>DB: queryPostsByPosterType(EXPERT)
    DB-->>FSS: expertPosts
    FSS-->>U: filteredResults


    Note over U, DB: Browse and Open Post
    U->>FSS: getPostDetails(postId)
    FSS->>DB: fetchPost(postId)
    DB-->>FSS: post
    FSS-->>U: postDetails(title, content, author, voteCount)


    Note over U, DB: Upvote Post
    U->>Post: addVote(userId, UPVOTE)
    Post->>V: new Vote(userId, postId, UPVOTE)
    V->>DB: save()
    DB-->>V: voteId
    V-->>Post: vote
    Post->>Post: updateVoteCount()
    Post->>DB: save()
    Post-->>U: updatedVoteCount

    Note over U, DB: Read Comments
    U->>Post: getComments(postId)
    Post->>DB: fetchComments(postId)
    DB-->>Post: comments
    Post-->>U: commentList
Loading

Sequence Diagram 5 — Priority Notification & View Emergency Report

sequenceDiagram
    title Use Case 5: Receive and View Emergency Request

    actor User as Medical Expert (Dr. Emre)
    participant Notification as Notification Service
    participant App as Mobile App
    participant Backend as Backend Server
    participant Map as Map Service

    Notification ->> App: Push emergency notification
    App ->> User: Display priority notification

    User ->> App: Tap notification
    App ->> Backend: Request emergency report

    Backend -->> App: Emergency details (description, urgency, location)

    App ->> Map: Request map data
    Map -->> App: Map with emergency location

    App ->> User: Display Emergency Report Page
Loading

Sequence Diagram 6 - Respond to Emergency Request

sequenceDiagram
title Use Case 6: Respond to Emergency Request

actor User as Medical Expert (Dr. Emre)
participant App as Mobile App
participant Backend as Backend Server
participant DB as Database

User->>App: View Emergency Report Page

User->>App: Scroll to comment section
User->>App: Write comment "I am on my way to help"
User->>App: Submit comment

App->>Backend: Send comment(requestID, text)

Backend->>DB: Store comment
DB-->>Backend: Success

Backend->>Backend: Update request status "Medical Expert Responding"

Backend-->>App: Confirmation

App-->>User: Display status tag "Medical Expert Responding"
Loading

Sequence Diagram 7 - Request for Gathering Point Information

sequenceDiagram
title Use Case 7: Request for Gathering Point Information

actor User
participant MobileApp
participant ConnectivityStatusChecker
participant OnlineModeManager
participant OfflineModeManager
participant GatheringPoint
participant CachedData
participant LocalStorage

User -> MobileApp : getGatheringPoint()
MobileApp -> ConnectivityStatusChecker : getStatus()
ConnectivityStatusChecker --> MobileApp : status

alt status ONLINE
    MobileApp -> OnlineModeManager : getGatheringPoint()
    OnlineModeManager -> GatheringPoint : getGatheringPoint()
    GatheringPoint -> CachedData : getLocation()

    alt Location permission exists
        CachedData --> GatheringPoint : locationData
        GatheringPoint --> OnlineModeManager : locationData
        OnlineModeManager --> MobileApp : locationData
        MobileApp --> User : locationData (on Map)
    else Location permission doesn't exist
        CachedData --> GatheringPoint : Error(LocationPermissionDenied)
        GatheringPoint --> OnlineModeManager : Error(LocationPermissionDenied)
        OnlineModeManager --> MobileApp : Error(LocationPermissionDenied)
        MobileApp --> User : LocationPermissionDenied
    end

else status OFFLINE
    MobileApp -> OfflineModeManager : getGatheringPoint()
    OfflineModeManager -> GatheringPoint : getGatheringPoint()
    GatheringPoint -> LocalStorage : getLocation()

    alt Location exists in LocalStorage
        LocalStorage --> GatheringPoint : locationData
        GatheringPoint --> OfflineModeManager : locationData
        OfflineModeManager --> MobileApp : locationData
        MobileApp --> User : locationData (on Map)
    else Location doesn't exist in LocalStorage
        LocalStorage --> GatheringPoint : Error(LocationInfoDoesNotExist)
        GatheringPoint --> OfflineModeManager : Error(LocationInfoDoesNotExist)
        OfflineModeManager --> MobileApp : Error(LocationInfoDoesNotExist)
        MobileApp --> User : LocationInfoDoesNotExist
    end
end
Loading

Sequence Diagram 8

sequenceDiagram
actor User
participant MobileApp
participant GetConnectivityStatus
participant OfflineModeManager
participant FirstAidInfo
participant LocalStorage

User->>MobileApp: Select "First Aid Information"
MobileApp->>GetConnectivityStatus: getStatus()
GetConnectivityStatus-->>MobileApp: status

alt status OFFLINE
    MobileApp->>OfflineModeManager: getFirstAidContent()
    OfflineModeManager->>FirstAidInfo: getFirstAidContent()
    FirstAidInfo->>LocalStorage: getFirstAidText()
    FirstAidInfo->>LocalStorage: getFirstAidVideo()

    alt data exists
        LocalStorage-->>FirstAidInfo: FirstAidText
        LocalStorage-->>FirstAidInfo: FirstAidVideo
        OfflineModeManager-->>MobileApp: FirstAidText
        OfflineModeManager-->>MobileApp: FirstAidVideo
        MobileApp-->>User: FirstAidText
        MobileApp-->>User: FirstAidVideo

    else data missing
        LocalStorage-->>FirstAidInfo: Error(DataMissing)
        FirstAidInfo-->>OfflineModeManager: Error(DataMissing)
        OfflineModeManager-->>MobileApp: Error(DataMissing)
        MobileApp-->>User: Data Missing
    end
end
Loading

Clone this wiki locally