Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 55d1123

Browse files
committed
missing concept inclusion now independent of code-system version
Modified the code to only add concepts that are missing based on no other entry with the same system and code existing in the expansion. The previous implementation also compared code-system version resulting in duplicate entries, if the terminology server did not include the version but the definition did or vice versa.
1 parent bc45c30 commit 55d1123

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

  • codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/value_set

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/value_set/MissingEntriesIncluder.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.Set;
44
import java.util.stream.Collectors;
5-
import java.util.stream.Stream;
65

76
import org.hl7.fhir.r4.model.ValueSet;
87
import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
@@ -26,8 +25,7 @@ public ValueSet modifyPostExpansion(ValueSet vsWithComposition, ValueSet vsWithE
2625
&& vsWithComposition.getCompose().getInclude().stream().anyMatch(ConceptSetComponent::hasConcept))
2726
{
2827
Set<String> expandedEntries = vsWithExpansion.getExpansion().getContains().stream()
29-
.map(c -> toEntry(c.getSystem(), c.getVersion(), c.getCode())).distinct()
30-
.collect(Collectors.toSet());
28+
.map(c -> toEntry(c.getSystem(), c.getCode())).distinct().collect(Collectors.toSet());
3129

3230
vsWithComposition.getCompose().getInclude().stream().filter(ConceptSetComponent::hasConcept)
3331
.forEach(include ->
@@ -37,18 +35,13 @@ public ValueSet modifyPostExpansion(ValueSet vsWithComposition, ValueSet vsWithE
3735

3836
include.getConcept().forEach(concept ->
3937
{
40-
if (!expandedEntries.contains(toEntry(system, version, concept.getCode())))
38+
if (!expandedEntries.contains(toEntry(system, concept.getCode()))
39+
&& !expandedEntries.contains(toEntry(system, concept.getCode())))
4140
{
42-
if (version != null)
43-
logger.warn(
44-
"Adding missing concept to ValueSet {}|{}: system: '{}', version: '{}', code: '{}', display: '{}'",
45-
vsWithExpansion.getUrl(), vsWithExpansion.getVersion(), system, version,
46-
concept.getCode(), concept.getDisplay());
47-
else
48-
logger.warn(
49-
"Adding missing concept to ValueSet {}|{}: system: '{}', code: '{}', display: '{}'",
50-
vsWithExpansion.getUrl(), vsWithExpansion.getVersion(), system,
51-
concept.getCode(), concept.getDisplay());
41+
logger.warn(
42+
"Adding missing concept to ValueSet {}|{}: system: '{}', version: '{}', code: '{}', display: '{}'",
43+
vsWithExpansion.getUrl(), vsWithExpansion.getVersion(), system, version,
44+
concept.getCode(), concept.getDisplay());
5245

5346
vsWithExpansion.getExpansion()
5447
.addContains(new ValueSetExpansionContainsComponent().setSystem(system)
@@ -62,8 +55,8 @@ public ValueSet modifyPostExpansion(ValueSet vsWithComposition, ValueSet vsWithE
6255
return vsWithExpansion;
6356
}
6457

65-
private String toEntry(String system, String version, String code)
58+
private String toEntry(String system, String code)
6659
{
67-
return Stream.of(system, version, code).filter(e -> e != null).collect(Collectors.joining());
60+
return system + code;
6861
}
6962
}

0 commit comments

Comments
 (0)