工作组:FHIR Infrastructure 成熟度: 2 标准状态: Trial Use

如前几节所述,有很多FHIR资源可以直接独立的用于工作流中,而不须使用FHIR来管理工作流的执行。 当我们想使用FHIR来管理工作流的执行时,有几种可用的机制。 除了用FHIR来管理工作流,还有一些情况并不需要管理工作流的执行,而只需简单的以“点对点”(ad-hoc)的方式使用 资源模型 来支持工作流。在选择FHIR工作流的交互模式时,为了达到最佳效果,需要考虑以下几个方面:

  • 是否有必要在参与者之间共享工作流的状态?
  • 你要使用哪处范式?(REST、消息、服务、混合)?
  • 涉及在工作流中的各种资源是属于谁?或由谁管理(placer、 filler、 或其它参与者)?
  • 是否有正在运行的基础架构,支持通过订阅实现“推”或/和“拉”的通信机制?
  • 是否需要确认期望的执行者同意执行,或假设可以执行?
  • 对于请求动作执行与否或如何执行,是否需要协商?
  • 请求系统与执行系统是否直接通迅?如果使用REST范式,它们是否可以提交到对方的服务器?
  • 是否有必需或有能力搭建一个队列服务器以方便工作流的执行?
  • 涉及多少潜在的参与者?
  • 工作流是否有总是被管理?或者有一个潜在的执行者“池”,池中的执行者可以选择性的执行请求?

回答以上问题,可以指导您为特定的交互用例选择合适的通讯模式。 建议领域工作组根据他们的业务领域分析可以支持哪些工作流,并通过讨论在哪使用和怎么使用工作流, 就其性质而言,实施指南还应对通信模式作出规定,通信模式用于工作流程执行管理。

本节重点介绍一些更常见的模式,并指出它们的特点和局限性,并就何时使用哪个种模式最有效提供建议。 请注意,这个模式列表并不详尽。模式可以以各种方式组合,并且可能存在一些我们还没有想到的可能性。 此外,这些建议仅仅是建议而非指南。实现者可以自由选择他们愿意支持的模式。 因此,围绕工作流执行的紧密互操作性(与使用FHIR的任何其他紧密互操作性一样) 将依靠参与的各方围绕如何支持工作流执行进行一些事先协商, 或者所有参与方都遵守的实施指南需要明确互操作性的相关要求。

在查看此可选方案的列表之前,鼓励读者熟悉以下页面和资源: REST, 消息, 操作 , 服务订阅资源。

本页稍后介绍的“模式”会用场景来说明,这些场景都使用了以下约定:

  • 这里关注的是“请求”和该请求的执行。几乎所有的工作流都可以分解成一系列有序的步骤, 整个工作流中可能有两个以上参与方,各方的职责可能因每次交互而转换。
  • 请求可以像“请查看此信息”一样简单,响应也可以像隐式的“已查看”一样简单, 请求也可以是一些更复杂的操作,包括回执多个中间步骤和最终步骤。
  • 请求者被称为“placer”,执行者被称为“filler”,这通常被视为特定医嘱术语。 然而,在这种情况下,术语决定了请求是表示医疗方案、计划还是完整的医嘱。
  • Each of the patterns defines the set of steps involved in processing the request, lists some of the benefits and limitations associated with the approach, provides a scenario to illustrate the use of the pattern, and then makes recommendations about when the pattern is most appropriate
  • The descriptions of these patterns focus on the notion of requesting fulfillment of a request. However most of these patterns are also applicable to requests for status change, requests for information, etc. If a pattern is limited in the types of execution it can trigger, this will be noted in the "limitations" section.

One of the key distinguishing characteristics in the patterns below is whether the pattern supports the tracking of the workflow's state by both the placer and the filler. The workflow state is represented by the Task resource. The Task state machine, which is also presented here, shows the use of Task.status to represent the general infrastructure state of the Task resource.

Diagram showing typical state machine for the Task resource

The combination of Task.status, Task.statusReason and Task.businessStatus provide the mechanism for tracking the workflow state. The following two examples illustrate how that could be accomplished with regards of specific workflows. Note that these examples avoid any specificity on where the described resources exist, or any reference to a specific communication pattern. The goal of the examples is to demonstrate the use of the Task attributes to represent the workflow state.

