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 @@ -87,7 +87,9 @@
specimens);

String mappedSpecimens = specimens.stream()
.map(specimen -> specimenMapper.mapSpecimenToCompoundStatement(specimen, observationsExcludingFilingComments, diagnosticReport))
.map(specimen -> specimenMapper.mapSpecimenToCompoundStatement(specimen,
observationsForSpecimen(specimen, observationsExcludingFilingComments),
diagnosticReport))
.collect(Collectors.joining());

String reportLevelNarrativeStatements = prepareReportLevelNarrativeStatements(diagnosticReport, observations);
Expand All @@ -113,6 +115,13 @@
);
}

private List<Observation> observationsForSpecimen(Specimen specimen, List<Observation> observations) {
return observations.stream()
.filter(Observation::hasSpecimen)

Check warning on line 120 in service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/diagnosticreport/DiagnosticReportMapper.java

View workflow job for this annotation

GitHub Actions / pitest

A change can be made to line 120 without causing a test to fail

removed call to filter (covered by 29 tests RemoveFilterMutator)
.filter(observation -> observation.getSpecimen().getReference().equals(specimen.getId()))
.collect(Collectors.toList());
}

private String fetchExtensionId(List<Identifier> identifiers) {
return identifiers.stream()
.filter(DiagnosticReportMapper::isPMIPCodeSystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void When_MappingDefaultSpecimenWithObservation_Expect_DefaultSpecimenAndObserva
final String actualXml = specimenMapper.mapSpecimenToCompoundStatement(
specimen, observations, DIAGNOSTIC_REPORT);

assertThat(actualXml).isEqualTo(expectedXml);
assertThat(actualXml).isEqualToIgnoringWhitespace(expectedXml);
}

@Test
Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was made because the Observation referenced had a specimen referenced that was NOT included in the diagnostic report. The new referenced observation had no specimen referenced at all (Which is what the test is intended to test).

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"reference": "Observation/FILING-COMMENT-WITH-NO-COMMENT"
},
{
"reference": "Observation/6E30A9E3-FF9A-4868-8FCD-7DAC26A16E78"
"reference": "Observation/TestResult-WithoutSpecimenReference"
}
]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation used for this test was changed, see comment

Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
</specimenRole>
</specimen>
<component typeCode="COMP" contextConductionInd="true">
<CompoundStatement classCode="CLUSTER" moodCode="EVN">
<id root="II-for-Observation-Observation/6E30A9E3-FF9A-4868-8FCD-7DAC26A16E78"/>
<ObservationStatement classCode="OBS" moodCode="EVN">
<id root="II-for-Observation-Observation/TestResult-WithoutSpecimenReference"/>
<code nullFlavor="UNK">
<originalText>Mocked code</originalText>
</code>
Expand All @@ -78,46 +78,19 @@
<center value="20100223"/>
</effectiveTime>
<availabilityTime value="20100223"/>
<component typeCode="COMP" contextConductionInd="true">
<ObservationStatement classCode="OBS" moodCode="EVN">
<id root="5E496953-065B-41F2-9577-BE8F2FBD0757"/>
<code nullFlavor="UNK">
<originalText>Mocked code</originalText>
</code>
<statusCode code="COMPLETE"/>
<effectiveTime>
<center value="20100223"/>
</effectiveTime>
<availabilityTime value="20100223"/>
<value xsi:type="PQ" value="8.800" unit="1">
<translation value="8.800">
<originalText>mmol/L</originalText>
</translation>
</value>
<referenceRange typeCode="REFV">
<referenceInterpretationRange classCode="OBS" moodCode="EVN.CRT">
<value>
<low value="10.000"/>
<high value="90.000"/>
</value>
</referenceInterpretationRange>
</referenceRange>

</ObservationStatement>
</component>
<component typeCode="COMP" contextConductionInd="true">
<NarrativeStatement classCode="OBS" moodCode="EVN">
<id root="II-for-Observation-Observation/6E30A9E3-FF9A-4868-8FCD-7DAC26A16E78-COMM"/>
<text mediaType="text/x-h7uk-pmip">CommentType:USER COMMENT
CommentDate:20201215151713
</ObservationStatement>
</component>
<component typeCode="COMP" contextConductionInd="true">
<NarrativeStatement classCode="OBS" moodCode="EVN">
<id root="5E496953-065B-41F2-9577-BE8F2FBD0757"/>
<text mediaType="text/x-h7uk-pmip">CommentType:AGGREGATE COMMENT SET
CommentDate:20100223

(q) - Normal - No Action
</text>
<statusCode code="COMPLETE"/>
<availabilityTime value="20201215151713"/>
</NarrativeStatement>
</component>
</CompoundStatement>
This is a test result without a specimen.
</text>
<statusCode code="COMPLETE"/>
<availabilityTime value="20100223"/>
</NarrativeStatement>
</component>
</CompoundStatement>
</component>
Expand Down
Loading