Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class CodeableConceptCdMapperTest {
private static final String TEST_FILE_DIRECTORY = "/ehr/mapper/codeableconcept/";
private static final String TEST_FILE_DIRECTORY_NULL_FLAVOR = "/ehr/mapper/codeableconcept/nullFlavor/";
private static final String TEST_FILE_DIRECTORY_ACTUAL_PROBLEM = "/ehr/mapper/codeableconcept/actualProblem/";
private static final String TEST_FILE_DIRECTORY_ALLERGY_CLINICAL_STATUS = "/ehr/mapper/codeableconcept/allergyClinicalStatus/";
private static final String TEST_FILE_DIRECTORY_ALLERGY_RESOLVED = "/ehr/mapper/codeableconcept/allergyResolved/";
private static final String TEST_FILE_DIRECTORY_ALLERGY_ACTIVE = "/ehr/mapper/codeableconcept/allergyActive/";
private static final String TEST_FILE_DIRECTORY_MEDICATION = "/ehr/mapper/codeableconcept/medication/";

private static final String TEST_FILE_TOPIC_RELATED_CONDITION = TEST_FILE_DIRECTORY
Expand Down Expand Up @@ -54,8 +55,12 @@ private static Stream<Arguments> getTestArgumentsActualProblem() {
return TestArgumentsLoaderUtil.readTestCases(TEST_FILE_DIRECTORY_ACTUAL_PROBLEM);
}

private static Stream<Arguments> getTestArgumentsAllergyClinicalStatus() {
return TestArgumentsLoaderUtil.readTestCases(TEST_FILE_DIRECTORY_ALLERGY_CLINICAL_STATUS);
private static Stream<Arguments> getTestArgumentsAllergyResolved() {
return TestArgumentsLoaderUtil.readTestCases(TEST_FILE_DIRECTORY_ALLERGY_RESOLVED);
}

private static Stream<Arguments> getTestArgumentsAllergyActive() {
return TestArgumentsLoaderUtil.readTestCases(TEST_FILE_DIRECTORY_ALLERGY_ACTIVE);
}

private static Stream<Arguments> getTestArgumentsMedication() {
Expand Down Expand Up @@ -151,15 +156,30 @@ public void When_MappingStubbedCodeableConceptAsNullFlavor_Expect_HL7CdObjectXml
}

@ParameterizedTest
@MethodSource("getTestArgumentsAllergyClinicalStatus")
public void When_MappingStubbedCodeableConceptAsAllergy_Expect_HL7CdObjectXml(String inputJson, String outputXml)
throws IOException {
@MethodSource("getTestArgumentsAllergyResolved")
void When_MappingStubbedCodeableConceptAsResolvedAllergy_Expect_HL7CdObjectXml(String inputJson, String outputXml) {
var allergyCodeableConcept = ResourceTestFileUtils.getFileContent(inputJson);
var expectedOutput = ResourceTestFileUtils.getFileContent(outputXml);
var codeableConcept = fhirParseService.parseResource(allergyCodeableConcept, AllergyIntolerance.class).getCode();

var outputMessage = codeableConceptCdMapper.mapCodeableConceptToCdForAllergy(codeableConcept,
AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED);

assertThat(outputMessage)
.describedAs(TestArgumentsLoaderUtil.FAIL_MESSAGE, inputJson, outputXml)
.isEqualToIgnoringWhitespace(expectedOutput);
}

@ParameterizedTest
@MethodSource("getTestArgumentsAllergyActive")
void When_MappingStubbedCodeableConceptAsActiveAllergy_Expect_HL7CdObjectXml(String inputJson, String outputXml) {
var allergyCodeableConcept = ResourceTestFileUtils.getFileContent(inputJson);
var expectedOutput = ResourceTestFileUtils.getFileContent(outputXml);
var codeableConcept = fhirParseService.parseResource(allergyCodeableConcept, AllergyIntolerance.class).getCode();

var outputMessage = codeableConceptCdMapper.mapCodeableConceptToCdForAllergy(codeableConcept,
AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE);

assertThat(outputMessage)
.describedAs(TestArgumentsLoaderUtil.FAIL_MESSAGE, inputJson, outputXml)
.isEqualToIgnoringWhitespace(expectedOutput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,25 @@
],
"code": {
"coding": [
{
"system": "http://read.info/readv2",
"code": "TJ00800",
"display": "Adverse reaction to pivampicillin rt",
"userSelected": true
},
{
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
"extension": [
{
"url": "descriptionId",
"valueId": "2164497013"
"valueId": "442108015"
},
{
"url": "descriptionDisplay",
"valueString": "Chocolate allergy"
}
]
}
],
"system": "http://snomed.info/sct",
"code": "292971006",
"display": "Pivampicillin adverse reaction pt"
"code": "300912001",
"display": "Allergy to chocolate"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<code code="442108015" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Allergy to chocolate">
<originalText>Chocolate allergy</originalText>
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"resourceType": "AllergyIntolerance",
"id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
]
},
"identifier": [
{
"system": "https://EMISWeb/A82038",
"value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "unconfirmed",
"category": [
"medication"
],
"code": {
"coding": [
{
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
"extension": [
{
"url": "descriptionId",
"valueId": "442108015"
}
]
}
],
"system": "http://snomed.info/sct",
"code": "300912001",
"display": "Allergy to chocolate"
}
]
},
"patient": {
"reference": "Patient/55D2363D-57A2-48F4-9A74-5B2E03F5E93D"
},
"assertedDate": "2019-01-28T13:43:36.107+00:00",
"recorder": {
"reference": "Practitioner/2DB481A3-306A-4133-9491-1558161D6A2B"
},
"note": [
{
"text": "allergy with no date recorded"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<code code="442108015" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Allergy to chocolate">
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"resourceType": "AllergyIntolerance",
"id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
]
},
"identifier": [
{
"system": "https://EMISWeb/A82038",
"value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "unconfirmed",
"category": [
"medication"
],
"code": {
"coding": [
{
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
"extension": [
{
"url": "descriptionId",
"valueId": "442108015"
}
]
}
],
"system": "http://snomed.info/sct",
"code": "300912001",
"display": "Allergy to chocolate"
}
],
"text": "Chocolate Allergy"
},
"patient": {
"reference": "Patient/55D2363D-57A2-48F4-9A74-5B2E03F5E93D"
},
"assertedDate": "2019-01-28T13:43:36.107+00:00",
"recorder": {
"reference": "Practitioner/2DB481A3-306A-4133-9491-1558161D6A2B"
},
"note": [
{
"text": "allergy with no date recorded"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<code code="442108015" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Allergy to chocolate">
<originalText>Chocolate Allergy</originalText>
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"resourceType": "AllergyIntolerance",
"id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
]
},
"identifier": [
{
"system": "https://EMISWeb/A82038",
"value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "unconfirmed",
"category": [
"medication"
],
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "292971006",
"display": "Pivampicillin adverse reaction pt"
}
]
},
"patient": {
"reference": "Patient/55D2363D-57A2-48F4-9A74-5B2E03F5E93D"
},
"assertedDate": "2019-01-28T13:43:36.107+00:00",
"recorder": {
"reference": "Practitioner/2DB481A3-306A-4133-9491-1558161D6A2B"
},
"note": [
{
"text": "allergy with no date recorded"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<code code="292971006" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Pivampicillin adverse reaction pt">
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"resourceType": "AllergyIntolerance",
"id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
]
},
"identifier": [
{
"system": "https://EMISWeb/A82038",
"value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "unconfirmed",
"category": [
"medication"
],
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "292971006",
"display": "Pivampicillin adverse reaction pt"
}
],
"text": "Pivampicillin adverse reaction"
},
"patient": {
"reference": "Patient/55D2363D-57A2-48F4-9A74-5B2E03F5E93D"
},
"assertedDate": "2019-01-28T13:43:36.107+00:00",
"recorder": {
"reference": "Practitioner/2DB481A3-306A-4133-9491-1558161D6A2B"
},
"note": [
{
"text": "allergy with no date recorded"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<code code="292971006" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Pivampicillin adverse reaction pt">
<originalText>Pivampicillin adverse reaction</originalText>
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"resourceType": "AllergyIntolerance",
"id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
]
},
"identifier": [
{
"system": "https://EMISWeb/A82038",
"value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
}
],
"clinicalStatus": "resolved",
"verificationStatus": "unconfirmed",
"category": [ "medication" ],
"code": {
"coding": [
{
"system": "http://read.info/readv2",
"code": "TJ00800",
"display": "Adverse reaction to pivampicillin rt",
"userSelected": true
}
]
},
"patient": {
"reference": "Patient/55D2363D-57A2-48F4-9A74-5B2E03F5E93D"
},
"assertedDate": "2019-01-28T13:43:36.107+00:00",
"recorder": {
"reference": "Practitioner/2DB481A3-306A-4133-9491-1558161D6A2B"
},
"note": [
{
"text": "allergy with no date recorded"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<code nullFlavor="UNK">
</code>
Loading