A020 - Upload before or after referral creation

Hi all,

Reading the documentation around the A020 (upload file to document store) - it takes in an optional NHSD-ERS-Referral-ID (ubrn) to almost “pre-associate” an upload with an existing referral.

The maintain referral letter call (A012) documentation then says " only documents that have a NHSD-eRS-Referral-ID can be associated using this end point." and “This endpoint can be used to associate attachments to a referral that has no existing referral letter attachments”

To allow for the best error handling and to prevent unnecessary creation of referral entries, our workflow is to first upload the documents (easier to cater for failures at this point) and then only create the referral and associate those documents.

Reading the documentation - it appears like this should work, however we are getting errors on the A012 (Maintain) call (unprocessable-entity) - but if the referral is created first and then we do the upload and maintain it works fine.

The documentation in A020 also states " Request header NHSD-eRS-Referral-ID - the ID (typically the UBRN) of the referral which the documents are intended for - is non-mandatory, but must be provided if this file is to be attached to an existing request."

What we are trying is to pre-upload the documents for a (not yet existing) request we are about to create (provided all the uploads succeed)

I am just wondering if the upload-first work-flow is supported? The information seems a little vague or perhaps I am reading it in too much of a hopeful manner?

Hi @hayward,

No, I’m afraid not.

In the case of Maintain referral letter (A012, FHIR STU3) this is clarified in the Overview:

Whilst a document can be uploaded via Upload file to document store (A020) without a NHSD-eRS-Referral-ID , only documents that have a NHSD-eRS-Referral-ID can be associated using this end point. An attempt to associate a document without a NHSD-eRS-Referral-ID will return an error response of 422 - INAPPROPRIATE_VALUE .

To give a little context, one of the key reasons the Referral-ID is required at the point of upload (A020) is to allow us to control access to the file before it is formally linked to a request. This access control ensures that only users/organisations with a legitimate relationship with the request can download the file. A file uploaded without a Referral-ID cannot be retrieved until it is formally linked (see below).

The specification of a Referral-ID on upload also provides a fail-safe against inadvertently linking a file to the wrong request.

The only endpoint that allows the linking of a file uploaded without a Referral-ID is Create advice and guidance request (A044, FHIR STU3). This is unavoidable as the request creation and the linking happens in one transaction.

Regards,

Adam.

1 Like