@startuml title SDHR Participate Operation Record Withheld Sequence autonumber "[00]" skinparam ActorFontSize 16 skinparam ArrowFontSize 12 skinparam ArrowFontSize 16 skinparam BoxPadding 5 skinparam DatabaseFontSize 16 skinparam dpi 400 skinparam EntityFontSize 16 skinparam MaxMessageSize 375 skinparam NoteFontSize 14 skinparam ParticipantFontSize 16 skinparam ParticipantPadding 5 skinparam responseMessageBelowArrow true skinparam roundcorner 15 skinparam sequenceArrowThickness 2 skinparam SequenceBoxFontSize 16 skinparam sequencegroupfontsize 14 skinparam SequenceMessageAlignment left skinparam sequenceStyle uml2 skinparam TitleFontSize 20 ' semi-transparent sequence groups! ' see https://sarafian.github.io/tips/2021/03/11/plantuml-tips-tricks-1.html#:~:text=responseMessageBelowArrow-,Semi,-transparent%20group%20backgrounds skinparam SequenceGroupBodyBackgroundColor #EEEEFF50 scale max 400 width scale 300*500 actor "Health Practitioner" as USER participant "PMS" as APIC #Orange participant "PMS Orchestrator" as ORCHESTRATOR #Orange control "Participate Operation\n$participate" as PARTICIPATE #LightBlue control "SDHR FHIR API" as FHIRAPI #LightBlue database "SDHR FHIR Server" as SDHR #LightGreen == Patient Elects to Withhold Records Whilst Participating in the SDHR Service == USER -> APIC : Record set to RESTRICTED APIC -> ORCHESTRATOR : Trigger resource event ORCHESTRATOR -> APIC : Retrieve resource details ORCHESTRATOR -> ORCHESTRATOR : Prepare participation\nparameters ORCHESTRATOR -> PARTICIPATE : Invoke participate operation note left of PARTICIPATE Parameters: - patient: Patient ID (NHI) - facilityId: Facility ID (HPI FacilityID) - resourceType: Resource Type (e.g. Condition) - localResourceId: Resource ID (e.g. Local Resource ID) - reasonCode: sdhr-record-withheld end note PARTICIPATE -> FHIRAPI : Write Participation FHIRAPI -> SDHR : Persist PARTICIPATE -> ORCHESTRATOR : Return OperationOutcome alt SDHR has resource ORCHESTRATOR -> FHIRAPI : PUT Resource with **meta.security** RESTRICTED note right of ORCHESTRATOR "meta" : { "security" : [ { "system" : "http://terminology.hl7.org/CodeSystem/v3-Confidentiality", "code" : "R", "display" : "Restricted" } ] } end note end ==Search for Withheld Record== ORCHESTRATOR -> FHIRAPI : Search Resource (e.g. Condition) FHIRAPI -> SDHR : Query Resource SDHR -> FHIRAPI : Return FHIRAPI -> ORCHESTRATOR : Return Search result with OperationOutcome\nindicating that the patient has witheld records at source note right of ORCHESTRATOR { "resourceType" : "OperationOutcome", "issue" : [ { "severity" : "information", "code" : "informational", "details" : { "coding" : [ { "system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes", "code" : "sdhr-records-withheld-at-source", "display" : "Records withheld at source" } ], "text" : "Patient has withheld records at source. The operation was successful, but some records were not included in the response due to confidentiality settings." } } ] } end note ==Patient Elects to Unrestict the Record== USER -> APIC : Record set to UNRESTRICTED APIC -> ORCHESTRATOR : Trigger resource event ORCHESTRATOR -> APIC : Retrieve resource details alt check SDHR for resource ORCHESTRATOR -> FHIRAPI : Search for Resource by Patient, Facility and LocalID FHIRAPI -> SDHR : Query Resource SDHR -> FHIRAPI : Return FHIRAPI -> ORCHESTRATOR : Return Search result with OperationOutcome\nindicating that the patient has witheld records at source note right of ORCHESTRATOR "type" : "searchset", "total" : 0, "entry": [ "resourceType" : "Bundle", { "resourceType" : "OperationOutcome", "issue" : [ { "severity" : "information", "code" : "informational", "details" : { "coding" : [ { "system" : "https://fhir-ig.digital.health.nz/sdhr/CodeSystem/sdhr-outcome-codes", "code" : "sdhr-records-withheld-at-source", "display" : "Records withheld at source" } ], "text" : "Patient has withheld records at source. The operation was successful, but some records were not included in the response due to confidentiality settings." } } ] } ] end note end ORCHESTRATOR -> ORCHESTRATOR : Prepare participation\nparameters ORCHESTRATOR -> PARTICIPATE : Invoke participate operation note left of PARTICIPATE Parameters: - patient: Patient ID (NHI) - facilityId: Facility ID (HPI FacilityID) - resourceType: Resource Type (e.g. Condition) - localResourceId: Resource ID (e.g. Local Resource ID) - reasonCode: sdhr-record-released end note PARTICIPATE -> FHIRAPI : Write Participation FHIRAPI -> SDHR : Persist PARTICIPATE -> ORCHESTRATOR : Return OperationOutcome ORCHESTRATOR -> FHIRAPI : POST Resource FHIRAPI -> SDHR : Create Resource SDHR -> FHIRAPI : Return FHIRAPI -> ORCHESTRATOR : Return Resource @enduml