Skip to content

Commit f94ccb9

Browse files
committed
Real observations with a dummy specimen won't get assigned another dummy observation to the specimen.
1 parent a4899a2 commit f94ccb9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public class DiagnosticReportMapper {
7777
public String mapDiagnosticReportToCompoundStatement(DiagnosticReport diagnosticReport) {
7878
List<Observation> observations = fetchObservations(diagnosticReport);
7979
List<Specimen> specimens = fetchSpecimens(diagnosticReport, observations);
80-
observations = addDummyObservationsToObservationList(observations, specimens, diagnosticReport);
8180
final IdMapper idMapper = messageContext.getIdMapper();
8281
markObservationsAsProcessed(idMapper, observations);
8382

@@ -87,9 +86,13 @@ public String mapDiagnosticReportToCompoundStatement(DiagnosticReport diagnostic
8786
.toList(),
8887
specimens);
8988

89+
observations = addDummyObservationsToObservationList(observationsExcludingFilingComments, specimens, diagnosticReport);
90+
91+
List<Observation> finalObservations = observations;
92+
9093
String mappedSpecimens = specimens.stream()
9194
.map(specimen -> specimenMapper.mapSpecimenToCompoundStatement(specimen,
92-
observationsForSpecimen(specimen, observationsExcludingFilingComments),
95+
observationsForSpecimen(specimen, finalObservations),
9396
diagnosticReport))
9497
.collect(Collectors.joining());
9598

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-no-specimen.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@
9292
<availabilityTime value="20100223"/>
9393
</NarrativeStatement>
9494
</component>
95+
<component typeCode="COMP" contextConductionInd="true">
96+
<NarrativeStatement classCode="OBS" moodCode="EVN">
97+
<id
98+
root="II-for-Observation-DUMMY-OBSERVATION-5E496953-065B-41F2-9577-BE8F2FBD0757" />
99+
<text mediaType="text/x-h7uk-pmip">CommentType:AGGREGATE COMMENT SET
100+
CommentDate:UNK
101+
102+
EMPTY REPORT</text>
103+
<statusCode code="COMPLETE" />
104+
<availabilityTime nullFlavor="UNK" />
105+
</NarrativeStatement>
106+
</component>
95107
</CompoundStatement>
96108
</component>
97109
<Participant typeCode="AUT" contextControlCode="OP">

0 commit comments

Comments
 (0)