Skip to content

Commit ff874f7

Browse files
NIAD-3294 - Allow RequestStatementMapper to handle updated UBRN system URL (#1249)
* NIAD-3294 - Allow RequestStatementMapper to handle updated UBRN system URL * Changing Changelog * Empty-Commit * * Lower arcmutate:base gradle plugin version due to PiTest exceptions around class not found internally --------- Co-authored-by: MartinWheelerMT <[email protected]>
1 parent 1e3823f commit ff874f7

File tree

7 files changed

+79
-8
lines changed

7 files changed

+79
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
* The GP2GP Adaptor now populates the ObservationStatement / confidentialityCode field when the .meta.security field of an Uncategorised Data Observation contains NOPAT
1212
* When List.meta.security field contains NOPAT, the GP2GP Adaptor will now populate the CompoundStatement.confidentialityCode
1313

14+
### Update
15+
* The GP2GP Adaptor is now able to identify e-referrals by using either `https://fhir.nhs.uk/Id/ubr-number` or `https://fhir.nhs.uk/Id/UBRN` when provided as an identifier system URL.
16+
1417

1518
## [2.4.0] - 2025-04-02
1619

service/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010

1111
// Mutation testing
1212
id 'info.solidsoft.pitest' version '1.15.0'
13-
id 'com.arcmutate.github' version '2.2.2'
13+
id 'com.arcmutate.github' version '2.2.1'
1414
}
1515

1616
apply plugin: 'java'
@@ -73,8 +73,8 @@ dependencies {
7373
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
7474
testImplementation 'io.findify:s3mock_2.13:0.2.6'
7575

76-
pitest 'com.arcmutate:base:1.4.2'
77-
pitest 'com.arcmutate:pitest-git-plugin:2.2.3'
76+
pitest 'com.arcmutate:base:1.3.2'
77+
pitest 'com.arcmutate:pitest-git-plugin:2.1.0'
7878
}
7979

