Skip to content

Commit

Permalink
Merge pull request #1243 from b2ihealthcare/issue/SO-5363-phase_out_u…
Browse files Browse the repository at this point in the history
…se_of_moved_from_associations

SO-5363: Do not update Moved from association members during concept...
  • Loading branch information
cmark authored Nov 20, 2023
2 parents 87e7083 + 5b9f532 commit c0e6652
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,7 @@ private Concepts() { }
public static final String REFSET_REPLACED_BY_ASSOCIATION = "900000000000526001";
public static final String REFSET_SAME_AS_ASSOCIATION = "900000000000527005";
public static final String REFSET_SIMILAR_TO_ASSOCIATION = "900000000000529008";
public static final String REFSET_WAS_A_ASSOCIATION = "900000000000528000";

public static final Set<String> HISTORICAL_ASSOCIATION_REFSETS = ImmutableSet.of(
REFSET_HISTORICAL_ASSOCIATION,
REFSET_ALTERNATIVE_ASSOCIATION,
REFSET_MOVED_FROM_ASSOCIATION,
REFSET_MOVED_TO_ASSOCIATION,
REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION,
REFSET_REFERS_TO_ASSOCIATION,
REFSET_REPLACED_BY_ASSOCIATION,
REFSET_SAME_AS_ASSOCIATION,
REFSET_SIMILAR_TO_ASSOCIATION,
REFSET_WAS_A_ASSOCIATION);

public static final String REFSET_WAS_A_ASSOCIATION = "900000000000528000";

// simple map type refsets
public static final String CTV3_SIMPLE_MAP_TYPE_REFERENCE_SET_ID = "900000000000497000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
package com.b2international.snowowl.snomed.datastore.request.rf2.validation;

import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.HISTORICAL_ASSOCIATION_REFSETS;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.*;
import static com.google.common.collect.Sets.newHashSet;

import java.io.IOException;
Expand All @@ -43,6 +41,7 @@
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2AssociationRefSetContentType;
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2AttributeValueRefSetContentType;
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2EffectiveTimeSlice;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand All @@ -56,6 +55,18 @@ public class Rf2GlobalValidator {

private static final int RAW_QUERY_PAGE_SIZE = 500_000;
private final Logger log;

private static final Set<String> HISTORICAL_ASSOCIATION_REFSETS_TO_VALIDATE = ImmutableSet.of(
REFSET_HISTORICAL_ASSOCIATION,
REFSET_ALTERNATIVE_ASSOCIATION,
REFSET_MOVED_TO_ASSOCIATION,
REFSET_MOVED_FROM_ASSOCIATION,
REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION,
REFSET_REFERS_TO_ASSOCIATION,
REFSET_REPLACED_BY_ASSOCIATION,
REFSET_SAME_AS_ASSOCIATION,
REFSET_SIMILAR_TO_ASSOCIATION,
REFSET_WAS_A_ASSOCIATION);

private Map<String, String> dependenciesByEffectiveTime;
private Map<String, String> skippableMemberDependenciesByEffectiveTime;
Expand Down Expand Up @@ -215,7 +226,7 @@ private void validateType(Rf2EffectiveTimeSlice slice, ImportDefectAcceptor glob
final String referenceSet = member[5];
final String type = member[0];

boolean invalidHistoricalAssociationMember = HISTORICAL_ASSOCIATION_REFSETS.contains(referenceSet) && !Rf2AssociationRefSetContentType.TYPE.equals(type);
boolean invalidHistoricalAssociationMember = HISTORICAL_ASSOCIATION_REFSETS_TO_VALIDATE.contains(referenceSet) && !Rf2AssociationRefSetContentType.TYPE.equals(type);
boolean invalidAttributeTypeMember = (REFSET_CONCEPT_INACTIVITY_INDICATOR.equals(referenceSet) || REFSET_DESCRIPTION_INACTIVITY_INDICATOR.equals(referenceSet))
&& !Rf2AttributeValueRefSetContentType.TYPE.equals(type);

Expand Down

0 comments on commit c0e6652

Please sign in to comment.