Skip to content

Commit

Permalink
Remove unexplained call to handleObservationStatement
Browse files Browse the repository at this point in the history
A BATTERY CompoundStatement can only have two types of component
inside it according to the GP2GP specification. These are:

- A CLUSTER CompoundStatement
- An ObservationStatement

The existing code within handleBatteryCompoundStatement deals with
each of those cases already. The additional code removed in this
change appears to deal with any type of CompoundStatement. Given
that the only CompoundStatement which is valid to appear here is
a CLUSTER, and the code for handleClusterCompoundStatement already
calls handleObservationStatement, there is no point to this code.

By removing this duplicate call to handleObservationStatement we
also fix the issue where Observations are being generated with
two identical "category" values of "Laboratory".

Furthermore, this code is completely untested. It is a liability in
its current state, so the removal of it reduces the chance of it
breaking and introducing more unwelcome unintended side-effects.
  • Loading branch information
adrianclay committed Jul 25, 2024
1 parent 24e3857 commit 95135d6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 121 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

### Fixed

* Fixed some Test Results being given a duplicated `Observation.category` entries for `Laboratory`.

## [3.0.2] - 2024-07-18

## Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4129,12 +4129,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4190,12 +4184,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4251,12 +4239,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4312,12 +4294,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4373,12 +4349,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4434,12 +4404,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4495,12 +4459,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4556,12 +4514,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4617,12 +4569,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4678,12 +4624,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4739,12 +4679,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -4800,12 +4734,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -5288,12 +5216,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -6606,12 +6528,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -6901,12 +6817,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -9147,12 +9057,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down Expand Up @@ -9213,12 +9117,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22958,12 +22958,6 @@
"code": "laboratory",
"display": "Laboratory"
} ]
}, {
"coding": [ {
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
} ]
} ],
"code": {
"coding": [ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,6 @@ private void handleBatteryCompoundStatement(RCMRMT030101UKCompoundStatement spec
);
}

batteryCompoundStatement.getComponent().stream()
.filter(RCMRMT030101UKComponent02::hasCompoundStatement)
.map(RCMRMT030101UKComponent02::getCompoundStatement)
.forEach(compoundStatement -> compoundStatement.getComponent().stream()
.filter(RCMRMT030101UKComponent02::hasObservationStatement)
.map(RCMRMT030101UKComponent02::getObservationStatement)
.findFirst()
.ifPresent(
observationStatement -> getObservationById(observations, observationStatement.getId().getRoot()).ifPresent(
observation -> handleObservationStatement(specimenCompoundStatement, observationStatement, observation)
)
));

var observationStatements = batteryCompoundStatement.getComponent().stream()
.filter(RCMRMT030101UKComponent02::hasObservationStatement)
.map(RCMRMT030101UKComponent02::getObservationStatement)
Expand Down

0 comments on commit 95135d6

Please sign in to comment.