Site icon Hay on FHIR

Orders in different servers

So in the previous post we talked about how we could support the workflow track in the upcoming Connectathon (specifically for diagnostic orders) using a RESTful paradigm. There was quite a flurry of activity on the implementers chat about how this should work – with a number of differing opinions expressed about whether a separate set of resources (the Order / OrderResponse) is required or whether the detail resources (eg DiagnosticOrder, MedicationOrder) are sufficient. This sort of discussion is exactly what Connectathons are intended to promote to that’s all good!

Nevertheless, for this Connectathon we need to proceed with the current arrangement, which will help ‘flesh out’ some of these issues.

In the current version of orders in clinFHIR, all the resources are saved on a single server – which will not be the case in a real world environment. At the very least the clinical record (the EHR equivalent) will be on one server, and the server that processes orders (often called order fulfillment) on another. We’ve talked about Server Roles before and at that time we defined 4 of them:

So we now add a 5th:

(And just a reminder that a single physical server may implement multiple roles, and that there can be more than server with a given role in any implementation.)

Lets think about what our requirements are going to be from the perspective of the Order Placer for simple order processing in this multi-server world.

There are lots of other more detailed requirements – like being able to track the ‘state’ of the referral, be alerted if a report is not done in a reasonable time and so forth, but that will do for now.

Before we go into the details of how this could work in FHIR, we need to review a few important background concepts – especially around identity. We’ve talked about this before, but to re-iterate a few of the important points:

Some consequences of this include:

So let’s think about deployment scenarios.

For a start there will be at least an Order server and a Data Server. There might be a separate Patient server as well, but let’s assume that the Data and Patient roles are served by the same server so we can focus on the interaction with the Order server.

For a start, when we create an order, we’ll have a copy on the Data Server (for the patient record) and then make a copy to send to the Order server where it will be actioned by the fulfillment process (whatever that may be). So the order of events will be as follows:

  1. Create the detail resource/s (eg DiagnosticOrder) locally. It will have a relative reference to the patient as it’s on the same server. (Of course, if there were a separate Patient server then it would need to be absolute).
  2. Create and save the Order resource locally. It will have a relative reference both to the Patient and the detail resources.
  3. Save a copy of the detail resource on the Order service by POSTing it to the server. The Order Server will assign a new id, which is returned in the REST response (in the location header).
  4. Make a copy of the order resource on the Data Server. Replace the local relative reference to the detail resource with the one that the order server assigned above, and POST that to the order server. Note that the response from the Order server is the standard HTTP response – not an OrderResponse resource.

(We could have chosen to use the transaction capability and have the server do all the work – but we can’t assume that the Order server will support that).

Job done! – actually no, we need to decide how all of our resources are going to refer to the patient when we send an order to the Order server (as well as the Practitioner and any other referenced resource). There are (of course) at least a couple of options.

So we’ve sent our order to the Order server. How do we retrieve the result? Let’s assume that we don’t have a notification service (or any other ability to push results) in place – and that we want to continue to use REST – that implies that we need to poll the Order server for OrderResponse resources. However, looking at the OrderResponse resource we see that there is no link to the patient – only to the Order (and the resulting – fulfillment – resources).

We need to query the Order sever for the OrderResponse using the Order Id that was assigned by the Order server when the order was saved, which implies that we need to save that id when the order server saves our order in step 4 above. You might think that adding a Patient reference to OrderResponse will resolve this – but that reference would be to the Order Servers copy of patient, not to our own (unless both were referring to a common Patient server of course).

An alternative way might be to add an identifier to the Order. The Order server will save that identifier in it’s copy, and provided that it supports chained extensions would allow us to make a call like:

/OrderResponse?request.identifier= abc123

Return the OrderResponse resources where the associated order (the request) has an identifier of abc123.

But we probably can’t count on the server supporting that, so the easiest way right now will be to add an extension to our own copy of the order resource which is a reference to the Order Servers copy of the Order. When we want to update our list, we retrieve the extension (which will have the id of the order on the Order server and execute the query:

/OrderResponse?request = abc123

It’s a bit klutzy as we’ll need to update our own copy after it has been saved on the Order server, but it reduces the expectations on the Order server.

Of course, once we have the OrderResponse, if it references any ‘fulfillment’ resources – like a DiagnosticReport – it’s a straightforward matter to copy them to the Data server (though we will need to look for and resolve any relative references to other resources plus copy any dependant resources (like an Observation), so it’s not THAT straightforward…)

 

So we do have a few Requirements of the Order Server:

So this will all work – but the issues we discussed do show that there is room for improvement! If you’re interested in this stuff, then attending the Connectathon will be a great way to contribute to what is likely to be a robust discussion!

 

Exit mobile version