Skip to content

Commit

Permalink
RAP-85 Allow exporting ModuleDependency for Derivative modules
Browse files Browse the repository at this point in the history
  • Loading branch information
QuyenLy87 committed Jun 18, 2024
1 parent aab5054 commit 900164c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public class ModuleDependencyService extends ComponentService {
@Lazy
private ReferenceSetMemberService refsetService;

@Value("${mdrs.exclude.derivative-modules}")
private boolean excludeDerivativeModules;

@Value("#{'${mdrs.blocklist}'.split('\\s*,\\s*')}") //Split and trim spaces
private List<String> blockListedModules;

Expand All @@ -73,10 +70,6 @@ public class ModuleDependencyService extends ComponentService {
private long cacheValidAt = 0L;
private Set<String> cachedInternationalModules;

//Derivative modules are those belonging with the International Edition (like the GPS)
//but not packaged with it, so not included eg in the US Edition
private Set<String> derivativeModules;

//Refresh when the HEAD time is greater than the HEAD time on MAIN
//Check every 30 mins to save time when export operation actually called
@Scheduled(fixedDelay = 1800_000, initialDelay = 180_000)
Expand All @@ -97,12 +90,6 @@ public synchronized void refreshCache() {
if (!cachedInternationalModules.contains(Concepts.ICD10_MODULE)) {
SI_MODULES.remove(Concepts.ICD10_MODULE);
}

derivativeModules = cachedInternationalModules.stream()
.filter(m -> !SI_MODULES.contains(m))
.collect(Collectors.toSet());

logger.info("{} derivative modules set to be {} in MDRS export.", derivativeModules.size(), (excludeDerivativeModules?"excluded":"included"));
}
}

Expand Down Expand Up @@ -350,7 +337,7 @@ private String determineClosestParentFromExistingHierarchy(String module, List<S

List<String> ancestors = findAncestorModules(module, selfMappedModules, moduleMap.get(module));
//If we only see a single ancestor, that's our closest parent
if (ancestors.size() == 0) {
if (ancestors.isEmpty()) {
return module;
} else if (ancestors.size() == 1) {
return ancestors.get(0);
Expand Down Expand Up @@ -525,17 +512,11 @@ private Map<String, String> getModuleOfModule(String branchPath, Set<String> mod

public boolean isExportable(ReferenceSetMember rm, boolean isExtension) {
//Extensions don't list dependencies of core modules
if (isExtension && SI_MODULES.contains(rm.getModuleId())) {
return false;
}
if (excludeDerivativeModules && derivativeModules.contains(rm.getModuleId())) {
return false;
}

if (blockListedModules != null && blockListedModules.contains(rm.getModuleId())) {
if ((isExtension && SI_MODULES.contains(rm.getModuleId())
|| (blockListedModules != null && blockListedModules.contains(rm.getModuleId())))) {
return false;
}

return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,6 @@ daily-build.import.resources.cloud.path=
# Configuration around MDRS behaviour on versioning and export
# The blocklisted modules (comma separatate SCTIDs) will not be included in an exported MDRS
# ----------------------------------------
mdrs.exclude.derivative-modules=true
mdrs.blocklist=

# Particular code systems in which the version will appear after the published date
Expand Down

0 comments on commit 900164c

Please sign in to comment.