Skip to content

Commit

Permalink
Used contry ID derived from collection ID for deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCroftDKFZ committed Nov 8, 2024
1 parent 909225c commit fb2240e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ public boolean updateStarModel(StarModelData starModelInputData) {
* @return An boolean indicating the success or failure of the deletion.
*/
protected boolean deleteStarModel(StarModelData starModelInputData) {
String countryCode = starModelInputData.getCountryCode();

try {
for (String collectionId: starModelInputData.getInputCollectionIds()) {
String countryCode = extractCountryCodeFromBbmriEricId(collectionId);

// Loop until no more facts are left in the Directory.
// We need to do things this way, because the Directory implements paging
// and a single pass may not get all facts.
Expand Down Expand Up @@ -253,4 +253,20 @@ public void collectDiagnosisCorrections(Map<String, String> diagnoses) {
}

protected abstract boolean isValidIcdValue(String diagnosis);

/**
* Extracts the country code from a given BBMRI ID string. Works for both
* biobank and collection IDs.
*
* @param id The BBMRI ID string from which to extract the country code.
* @return The country code extracted from the BBMRI ID string.
*/
protected String extractCountryCodeFromBbmriEricId(String id) {
BbmriEricId bbmriEricCollectionId = BbmriEricId
.valueOf(id)
.orElse(null);
String countryCode = bbmriEricCollectionId.getCountryCode();

return countryCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -295,22 +295,6 @@ private void deleteUnknownFieldsFromEntity(String countryCode, Map<String, Objec
entity.remove("biobank_label");
}

/**
* Extracts the country code from a given BBMRI ID string. Works for both
* biobank and collection IDs.
*
* @param id The BBMRI ID string from which to extract the country code.
* @return The country code extracted from the BBMRI ID string.
*/
private String extractCountryCodeFromBbmriEricId(String id) {
BbmriEricId bbmriEricCollectionId = BbmriEricId
.valueOf(id)
.orElse(null);
String countryCode = bbmriEricCollectionId.getCountryCode();

return countryCode;
}

/**
* Removes keys from the given collection if the corresponding value is an empty list or a list with a single null element.
*
Expand Down

0 comments on commit fb2240e

Please sign in to comment.