diff --git a/poetry.lock b/poetry.lock
index 0b5d39b1e..140fd6e95 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.
[[package]]
name = "attrs"
@@ -1572,13 +1572,13 @@ files = [
[[package]]
name = "urllib3"
-version = "2.2.2"
+version = "2.2.3"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = ">=3.8"
files = [
- {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"},
- {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"},
+ {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"},
+ {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"},
]
[package.extras]
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json
index c2d92e38b..0542a49e3 100644
--- a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json
@@ -266,6 +266,17 @@
"attachment": {
"id": "70000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -274,6 +285,24 @@
"value": "921600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
}
],
"contentType": "application/pdf",
@@ -316,6 +345,17 @@
"attachment": {
"id": "70001",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -324,6 +364,24 @@
"value": "103264994981"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
}
],
"contentType": "application/pdf",
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json
index bc7930811..ac97663c5 100644
--- a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json
@@ -256,6 +256,17 @@
"attachment": {
"id": "70000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -264,6 +275,24 @@
"value": "103264992985"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
}
],
"contentType": "image/png",
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/UnavailableAttachments.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/UnavailableAttachments.json
new file mode 100644
index 000000000..dee836939
--- /dev/null
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceConversation/UnavailableAttachments.json
@@ -0,0 +1,480 @@
+{
+ "id": "87b2902f-5f2b-4e15-b678-b65951fab131",
+ "meta": {
+ "lastUpdated": "2021-09-24T11:50:11.000Z",
+ "profile": [
+ "http://hl7.org/fhir/STU3/StructureDefinition/Bundle"
+ ]
+ },
+ "resourceType": "Bundle",
+ "type": "searchset",
+ "total": 2,
+ "link": [
+ {
+ "relation": "self",
+ "url": "_baseUrl_/STU3/Communication?based-on=CommunicationRequest/000000070003/_history/2&_include=Communication:requester-practitionerrole:PractitionerRole&_include=Communication:sender-practitionerrole:PractionerRole&_include=Communication:content-reference:DocumentReference"
+ }
+ ],
+ "entry": [
+ {
+ "fullUrl": "_baseUrl_/STU3/Communication/70000",
+ "resource": {
+ "id": "70000",
+ "meta": {
+ "versionId": "0",
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Communication-1"
+ ]
+ },
+ "resourceType": "Communication",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-Communication-Requester-1",
+ "valueReference": {
+ "reference": "PractitionerRole/921600556514.R68.REFERRING-CLINICIAN"
+ }
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "CommunicationRequest/000000070003/_history/2"
+ }
+ ],
+ "status": "completed",
+ "category": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-CommunicationSentBy-1",
+ "code": "REQUESTER"
+ }
+ ]
+ }
+ ],
+ "recipient": [
+ {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-HealthcareService-Reference-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11014"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "sent": "2021-09-23T14:43:45.869Z",
+ "sender": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "PractitionerRole/921600556514.R68.REFERRING-CLINICIAN"
+ }
+ }
+ ]
+ },
+ "payload": [
+ {
+ "contentReference": {
+ "reference": "DocumentReference/70000"
+ }
+ }
+ ],
+ "note": [
+ {
+ "text": "Please advise me on this patient who ...(information about patient)"
+ }
+ ]
+ },
+ "search": {
+ "mode": "match"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/Communication/70003",
+ "resource": {
+ "id": "70003",
+ "meta": {
+ "versionId": "0",
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Communication-1"
+ ]
+ },
+ "resourceType": "Communication",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-Communication-Requester-1",
+ "valueReference": {
+ "reference": "PractitionerRole/103264994981.R69.SERVICE-PROVIDER-CLINICIAN"
+ }
+ }
+ ],
+ "basedOn": [
+ {
+ "reference": "CommunicationRequest/000000070001/_history/6"
+ }
+ ],
+ "status": "completed",
+ "category": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-CommunicationSentBy-1",
+ "code": "RESPONDER"
+ }
+ ]
+ }
+ ],
+ "recipient": [
+ {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ ],
+ "sent": "2021-09-23T14:43:46.991Z",
+ "sender": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "PractitionerRole/103264994981.R69.SERVICE-PROVIDER-CLINICIAN"
+ }
+ }
+ ]
+ },
+ "payload": [
+ {
+ "contentReference": {
+ "reference": "DocumentReference/70001"
+ }
+ }
+ ],
+ "note": [
+ {
+ "text": "Please perform xxx test and send me the results"
+ }
+ ]
+ },
+ "search": {
+ "mode": "match"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/PractitionerRole/103264994981.R69.SERVICE-PROVIDER-CLINICIAN",
+ "resource": {
+ "id": "103264994981.R69.SERVICE-PROVIDER-CLINICIAN",
+ "meta": {
+ "profile": [
+ "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-PractitionerRole-1"
+ ]
+ },
+ "resourceType": "PractitionerRole",
+ "practitioner": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264994981"
+ }
+ },
+ "organization": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ },
+ "code": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BusinessFunction-1",
+ "code": "SERVICE_PROVIDER_CLINICIAN"
+ }
+ ]
+ }
+ ]
+ },
+ "search": {
+ "mode": "include"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/PractitionerRole/921600556514.R68.REFERRING-CLINICIAN",
+ "resource": {
+ "id": "921600556514.R68.REFERRING-CLINICIAN",
+ "meta": {
+ "profile": [
+ "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-PractitionerRole-1"
+ ]
+ },
+ "resourceType": "PractitionerRole",
+ "practitioner": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "921600556514"
+ }
+ },
+ "organization": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R68"
+ }
+ },
+ "code": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BusinessFunction-1",
+ "code": "REFERRING_CLINICIAN"
+ }
+ ]
+ }
+ ]
+ },
+ "search": {
+ "mode": "include"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/DocumentReference/70000",
+ "resource": {
+ "id": "70000",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "ADVICE_REQUEST",
+ "display": "Advice Request"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-23T14:43:49.565Z",
+ "description": "test results A",
+ "content": [
+ {
+ "attachment": {
+ "id": "70000",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "PENDING"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "921600556514"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
+ }
+ ],
+ "contentType": "application/pdf",
+ "url": "Binary/3816ca48-897a-4be0-907d-a4e830b4e213",
+ "size": 6,
+ "title": "testResultsA.pdf",
+ "creation": "2021-09-23"
+ }
+ }
+ ]
+ },
+ "search": {
+ "mode": "include"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/DocumentReference/70001",
+ "resource": {
+ "id": "70001",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "GUIDANCE_RESPONSE",
+ "display": "Guidance Response"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-24T11:21:00.000Z",
+ "description": "test xxx info",
+ "content": [
+ {
+ "attachment": {
+ "id": "70001",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "THREATS_FOUND"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264994981"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
+ }
+ ],
+ "contentType": "application/pdf",
+ "url": "Binary/719f6045-e791-4029-8e0f-1201c02b0a55",
+ "size": 11,
+ "title": "testXXXInfo.pdf",
+ "creation": "2021-09-24"
+ }
+ }
+ ]
+ },
+ "search": {
+ "mode": "include"
+ }
+ },
+ {
+ "fullUrl": "_baseUrl_/STU3/DocumentReference/70002",
+ "resource": {
+ "id": "70002",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "GUIDANCE_RESPONSE",
+ "display": "Guidance Response"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-24T11:21:00.000Z",
+ "description": "test xxx info",
+ "content": [
+ {
+ "attachment": {
+ "id": "70002",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "VALIDATION_FAILED"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264994981"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "004377014925"
+ }
+ }
+ }
+ ],
+ "contentType": "application/pdf",
+ "url": "Binary/874ef853-131a-48e9-8a0a-1417eaa79d8d",
+ "size": 11,
+ "title": "moreTestXXXInfo.pdf",
+ "creation": "2021-09-24"
+ }
+ }
+ ]
+ },
+ "search": {
+ "mode": "include"
+ }
+ }
+ ]
+}
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json
index 4152ae99c..672986196 100644
--- a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json
@@ -173,6 +173,17 @@
"attachment": {
"id": "70002",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -181,6 +192,24 @@
"value": "103264992985"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
}
],
"contentType": "image/png",
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithUnavailableAttachments.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithUnavailableAttachments.json
new file mode 100644
index 000000000..9de9618c1
--- /dev/null
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/WithUnavailableAttachments.json
@@ -0,0 +1,433 @@
+{
+ "id": "000000070002",
+ "meta": {
+ "versionId": "5",
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-CommunicationRequest-1"
+ ]
+ },
+ "resourceType": "CommunicationRequest",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralPriority-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE",
+ "display": "Routine"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ProviderConversionAuthorisation-1",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ProviderConversionAuthorisation-1",
+ "code": "AUTHORISED_TO_CONVERT",
+ "display": "Referrer has allowed the Service Provider to convert the Advice and Guidance to a Referral"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralShortlist-1",
+ "valueReference": {
+ "reference": "#shortlist"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Specialty-1",
+ "valueCoding": {
+ "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
+ "code": "CARDIOLOGY",
+ "display": "Cardiology"
+ }
+ }
+ ],
+ "contained": [
+ {
+ "id": "serviceSearchCriteria",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1"
+ ]
+ },
+ "resourceType": "Parameters",
+ "parameter": [
+ {
+ "name": "priority",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE"
+ }
+ },
+ {
+ "name": "specialty",
+ "valueCoding": {
+ "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
+ "code": "CARDIOLOGY"
+ }
+ },
+ {
+ "name": "clinicType",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ClinicType-1",
+ "code": "HEART_FAILURE"
+ }
+ },
+ {
+ "name": "ageAndGenderAppropriate",
+ "valueBoolean": true
+ },
+ {
+ "name": "commissioningProvisioning",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-CommissioningProvisioning-1",
+ "code": "ALL_AVAILABLE_FOR_BOOKING"
+ }
+ }
+ ]
+ },
+ {
+ "id": "shortlist",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Shortlist-List-1"
+ ]
+ },
+ "resourceType": "List",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Shortlist-SearchCriteria-1",
+ "valueReference": {
+ "reference": "#serviceSearchCriteria"
+ }
+ }
+ ],
+ "status": "current",
+ "mode": "snapshot",
+ "entry": [
+ {
+ "item": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11014"
+ },
+ "display": "Cardiology Advice Service"
+ }
+ }
+ ]
+ },
+ {
+ "id": "PractitionerRole.103264992985.R69.REFERRING-CLINICIAN",
+ "meta": {
+ "profile": [
+ "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-PractitionerRole-1"
+ ]
+ },
+ "resourceType": "PractitionerRole",
+ "practitioner": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ },
+ "organization": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ },
+ "code": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BusinessFunction-1",
+ "code": "REFERRING_CLINICIAN"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-70002",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.png",
+ "content": [
+ {
+ "attachment": {
+ "id": "70000",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "PENDING"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/719f6045-e791-4029-8e0f-1201c02b0a55",
+ "size": 18592,
+ "title": "upload1.png",
+ "creation": "2021-09-17"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-70000",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.png",
+ "content": [
+ {
+ "attachment": {
+ "id": "70001",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "THREATS_FOUND"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/9eb7224-dff3-4730-a5cb-67eac811f1a5",
+ "size": 18592,
+ "title": "upload2.png",
+ "creation": "2021-09-17"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-70001",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.png",
+ "content": [
+ {
+ "attachment": {
+ "id": "70002",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "VALIDATION_FAILED"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/2a8b042f-e12e-4249-9478-37b2426a4d65",
+ "size": 18592,
+ "title": "upload3.png",
+ "creation": "2021-09-17"
+ }
+ }
+ ]
+ }
+ ],
+ "status": "active",
+ "category": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AdviceAndGuidanceStatus-1",
+ "code": "PROVIDER_RESPONSE_REQUIRED"
+ }
+ ]
+ }
+ ],
+ "subject": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/nhs-number",
+ "value": "9912003888"
+ }
+ },
+ "recipient": [
+ {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-HealthcareService-Reference-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11014"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "sender": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "#PractitionerRole.103264992985.R69.REFERRING-CLINICIAN"
+ }
+ }
+ ]
+ },
+ "requester": {
+ "agent": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "#PractitionerRole.103264992985.R69.REFERRING-CLINICIAN"
+ }
+ }
+ ]
+ }
+ },
+ "payload": [
+ {
+ "contentReference": {
+ "reference": "#DocumentReference-70002"
+ }
+ }
+ ]
+ }
+
\ No newline at end of file
diff --git a/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/withUnavailableAttachments.json b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/withUnavailableAttachments.json
new file mode 100644
index 000000000..9409c89b7
--- /dev/null
+++ b/sandbox/src/mocks/stu3/retrieveAdviceAndGuidanceRequest/responses/withUnavailableAttachments.json
@@ -0,0 +1,442 @@
+{
+ "id": "000000070001",
+ "meta": {
+ "versionId": "5",
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-CommunicationRequest-1"
+ ]
+ },
+ "resourceType": "CommunicationRequest",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralPriority-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE",
+ "display": "Routine"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ProviderConversionAuthorisation-1",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ProviderConversionAuthorisation-1",
+ "code": "AUTHORISED_TO_CONVERT",
+ "display": "Referrer has allowed the Service Provider to convert the Advice and Guidance to a Referral"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralShortlist-1",
+ "valueReference": {
+ "reference": "#shortlist"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Specialty-1",
+ "valueCoding": {
+ "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
+ "code": "CARDIOLOGY",
+ "display": "Cardiology"
+ }
+ }
+ ],
+ "contained": [
+ {
+ "id": "serviceSearchCriteria",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1"
+ ]
+ },
+ "resourceType": "Parameters",
+ "parameter": [
+ {
+ "name": "priority",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE"
+ }
+ },
+ {
+ "name": "specialty",
+ "valueCoding": {
+ "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
+ "code": "CARDIOLOGY"
+ }
+ },
+ {
+ "name": "clinicType",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ClinicType-1",
+ "code": "HEART_FAILURE"
+ }
+ },
+ {
+ "name": "ageAndGenderAppropriate",
+ "valueBoolean": true
+ },
+ {
+ "name": "commissioningProvisioning",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-CommissioningProvisioning-1",
+ "code": "ALL_AVAILABLE_FOR_BOOKING"
+ }
+ }
+ ]
+ },
+ {
+ "id": "shortlist",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Shortlist-List-1"
+ ]
+ },
+ "resourceType": "List",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Shortlist-SearchCriteria-1",
+ "valueReference": {
+ "reference": "#serviceSearchCriteria"
+ }
+ }
+ ],
+ "status": "current",
+ "mode": "snapshot",
+ "entry": [
+ {
+ "item": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11014"
+ },
+ "display": "Cardiology Advice Service"
+ }
+ }
+ ]
+ },
+ {
+ "id": "PractitionerRole.103264992985.R69.REFERRING-CLINICIAN",
+ "meta": {
+ "profile": [
+ "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-PractitionerRole-1"
+ ]
+ },
+ "resourceType": "PractitionerRole",
+ "practitioner": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ },
+ "organization": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ },
+ "code": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-BusinessFunction-1",
+ "code": "REFERRING_CLINICIAN"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-70000",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.png",
+ "content": [
+ {
+ "attachment": {
+ "id": "70000",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "PENDING"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/719f6045-e791-4029-8e0f-1201c02b0a55",
+ "size": 18592,
+ "title": "upload.png",
+ "creation": "2021-09-17"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-70001",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.pdf",
+ "content": [
+ {
+ "attachment": {
+ "id": "70001",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "THREATS_FOUND"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/719f6045-e791-4029-8e0f-1201c02b0a55",
+ "size": 18592,
+ "title": "upload.pdf",
+ "creation": "2021-09-17"
+ }
+ },
+ {
+ "id": "DocumentReference-70002",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-09-17T12:20:00.742Z",
+ "description": "upload.doc",
+ "content": [
+ {
+ "attachment": {
+ "id": "70002",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "VALIDATION_FAILED"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "103264992985"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "application/msword",
+ "url": "Binary/719f6045-e791-4029-8e0f-1201c02b0a55",
+ "size": 18592,
+ "title": "upload.doc",
+ "creation": "2021-09-17"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "status": "active",
+ "category": [
+ {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AdviceAndGuidanceStatus-1",
+ "code": "PROVIDER_RESPONSE_REQUIRED"
+ }
+ ]
+ }
+ ],
+ "subject": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/nhs-number",
+ "value": "9912003888"
+ }
+ },
+ "recipient": [
+ {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-HealthcareService-Reference-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11014"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "sender": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "#PractitionerRole.103264992985.R69.REFERRING-CLINICIAN"
+ }
+ }
+ ]
+ },
+ "requester": {
+ "agent": {
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-PractitionerRole-Reference-1",
+ "valueReference": {
+ "reference": "#PractitionerRole.103264992985.R69.REFERRING-CLINICIAN"
+ }
+ }
+ ]
+ }
+ },
+ "payload": [
+ {
+ "contentReference": {
+ "reference": "#DocumentReference-70000"
+ }
+ },
+ {
+ "contentReference": {
+ "reference": "#DocumentReference-70001"
+ }
+ },
+ {
+ "contentReference": {
+ "reference": "#DocumentReference-70002"
+ }
+ }
+ ]
+}
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedDBS.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedDBS.json
index 0c79cf83b..8eb9963b1 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedDBS.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedDBS.json
@@ -232,6 +232,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -240,6 +251,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "application/pdf",
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedIBS.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedIBS.json
index 532a09cb3..4be494b19 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedIBS.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/BookedIBS.json
@@ -219,6 +219,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -227,6 +238,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "application/pdf",
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json
index 0b649f67b..b9d20e470 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json
@@ -175,6 +175,17 @@
"attachment": {
"id": "80002",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -183,6 +194,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "image/png",
@@ -218,6 +238,17 @@
"attachment": {
"id": "80003",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -226,6 +257,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "application/pdf",
@@ -315,6 +355,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -323,6 +374,15 @@
"value": "921600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R68"
+ }
+ }
}
],
"contentType": "image/png",
@@ -359,6 +419,17 @@
"attachment": {
"id": "80001",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -367,6 +438,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "image/png",
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/DeferredToProvider.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/DeferredToProvider.json
index fbf278c73..911856637 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/DeferredToProvider.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/DeferredToProvider.json
@@ -226,6 +226,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -234,6 +245,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "application/pdf",
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/Unbooked.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/Unbooked.json
index bf3074a4e..5b8671a21 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/Unbooked.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/Unbooked.json
@@ -151,6 +151,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -159,6 +170,24 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
}
],
"contentType": "application/pdf",
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json
index 8a1070f3a..3058e75c6 100644
--- a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json
@@ -47,9 +47,9 @@
{
"url": "state",
"valueCoding": {
- "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralState-1",
- "code": "BOOKED",
- "display": "Booked"
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralState-1",
+ "code": "BOOKED",
+ "display": "Booked"
}
}
]
@@ -179,6 +179,17 @@
"attachment": {
"id": "80000",
"extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "AVAILABLE"
+ }
+ ]
+ }
+ },
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
@@ -187,6 +198,15 @@
"value": "021600556514"
}
}
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
}
],
"contentType": "application/pdf",
@@ -200,13 +220,15 @@
}
],
"status": "active",
- "specialty" : {
- "coding" : [ {
- "code" : "CARDIOLOGY",
- "system" : "_baseUrl_/STU3/v1/CodeSystem/SPECIALTY",
- "display" : "Cardiology"
- } ]
- },
+ "specialty": {
+ "coding": [
+ {
+ "code": "CARDIOLOGY",
+ "system": "_baseUrl_/STU3/v1/CodeSystem/SPECIALTY",
+ "display": "Cardiology"
+ }
+ ]
+ },
"subject": {
"identifier": {
"system": "http://fhir.nhs.net/Id/nhs-number",
@@ -219,4 +241,4 @@
}
],
"intent": "plan"
-}
+}
\ No newline at end of file
diff --git a/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithUnavailableAttachments.json b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithUnavailableAttachments.json
new file mode 100644
index 000000000..159a4ce0c
--- /dev/null
+++ b/sandbox/src/mocks/stu3/retrieveReferralRequest/responses/WithUnavailableAttachments.json
@@ -0,0 +1,368 @@
+{
+ "id": "000000070012",
+ "meta": {
+ "versionId": "5",
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ReferralRequest-1"
+ ]
+ },
+ "resourceType": "ReferralRequest",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ClinicalInfoFirstSubmitted-1",
+ "valueDateTime": "2021-06-11T12:09:08.667Z"
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralPriority-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE",
+ "display": "Routine"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralShortlist-1",
+ "valueReference": {
+ "reference": "#shortlist"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Commissioning-Rule-Org-1",
+ "valueIdentifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralState-1",
+ "extension": [
+ {
+ "url": "state",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralState-1",
+ "code": "NOT_BOOKED",
+ "display": "Not Booked"
+ }
+ }
+ ]
+ }
+ ],
+ "contained": [
+ {
+ "id": "serviceSearchCriteria",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1"
+ ]
+ },
+ "resourceType": "Parameters",
+ "parameter": [
+ {
+ "name": "priority",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
+ "code": "ROUTINE"
+ }
+ },
+ {
+ "name": "specialty",
+ "valueCoding": {
+ "system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
+ "code": "CARDIOLOGY"
+ }
+ },
+ {
+ "name": "clinicType",
+ "valueCoding": {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ClinicType-1",
+ "code": "HEART_FAILURE"
+ }
+ },
+ {
+ "name": "postcode",
+ "valueString": "LS1 2TW"
+ },
+ {
+ "name": "distanceLimit",
+ "valueUnsignedInt": 123
+ },
+ {
+ "name": "ageAndGenderAppropriate",
+ "valueBoolean": true
+ }
+ ]
+ },
+ {
+ "id": "shortlist",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Shortlist-List-1"
+ ]
+ },
+ "resourceType": "List",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Shortlist-SearchCriteria-1",
+ "valueReference": {
+ "reference": "#serviceSearchCriteria"
+ }
+ }
+ ],
+ "status": "current",
+ "mode": "snapshot",
+ "entry": [
+ {
+ "item": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/ers-service",
+ "value": "11002"
+ },
+ "display": "Good Cardiology Business Service"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-80000",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-06-11T12:09:09.459Z",
+ "description": "referralletter pdf",
+ "content": [
+ {
+ "attachment": {
+ "id": "80000",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "PENDING"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "application/pdf",
+ "url": "Binary/19eb7224-dff3-4730-a5cb-67eac811f1a5",
+ "size": 6,
+ "title": "referralletter1.pdf",
+ "creation": "2021-06-11"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-80001",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-06-11T12:09:09.459Z",
+ "description": "referralletter png",
+ "content": [
+ {
+ "attachment": {
+ "id": "80001",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "THREATS_FOUND"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "image/png",
+ "url": "Binary/adda8c72-4a91-4dc7-a918-b6d12fb28085",
+ "size": 6,
+ "title": "referralletter2.png",
+ "creation": "2021-06-11"
+ }
+ }
+ ]
+ },
+ {
+ "id": "DocumentReference-80002",
+ "meta": {
+ "profile": [
+ "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
+ ]
+ },
+ "resourceType": "DocumentReference",
+ "type": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
+ "code": "REFERRER",
+ "display": "Referrer"
+ }
+ ]
+ },
+ "status": "current",
+ "indexed": "2021-06-11T12:09:09.459Z",
+ "description": "referralletter doc",
+ "content": [
+ {
+ "attachment": {
+ "id": "80002",
+ "extension": [
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AvailabilityStatus-1",
+ "valueCodeableConcept": {
+ "coding": [
+ {
+ "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1",
+ "code": "VALIDATION_FAILED"
+ }
+ ]
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-Organisation-1",
+ "valueReference": {
+ "identifier": {
+ "system": "https://fhir.nhs.uk/Id/ods-organization-code",
+ "value": "R69"
+ }
+ }
+ },
+ {
+ "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedOnBehalfOf-1",
+ "valueReference": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/sds-user-id",
+ "value": "021600556514"
+ }
+ }
+ }
+ ],
+ "contentType": "application/msword",
+ "url": "Binary/9e554611-3378-425c-9cab-700b697e52d3",
+ "size": 6,
+ "title": "referralletter3.doc",
+ "creation": "2021-06-11"
+ }
+ }
+ ]
+ }
+ ],
+ "status": "active",
+ "subject": {
+ "identifier": {
+ "system": "http://fhir.nhs.net/Id/nhs-number",
+ "value": "9912003888"
+ }
+ },
+ "supportingInfo": [
+ {
+ "reference": "#DocumentReference-80000"
+ },
+ {
+ "reference": "#DocumentReference-80001"
+ },
+ {
+ "reference": "#DocumentReference-80002"
+ }
+ ],
+ "intent": "plan"
+}
diff --git a/sandbox/src/routes/stu3/services/mockResponseProvider.js b/sandbox/src/routes/stu3/services/mockResponseProvider.js
index e07279f98..6f2e02f1a 100644
--- a/sandbox/src/routes/stu3/services/mockResponseProvider.js
+++ b/sandbox/src/routes/stu3/services/mockResponseProvider.js
@@ -185,42 +185,30 @@ module.exports = {
const ubrn = request.params.ubrn;
const version = request.params.version
- // Scenario 1 - Unbooked ReferralRequest
- if (ubrn === '000000070000' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/Unbooked.json', responseCode: 200 }
- }
-
- // Scenario 2 - ReferralRequest booked to directly-bookable service
- if (ubrn === '000000070001' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/BookedDBS.json', responseCode: 200 }
- }
-
- // Scenario 3 - ReferralRequest booked to indirectly-bookable service
- if (ubrn === '000000070002' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/BookedIBS.json', responseCode: 200 }
- }
-
- // Scenario 4 - ReferralRequest deferred to service provider for booking
- if (ubrn === '000000070003' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/DeferredToProvider.json', responseCode: 200 }
- }
-
- // Scenario 5 - ReferralRequest that was converted from an Advice and Guidance Request
- if (ubrn === '000000070004' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json', responseCode: 200 }
- }
-
- // Scenario 6 - ReferralRequest with related ReferralRequest
- if (ubrn === '000000070005' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/WithRelatedReferral.json', responseCode: 200 }
- }
-
- // Scenario 7 - ReferralRequest with additional requirements
- if (ubrn === '000000070011' && (!version || version === '5')) {
- return { responsePath: 'stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json', responseCode: 200 }
+ if (version === undefined || version === '5') {
+ var json = {
+ // Scenario 1 - Unbooked ReferralRequest
+ '000000070000': 'stu3/retrieveReferralRequest/responses/Unbooked.json',
+ // Scenario 2 - ReferralRequest booked to directly-bookable service
+ '000000070001': 'stu3/retrieveReferralRequest/responses/BookedDBS.json',
+ // Scenario 3 - ReferralRequest booked to indirectly-bookable service
+ '000000070002': 'stu3/retrieveReferralRequest/responses/BookedIBS.json',
+ // Scenario 4 - ReferralRequest deferred to service provider for booking
+ '000000070003': 'stu3/retrieveReferralRequest/responses/DeferredToProvider.json',
+ // Scenario 5 - ReferralRequest that was converted from an Advice and Guidance Request
+ '000000070004': 'stu3/retrieveReferralRequest/responses/ConvertedFromAdviceAndGuidance.json',
+ // Scenario 6 - ReferralRequest with related ReferralRequest
+ '000000070005': 'stu3/retrieveReferralRequest/responses/WithRelatedReferral.json',
+ // Scenario7 - ReferralRequest with additional requirements
+ '000000070011': 'stu3/retrieveReferralRequest/responses/WithAdditionalRequirements.json',
+ // Scenario 8 - ReferralRequest with attachments unavailable to download
+ '000000070012': 'stu3/retrieveReferralRequest/responses/WithUnavailableAttachments.json'
+ }[ubrn];
+ if (json) {
+ return {responsePath: json, responseCode: 200 };
+ }
}
-
- return {}
+ return {};
},
getExampleResponseForMaintainReferralLetter: function (request) {
@@ -307,50 +295,50 @@ module.exports = {
getResponseForRetrieveAdviceAndGuidanceRequest: function (request) {
const ubrn = request.params.ubrn;
- const version = request.params.version
-
- // Scenario 1 - Minimum example
- if (ubrn === '000000070000' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceRequest/responses/MinimalExample.json', responseCode: 200 }
- }
-
- // Scenario 2 - With attachment file reference
- if (ubrn === '000000070001' && (version === undefined || version === '5')) {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json', responseCode: 200 }
+ const version = request.params.version;
+
+ if (version === undefined || version === '5') {
+ var json = {
+ // Scenario 1 - Minimum example
+ '000000070000': 'stu3/retrieveAdviceAndGuidanceRequest/responses/MinimalExample.json',
+ // Scenario 2 - With attachment file reference
+ '000000070001': 'stu3/retrieveAdviceAndGuidanceRequest/responses/WithAttachmentFileReference.json',
+ // Scenario 3 - With attachements unavailable to download
+ '000000070002': 'stu3/retrieveAdviceAndGuidanceRequest/responses/WithUnavailableAttachments.json'
+ }[ubrn];
+ if (json) {
+ return { responsePath: json, responseCode: 200 };
+ }
}
- return {}
+ return {};
},
getResponseForRetrieveAdviceAndGuidanceConversation: function (request) {
- const basedOn = request.query["based-on"]
-
- // Scenario 1 - Single message from referrer
- if (basedOn === 'CommunicationRequest/000000070000/_history/1') {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/SingleMessageFromReferrer.json', responseCode: 200, version: 1 }
- }
-
- // Scenario 2 - One message each way
- if (basedOn === 'CommunicationRequest/000000070000/_history/2') {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/OneMessageEachWay.json', responseCode: 200, version: 2 }
- }
-
- // Scenario 3 - Attachment present in each direction
- if (basedOn === 'CommunicationRequest/000000070001/_history/6') {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json', responseCode: 200, version: 6 }
- }
-
- // Scenario 4 - Multi-way conversation
- if (basedOn === 'CommunicationRequest/000000070002/_history/1') {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/MultiWayConversation.json', responseCode: 200, version: 6 }
- }
-
- // Scenario 5 - Attachment uploaded from RCS before A&G creation
- if (basedOn === 'CommunicationRequest/000000070003/_history/7') {
- return { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json', responseCode: 200, version: 7 }
- }
-
- return {}
+ const basedOn = request.query["based-on"];
+
+ const json = {
+ // Scenario 1 - Single message from referrer
+ 'CommunicationRequest/000000070000/_history/1':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/SingleMessageFromReferrer.json', responseCode: 200, version: 1 },
+ // Scenario 2 - One message each way
+ 'CommunicationRequest/000000070000/_history/2':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/OneMessageEachWay.json', responseCode: 200, version: 2 },
+ // Scenario 3 - Attachment present in each direction
+ 'CommunicationRequest/000000070001/_history/6':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/AttachmentPresentInEachDirection.json', responseCode: 200, version: 6 },
+ // Scenario 4 - Multi-way conversation
+ 'CommunicationRequest/000000070002/_history/1':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/MultiWayConversation.json', responseCode: 200, version: 6 },
+ // Scenario 5 - Attachment uploaded from RCS before A&G creation
+ 'CommunicationRequest/000000070003/_history/7':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/AttachmentUploadedFromRCS.json', responseCode: 200, version: 7 },
+ // Scenario 6 - Attachment files unavailable for download
+ 'CommunicationRequest/000000070004/_history/3':
+ { responsePath: 'stu3/retrieveAdviceAndGuidanceConversation/UnavailableAttachments.json', responseCode: 200, version: 3 }
+ }[basedOn];
+
+ return json || {};
},
getResponseForSendAdviceAndGuidanceResponse: function (request) {
diff --git a/specification/components/stu3/schemas/DocumentReference.yaml b/specification/components/stu3/schemas/DocumentReference.yaml
index f7be6925b..06a19e0dd 100644
--- a/specification/components/stu3/schemas/DocumentReference.yaml
+++ b/specification/components/stu3/schemas/DocumentReference.yaml
@@ -114,24 +114,11 @@ properties:
example: '2021-04-22'
extension:
type: array
- minItems: 1
- maxItems: 1
+ minItems: 0
+ maxItems: 4
items:
- type: object
- required:
- - url
- - valueReference
- properties:
- url:
- type: string
- enum:
- - 'https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1'
- example: 'https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1'
- valueReference:
- type: object
- required:
- - identifier
- properties:
- identifier:
- $ref: identifiers/STU3_UserId.yaml
-
+ oneOf:
+ - $ref: extensions/Extension-eRS-AvailabilityStatus.yaml
+ - $ref: extensions/Extension-eRS-AttachedBy.yaml
+ - $ref: extensions/Extension-eRS-AttachedBy-Organisation.yaml
+ - $ref: extensions/Extension-eRS-AttachedOnBehalfOf.yaml
diff --git a/specification/components/stu3/schemas/codings/AvailabilityStatus.yaml b/specification/components/stu3/schemas/codings/AvailabilityStatus.yaml
new file mode 100644
index 000000000..fce7c7d25
--- /dev/null
+++ b/specification/components/stu3/schemas/codings/AvailabilityStatus.yaml
@@ -0,0 +1,19 @@
+type: object
+required:
+ - system
+ - code
+properties:
+ system:
+ type: string
+ enum:
+ - 'https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1'
+ example: 'https://fhir.nhs.uk/STU3/CodeSystem/eRS-AvailabilityStatus-1'
+ code:
+ type: string
+ enum:
+ - AVAILABLE
+ - PENDING
+ - THREATS_FOUND
+ - VALIDATION_FAILED
+ example: AVAILABLE
+
diff --git a/specification/components/stu3/schemas/endpoints/a005-retrieve-referral-request-versioned.yaml b/specification/components/stu3/schemas/endpoints/a005-retrieve-referral-request-versioned.yaml
index 033da1887..7720981cb 100644
--- a/specification/components/stu3/schemas/endpoints/a005-retrieve-referral-request-versioned.yaml
+++ b/specification/components/stu3/schemas/endpoints/a005-retrieve-referral-request-versioned.yaml
@@ -9,19 +9,34 @@ description: |
- Application-restricted access
- Healthcare worker, user-restricted access
- ## Important notes when receiving an e-Referral Pathway Start Date
- The e-Referral Pathway Start Date is a derived value of when the Referral To Treatment (RTT) clock starts. Find out how e-RS derives the pathway start date [[HYPERLINK_PATHWAY_START]].
-
- If a referral was created with an alternate pathway start date, then this will be available in the referral request response.
-
- Service providers must always ensure the correct start date is recorded in line with [[HYPERLINK_RTT_RULES]].
-
## Pre-requisites
The pre-requisites for this endpoint are the same as for endpoint [[HYPERLINK_A005]].
Note: e-RS only supports the retrieval of the most recent version of `ReferralRequest`. You cannot retrieve earlier versions.
+ ## Important notes
+ ### Attachment availability
+
+ In order to retrieve an attachment using the [[HYPERLINK_A042]] (or deprecated [[HYPERLINK_A006]]) endpoint, the attachment must be available for download. Attachments are only made available once an uploaded file has been validated and successfully malware scanned. A request to retrieve an attachment that is not available for download will result in an error being returned. See [[HYPERLINK_A042]] for more information.
+
+ The availability status of an attachment can be retrieved via any endpoint that returns an eRS-AvailabilityStatus-1 code in the success response, including [[HYPERLINK_A005]]. The eRS-AvailabilityStatus-1 code can return one of four possible values, as detailed below.
+
+ | eRS-AvailabilityStatus-1 code | Description / Guidance |
+ |-------------------------------|-------------------------------------------------------------------------------------------------------------------|
+ | AVAILABLE | The file is available for download. |
+ | PENDING | The file is being scanned and cannot be retrieved. Wait at least 5 minutes before checking its availability again |
+ | THREATS FOUND | The file has been quarantined after detecting a threat and cannot be retrieved.
Contact the organisation that uploaded the file to resolve the issue and get the information you need. Use the extensions returned via this endpoint: Extension-eRS-AttachedBy-1 and Extension-eRS-AttachedBy-Organisation-1. |
+ | VALIDATION_FAILED | The file has failed validation and cannot be retrieved.
Contact the organisation that uploaded the file to resolve the issue and get the information you need. Use the extensions returned via this endpoint: Extension-eRS-AttachedBy-1 and Extension-eRS-AttachedBy-Organisation-1. Validation can fail because the: