-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NAID-3122 - Add confidentialityCode
support to AllergyIntoleranceMapper.java
#684
Merged
Merged
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
bc81bbb
[NIAD-3122] Add Predicate to ObservationUtil.java
martin-nhs 3412917
[NIAD-3122] Add initial mapping logic
martin-nhs 4048e51
[NIAD-3122] Add initial mapping logic
martin-nhs e5e2e2d
[NIAD-3122] Add CodingFactory.java
martin-nhs e0ccec5
[NIAD-3122] Add comment
martin-nhs 5031d45
[NIAD-3122] Refactor ResourceUtil.java
martin-nhs baabb6c
[NIAD-3122] Refactor ResourceUtil.java
martin-nhs 474ead4
[NIAD-3122] Refactor ResourceUtil.java
martin-nhs d8180ad
[NIAD-3122] Refactor ResourceUtil.java
martin-nhs d627092
[NIAD-3122] Add unit tests
martin-nhs e2be282
[NIAD-3122] Refactor unit tests
martin-nhs 539e038
[NIAD-3122] Refactor unit tests
martin-nhs a0e927f
[NIAD-3122] Update CHANGELOG.md
martin-nhs 489e9f8
Merge branch 'main' into NIAD-3122
martin-nhs 3d5eaca
[NIAD-3122] Address Checkstyle violations
martin-nhs 73c5b51
[NIAD-3122] Added unit test and refactored names
martin-nhs 2adf5de
[NIAD-3122] Added util
martin-nhs 74707fa
[NIAD-3122] Refactor unit test
martin-nhs f987daa
[NIAD-3122] Refactor resource util
martin-nhs 81b1d54
[NIAD-3122] Refactor AllergyIntoleranceMapper.java
martin-nhs e94ca54
[NIAD-3122] Refactor method name
martin-nhs 9d06ea3
[NIAD-3122] Removed unused predicate
martin-nhs 0834fe8
[NIAD-3122] Refactored ObservationUtil.java
martin-nhs 71216c8
[NIAD-3122] Removed CodingFactory.java
martin-nhs 7b68ab0
[NIAD-3122] Refactor ConfidentialityUtil.java
martin-nhs b9955d3
[NIAD-3122] Refactor unit tests
martin-nhs 54df5ac
[NIAD-3122] Add enhancement, add unit tests
martin-nhs 9204ff1
[NIAD-3122] Add unit test for ConfidentialityUtilTest.java
martin-nhs b818277
[NIAD-3122] Add fluent api for interacting with meta
martin-nhs 6481b08
[NIAD-3122] Remove unnecessary refactor
martin-nhs 0258ca0
[NIAD-3122] Refactor ConfidentialityUtilTest.java
martin-nhs c105f9f
[NIAD-3122] Address Checkstyle violations
martin-nhs 9db6db0
Merge branch 'main' into NIAD-3122
martin-nhs 1f6fe39
[NIAD-3122] Address Spotbugs issue, add enhancements.
martin-nhs f7c68e8
[NIAD-3122] Remove unused import
martin-nhs 0e9e21a
[NIAD-3122] Address PR comment https://github.com/NHSDigital/nia-pati…
martin-nhs 96c9a28
[NIAD-3122] Address checkstyle violations
martin-nhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/util/ConfidentialityUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package uk.nhs.adaptors.pss.translator.util; | ||
|
||
import org.hl7.fhir.dstu3.model.Coding; | ||
import org.hl7.fhir.dstu3.model.Meta; | ||
import org.hl7.v3.CV; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Optional; | ||
|
||
public final class ConfidentialityUtil { | ||
|
||
private ConfidentialityUtil() { } | ||
|
||
private static final Coding CONFIDENTIALITY_CODING = new Coding() | ||
.setSystem("http://hl7.org/fhir/v3/ActCode") | ||
.setCode("NOPAT") | ||
.setDisplay("no disclosure to patient, family or caregivers without attending provider's authorization"); | ||
|
||
public static Meta addSecurityToMetaIfConfidentialityCodesPresent(Collection<Optional<CV>> confidentialityCodes, Meta meta) { | ||
final boolean isCodePresent = confidentialityCodes.stream() | ||
.filter(Optional::isPresent) | ||
.map(Optional::get) | ||
.anyMatch(ConfidentialityUtil::isNopat); | ||
|
||
if (isCodePresent) { | ||
return ConfidentialityUtil.addConfidentialityToMeta(meta); | ||
} | ||
|
||
return meta; | ||
} | ||
|
||
private static Meta addConfidentialityToMeta(final Meta meta) { | ||
return meta.setSecurity( | ||
Collections.singletonList( | ||
CONFIDENTIALITY_CODING | ||
) | ||
); | ||
} | ||
|
||
private static boolean isNopat(CV coding) { | ||
return coding.getCode().equals("NOPAT"); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/util/builder/MetaBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package uk.nhs.adaptors.pss.translator.util.builder; | ||
|
||
import org.hl7.fhir.dstu3.model.Meta; | ||
import org.hl7.v3.CV; | ||
import uk.nhs.adaptors.pss.translator.util.ConfidentialityUtil; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.function.Supplier; | ||
|
||
public final class MetaBuilder { | ||
private Meta meta; | ||
|
||
public MetaBuilder withInitialMeta(final Supplier<Meta> metaSupplier) { | ||
this.meta = Objects.requireNonNull(metaSupplier.get()); | ||
return this; | ||
} | ||
|
||
@SafeVarargs | ||
public final MetaBuilder withSecurityIfConfidentialityCodesPresent(Optional<CV>... confidentialityCodes) { | ||
this.meta = ConfidentialityUtil.addSecurityToMetaIfConfidentialityCodesPresent( | ||
Arrays.asList(confidentialityCodes), | ||
this.meta | ||
); | ||
|
||
return this; | ||
} | ||
|
||
public Meta build() { | ||
return this.meta.copy(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to break a line after line 11 otherwise it is very difficult to read such a class.
Also, it would be good to have a line break between the constructor and the static variable.