Skip to content

Commit

Permalink
Remove unexplained call to handleObservationStatement (#722)
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 authored Jul 25, 2024
1 parent 0dcafc2 commit 60675ff
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 124 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## Added
* Password percent-encoding has been added to help handle the caeses when password includes special '%' characters
### Fixed
* Resolved issue where the SNOMED import script would reject a password containing a '%' character.
* Fixed some Test Results being given a duplicated `Observation.category` entries for `Laboratory`.

## [3.0.2] - 2024-07-18

## Added
### Added
* If a `ehrComposition` record includes a `confidentialityCode`, the `meta.security` field of the corresponding
`Encounter` FHIR resource will now be [appropriately populated][nopat-docs].
* Add support for an Organization being referenced within the `ReferralRequest.recipient` field.
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 60675ff

Please sign in to comment.