The following table shows the steps for a simple blood test order, and the corresponding values of the Task attributes. A lot of details on other attributes have been omitted in order to focus on the state changes.

Workflow step Task.status Task.statusReason Task.businessStatus
Provider orders a blood test for a patient. A ServiceRequest resource is created to represent the order, and a Task resource is created to represent the request to the lab. Task.basedOn points to the ServiceRequest instance. Requested New order Ordered
The lab accepts the order. Accepted Able to perform the test. Accepted
The patient is at the lab, and blood is drawn. In progress Obtained the specimen Specimen available
Work on the blood sample is in progress, preliminary results are available, a DiagnosticReport resource is created, and Task.output.value[1] references the DiagnosticReport resource. In progress Preliminary results available Preliminary results
Final results are available Complete Final results are available Final results

The following table shows the steps for a referral workflow, and the corresponding values of the Task attributes. A lot of details on other attributes have been omitted in order to focus on the state changes.

Workflow step Task.status Task.statusReason Task.businessStatus
Provider A is seeing a patient with a specific complaint. Based on the exam, Provider A refers the patient to a specialist at clinic B. It is an urgent referral, requesting to see the specialist within 4 days. A ServiceRequest resource is created to represent the referral order, and a Task resource is created with Task.priority set to Urgent, and Task.restriction.period.end set to 4 days in the future. Requested New referral Referred
Clinic B receives the referral and puts it on the urgent queue to be reviewed. Received Received by organization Pending
Upon reviewing the referral, the clinic determines they have no capacity to see the patient within the specified time period, and they decline the referral. Rejected Provider unavailable Declined
Provider A changes the referral request to clinic C. This creates a new Task resource, with the appropriate information Requested Changed the referred to provider Referred
Clinic C accepts the referral and it is placed on a scheduler's queue. Accepted Able to provide the service. Accepted
An appointment is scheduled for the patient at Clinic C. In progress Appointment scheduled Scheduled
Soon after the appointment is scheduled, the patient calls provider A to ask for a different location for the referral appointment, as he lost his transportation, and he cannot reach Clinic C. The provider requests a cancel for the referral. Suspended Patient unable to make appointment. Cancel requested
Clinic C confirms the cancellation of the existing task. In progress
Failed
Referral cancelled Cancelled as requested
Provider A changes the referral to Clinic D, which is located close to where the patient lives, and can be conveniently reached using public transportation. This creates a new Task resource, with the appropriate information. Requested Changed the referred to provider Referred
Clinic D accepts the referral and it is placed on a scheduler's queue. Accepted Able to provide the service. Accepted
An appointment is scheduled for the patient at Clinic D. In progress Appointment scheduled Scheduled
Patient is seen at Clinic D. A diagnosis is made by the specialist, a prescription is given, and a follow-up appointment is made at clinic D. Task.output.value[1] references a Compositions resource, which contains the encounter summary. In progress Intermediary consultation note available Preliminary notes
Patient comes for follow-up appointment at clinic D. The specialist is satisfied by the progress the patient has made and creates the final consultation note. Task.output.value[2] references a Compositions resource, which contains consultation note. Completed Final consultation note available Final notes

The patterns that facilitate the execution of workflow using the Task resource are grouped in the Workflow Management Patterns section. The patterns where no Task resource is used are grouped in the Ad-hoc Workflow Patterns section. The list of patterns is as follows:

Ad-Hoc Workflow Patterns
Option A: Simple RESTful POST or PUT
Option B: Direct POST of request to fulfiller's system
Option C: POST of request to placer/queue server system, receiver uses polling or subscription
Option D: Messaging request from placer to filler & acknowledgment
Option E: Services request from placer to filler & acknowledgment
Workflow Management Patterns
Option F: Creation of Task on placer's system
Option G: POST of Task to fulfiller's system
Option H: POST of Task to a workflow broker
Option I: POST of Task to fulfiller's system, POST of sub-Task on placer's system
Option J: Messaging Task from placer to fulfiller
Option K: Service request referencing Task from placer to fullfiller
Additional Scenarios and Variations

TODO: Insert Jose's decision tree here?