' SPDX-FileCopyrightText: 2025 Bram Wesselo ' ' SPDX-License-Identifier: EUPL-1.2 @startuml overview-task-negotiation-1-2 skinparam roundcorner 20 skinparam defaultFontName Arial !pragma teoz true box Care Provider 1 #e8d0a9 actor "Practitioner" as Practitioner1 participant "Care Plan Contributor" as CPC1 #LightGray participant "Care Plan Service" as CPS #Gray end box box Care Provider 2 #acd1e9 participant "Care Plan Contributor" as CPC2 #LightGray participant "Task manager" as EHR2 actor "Practitioner" as Practitioner2 end box activate Practitioner1 autonumber Practitioner1 -> CPC1 : Start Request\nreferral & CPC1 -> CPS : Find/select CarePlan CPC1 -> CPS : Create Task\n referring Request,\n Condition and CarePlan\n (if any) & CPS -> CPS : Update CareTeam, CarePlan\n and Subscriptions CPS o-> CPC1 : Notify CareTeam update,\n CarePlan update & CPS o-> CPC2 : Notify Task created & CPC2 -> EHR2 : Notify Task created & note right EHR2 #WhiteSmoke Actions in gray are optional end note autonumber 10 "0" EHR2 -[#DarkSlateGray]> EHR2 : evaluate Task\n (required data,\n capacity, etc) &EHR2 -[#DarkSlateGray]> CPC2 : Need more information & CPC2 -[#DarkSlateGray]> CPS : Create (sub-)Task2: do\n Questionnaire 'required data' & CPS -[#DarkSlateGray]> CPC1 : Notify Task2 created & CPC1 -[#DarkSlateGray]> Practitioner1 : Present Questionnaire\n(prefill data from EHR) Practitioner1 -[#DarkSlateGray]> CPC1 : Complete\n QuestionnaireResponse & CPC1 -[#DarkSlateGray]> CPS : Update Task2: Add\n QuestionnaireResponse & CPS -[#DarkSlateGray]> CPC2 : Notify Task2 update & CPC2 -[#DarkSlateGray]> EHR2 : Notify Task2 update ' autonumber 20 "0" ' EHR2 -[#DarkSlateGray]> EHR2 : evaluate Task\n (required data,\n capacity, etc) ' & EHR2 -[#DarkSlateGray]> CPC2 : need patient\n contact details ' & CPC2 -[#DarkSlateGray]> CPS : Create (sub-)Task3: \n status 'ready',\n Questionnaire patient\n contact details in Task3.input ' & CPS -[#DarkSlateGray]> CPC1 :Notify Task3 created ' & CPC1 -[#DarkSlateGray]> Practitioner1 : Present Questionnaire\n(prefill data from EHR) ' Practitioner1 -[#DarkSlateGray]> CPC1 : Complete\n QuestionnaireResponse ' & CPC1 -[#DarkSlateGray]> CPS : Update Task3: \n status 'completed', Add\n QuestionnaireResponse\n to Task3.output ' & CPS -[#DarkSlateGray]> CPC2 : Notify Task3 update ' & CPC2 -[#DarkSlateGray]> EHR2 : Notify Task3 update autonumber 30 EHR2 -> EHR2 : evaluate Task:\n status 'accepted' & EHR2 -> CPC2 : Notify Task update & CPC2 -> CPS : Update Task: \n status 'accepted' CPS -> CPS : Update CareTeam, CarePlan CPS o-> CPC1 :Notify Task accepted\n CareTeam updated\n CarePlan updated & CPS o-> CPC2 :Notify CareTeam updated\n CarePlan updated & CPC1 -> Practitioner1 : Your order \nis accepted deactivate Practitioner1 == waiting for Task to start == activate Practitioner2 Practitioner2 -> EHR2 : starting with Task & EHR2 -> CPC2 : Task in-progress & CPC2 -> CPS : Update Task: status in-progress & CPS -> CPC1 : Notify Task update == waiting for Task to finish == Practitioner2 -> EHR2 : Task done & EHR2 -> CPC2 : Task is done & CPC2 -> CPS : Update Task: status complete & CPS -> CPC1 : Notify Task update deactivate Practitioner2 @enduml