Skip to content

Commit 7a9800d

Browse files
NIAD-3304: Fix issue with ordering of originalText when mapping to CD XML
* Add test for an unknown code system. * SonarCube fix to remove public modifier on test class. * Fix error in "Medications" test file, where a legacy code contains a space, which is not valid according to the schema.
1 parent 7c44bc2 commit 7a9800d

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,36 @@ void When_MappingCodeableConceptWithNonSnomedCodeSystems_Expect_ManifestedXmlCon
123123
assertThat(outputMessageXml).isEqualToIgnoringWhitespace(expectedOutputXml);
124124
}
125125

126+
@Test
127+
void When_MappingCodeableConceptWithUnknownNonSnomedCodeSystem_Expect_ManifestedXmlDoesNotContainTranslations() {
128+
var inputJson = """
129+
{
130+
"resourceType" : "Observation",
131+
"code": {
132+
"coding": [
133+
{
134+
"system": "http://snomed.info/sct",
135+
"code": "123456",
136+
"display": "Endometriosis of uterus"
137+
},
138+
{
139+
"system": "http://unknown.code/systen",
140+
"code": "UNKNOWN01",
141+
"display": "Unknown Code System Display"
142+
}
143+
]
144+
}
145+
}""";
146+
var expectedOutputXml = """
147+
<code code="123456" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Endometriosis of uterus">
148+
</code>""";
149+
var codeableConcept = fhirParseService.parseResource(inputJson, Observation.class).getCode();
150+
151+
var outputMessageXml = codeableConceptCdMapper.mapCodeableConceptToCd(codeableConcept);
152+
153+
assertThat(outputMessageXml).isEqualToIgnoringWhitespace(expectedOutputXml);
154+
}
155+
126156
@Test
127157
void When_MapToNullFlavorCodeableConceptForAllergyWithoutSnomedCode_Expect_OriginalTextIsNotPresent() {
128158
var inputJson = """

service/src/test/java/uk/nhs/adaptors/gp2gp/utils/CodeSystemUtilTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
import java.util.stream.Stream;
1212

13-
public class CodeSystemUtilTest {
14-
13+
class CodeSystemUtilTest {
1514
private static Stream<Arguments> knownCodeSystems() {
1615
return Stream.of(
1716
Arguments.of("http://snomed.info/sct", "2.16.840.1.113883.2.1.3.2.4.15"),

wiremock/stubs/__files/EMISPatientStructurede2eResponsePWTP3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8817,7 +8817,7 @@
88178817
"coding": [
88188818
{
88198819
"system": "https://fhir.hl7.org.uk/Id/emis-drug-codes",
8820-
"code": "CO2 27587NEMIS",
8820+
"code": "CO227587NEMIS",
88218821
"display": "Coloplast Micro-bag two piece ostomy system urostomy bag 14204 40mm (Coloplast Ltd)",
88228822
"userSelected": true
88238823
},

0 commit comments

Comments
 (0)