8080
test {

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/RequestStatementMapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
public class RequestStatementMapper {
4747
private static final Mustache REQUEST_STATEMENT_TEMPLATE = TemplateUtils.loadTemplate("ehr_request_statement_template.mustache");
4848

49-
private static final String UBRN_SYSTEM_URL = "https://fhir.nhs.uk/Id/ubr-number";
49+
private static final String UBRN_SYSTEM_URL = "https://fhir.nhs.uk/Id/UBRN";
50+
private static final String UBR_NUMBER_SYSTEM_URL = "https://fhir.nhs.uk/Id/ubr-number";
5051
private static final String REQUESTER_DEVICE = "Requester Device: ";
5152
private static final String REQUESTER_PATIENT = "Requester: Patient";
5253
private static final String REQUESTER_ORG = "Requester Org: ";
@@ -173,7 +174,7 @@ private String buildIdentifierDescription() {
173174
.map(ReferralRequest::getIdentifier)
174175
.flatMap(List::stream)
175176
.filter(Objects::nonNull)
176-
.filter(val -> UBRN_SYSTEM_URL.equals(val.getSystem()))
177+
.filter(val -> UBRN_SYSTEM_URL.equals(val.getSystem()) || UBR_NUMBER_SYSTEM_URL.equals(val.getSystem()))
177178
.map(Identifier::getValue)
178179
.findAny()
179180
.map(UBRN::concat)

service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/mapper/RequestStatementMapperTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public class RequestStatementMapperTest {
123123
+ "example-referral-request-supportingInfo-with-ignored-resources.json";
124124
private static final String INPUT_JSON_WITH_NO_AUTHOR_AND_TIME = TEST_FILE_DIRECTORY
125125
+ "example-referral-request-no-author-and-time.json";
126-
126+
private static final String INPUT_JSON_WITH_WITH_UBR_NUMBER_SYSTEM_URL = TEST_FILE_DIRECTORY
127+
+ "example-referral-request-with-ubr-number-system-url.json";
128+
private static final String INPUT_JSON_WITH_WITH_UBRN_SYSTEM_URL = TEST_FILE_DIRECTORY
129+
+ "example-referral-request-with-ubrn-system-url.json";
127130

128131
// OUTPUT FILES
129132
private static final String OUTPUT_XML_USES_NO_OPTIONAL_FIELDS = TEST_FILE_DIRECTORY
@@ -190,6 +193,8 @@ public class RequestStatementMapperTest {
190193
+ "expected-output-request-statement-no-supportingInfo.xml";
191194
private static final String OUTPUT_XML_WITH_NO_AUTHOR_AND_TIME = TEST_FILE_DIRECTORY
192195
+ "expected-output-request-statement-no-author-and-time.xml";
196+
private static final String OUTPUT_XML_WITH_SYSTEM_URL = TEST_FILE_DIRECTORY
197+
+ "expected-output-request-for-system-url.xml";
193198

194199
@Mock
195200
private CodeableConceptCdMapper codeableConceptCdMapper;
@@ -225,7 +230,7 @@ private static Stream<Arguments> resourceFileParams() {
225230
arguments(INPUT_JSON_WITH_ROUTINE_PRIORITY, OUTPUT_XML_WITH_NORMAL_PRIORITY),
226231
arguments(INPUT_JSON_WITH_URGENT_PRIORITY, OUTPUT_XML_WITH_HIGH_PRIORITY),
227232
arguments(INPUT_JSON_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE,
228-
OUTPUT_XML_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE),
233+
OUTPUT_XML_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE),
229234
arguments(INPUT_JSON_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE_NO_DESCRIPTION,
230235
OUTPUT_XML_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE_NO_DESCRIPTION),
231236
arguments(INPUT_JSON_WITH_SUPPORTINGINFO_DOCUMENTREFERENCE_NO_CREATED_NO_TEXT,
@@ -252,7 +257,9 @@ private static Stream<Arguments> resourceFileParams() {
252257
OUTPUT_XML_WITH_SUPPORTINGINFO_MEDICATIONREQUEST_NO_DATE),
253258
arguments(INPUT_JSON_WITH_SUPPORTINGINFO_IGNORED_RESOURCES,
254259
OUTPUT_XML_WITH_NO_SUPPORTINGINFO),
255-
arguments(INPUT_JSON_WITH_NO_AUTHOR_AND_TIME, OUTPUT_XML_WITH_NO_AUTHOR_AND_TIME)
260+
arguments(INPUT_JSON_WITH_NO_AUTHOR_AND_TIME, OUTPUT_XML_WITH_NO_AUTHOR_AND_TIME),
261+
arguments(INPUT_JSON_WITH_WITH_UBR_NUMBER_SYSTEM_URL, OUTPUT_XML_WITH_SYSTEM_URL),
262+
arguments(INPUT_JSON_WITH_WITH_UBRN_SYSTEM_URL, OUTPUT_XML_WITH_SYSTEM_URL)
256263
);
257264
}
258265

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"resourceType": "ReferralRequest",
3+
"id": "E63AF323-919F-4D5F-9A1D-BA933BC230BC",
4+
"description": "Referred for investigation into low blood pressure",
5+
"specialty": {
6+
"coding": [
7+
{
8+
"system": "http://hl7.org/fhir/v3/NullFlavor",
9+
"code": "UNK",
10+
"display": "unknown"
11+
}
12+
]
13+
},
14+
"identifier": [
15+
{
16+
"system": "https://fhir.nhs.uk/Id/cross-care-setting-identifier",
17+
"value": "B154D1A3-D631-49BD-8B67-2F76D7D85865"
18+
},
19+
{
20+
"system": "https://fhir.nhs.uk/Id/ubr-number",
21+
"value": "bb2378b6-dde2-11e9-9d36-2a2ae2dbcce4"
22+
}
23+
]
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"resourceType": "ReferralRequest",
3+
"id": "E63AF323-919F-4D5F-9A1D-BA933BC230BC",
4+
"description": "Referred for investigation into low blood pressure",
5+
"specialty": {
6+
"coding": [
7+
{
8+
"system": "http://hl7.org/fhir/v3/NullFlavor",
9+
"code": "UNK",
10+
"display": "unknown"
11+
}
12+
]
13+
},
14+
"identifier": [
15+
{
16+
"system": "https://fhir.nhs.uk/Id/cross-care-setting-identifier",
17+
"value": "B154D1A3-D631-49BD-8B67-2F76D7D85865"
18+
},
19+
{
20+
"system": "https://fhir.nhs.uk/Id/UBRN",
21+
"value": "bb2378b6-dde2-11e9-9d36-2a2ae2dbcce4"
22+
}
23+
]
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<component typeCode="COMP" >
2+
<RequestStatement classCode="OBS" moodCode="RQO">
3+
<id root="II-for-ReferralRequest-E63AF323-919F-4D5F-9A1D-BA933BC230BC" />
4+
<code code="3457005" displayName="Patient referral" codeSystem="2.16.840.1.113883.2.1.3.2.4.15"/>
5+
<text>UBRN: bb2378b6-dde2-11e9-9d36-2a2ae2dbcce4 Specialty: unknown Referred for investigation into low blood pressure</text>
6+
<statusCode code="COMPLETE"/>
7+
<effectiveTime>
8+
<center nullFlavor="NI"/>
9+
</effectiveTime>
10+
<availabilityTime nullFlavor="UNK"/>
11+
</RequestStatement>
12+
</component>

0 commit comments

Comments
 (0)