Skip to content

Commit b4e2033

Browse files
author
Adrian Clay
authored
Use common DiagnosticReport.isFilingComment in ObservationMapper (#961)
This method has a clear name describing what it does, and is documented.
1 parent 9f1a3a8 commit b4e2033

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package uk.nhs.adaptors.gp2gp.ehr.mapper.diagnosticreport;
22

33
import static uk.nhs.adaptors.gp2gp.ehr.mapper.diagnosticreport.DiagnosticReportMapper.DUMMY_OBSERVATION_ID_PREFIX;
4-
import static uk.nhs.adaptors.gp2gp.ehr.utils.CodeableConceptMappingUtils.hasCode;
54

65
import java.util.List;
76
import java.util.Objects;
@@ -74,8 +73,6 @@ public class ObservationMapper {
7473
private static final String RANGE_LOW_PREFIX = "Low: ";
7574
private static final String RANGE_HIGH_PREFIX = "High: ";
7675

77-
private static final String COMMENT_NOTE_CODE = "37331000000100";
78-
7976
private static final String HL7_UNKNOWN_VALUE = "UNK";
8077
private static final String HAS_MEMBER_TYPE = "HASMEMBER";
8178

@@ -364,7 +361,7 @@ private Optional<String> prepareNarrativeStatementForRelatedObservationComments(
364361
}
365362

366363
private CommentType prepareCommentType(Observation observation) {
367-
return hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE))
364+
return DiagnosticReportMapper.isFilingComment(observation)
368365
? CommentType.USER_COMMENT : CommentType.AGGREGATE_COMMENT_SET;
369366
}
370367

@@ -483,7 +480,7 @@ private DateTimeType resolveEffectiveDateTimeType(Observation observation) {
483480
}
484481

485482
private boolean observationHasNonCommentNoteCode(Observation observation) {
486-
return observation.hasCode() && !hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE));
483+
return observation.hasCode() && !DiagnosticReportMapper.isFilingComment(observation);
487484
}
488485

489486
private String prepareCodeElement(Observation observation) {
@@ -546,7 +543,7 @@ private boolean hasValidType(Observation.ObservationRelatedComponent observation
546543
}
547544

548545
private boolean hasValidComment(Observation observation) {
549-
return observation.hasComment() && hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE));
546+
return observation.hasComment() && DiagnosticReportMapper.isFilingComment(observation);
550547
}
551548

552549
private MultiStatementObservationHolder createHolder(Observation observationAssociatedWithSpecimen) {

0 commit comments

Comments
 (0)