Changes per code review.
This commit is contained in:
parent
8e7b4e8437
commit
dc3443665c
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
type: add
|
||||
issue: 2081
|
||||
title: "Terminology loader for LOINC and operations for CodeSystem, ValueSet and ConcepMap will now support
|
||||
multiple CodeSystem versions."
|
||||
title: "Operations for CodeSystem, ValueSet and ConcepMap will now support multiple CodeSystem versions."
|
||||
|
|
|
@ -61,7 +61,6 @@ public class TranslationQuery {
|
|||
myResourceId = theResourceId;
|
||||
}
|
||||
|
||||
//-- url
|
||||
public boolean hasUrl() {
|
||||
return myUrl != null && myUrl.hasValue();
|
||||
}
|
||||
|
@ -74,7 +73,6 @@ public class TranslationQuery {
|
|||
myUrl = theUrl;
|
||||
}
|
||||
|
||||
//-- ConceptMapVersion
|
||||
public boolean hasConceptMapVersion() {
|
||||
return myConceptMapVersion != null && myConceptMapVersion.hasValue();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,9 @@ public interface ITermConceptMapDao extends JpaRepository<TermConceptMap, Long>
|
|||
@Query("SELECT cm FROM TermConceptMap cm WHERE cm.myUrl = :url and cm.myVersion is null")
|
||||
Optional<TermConceptMap> findTermConceptMapByUrlAndNullVersion(@Param("url") String theUrl);
|
||||
|
||||
// Note that last updated version is considered current version.
|
||||
@Query(value="SELECT cm FROM TermConceptMap cm INNER JOIN ResourceTable r ON r.myId = cm.myResourcePid WHERE cm.myUrl = :url ORDER BY r.myUpdated DESC")
|
||||
List<TermConceptMap> getTermConceptMapEntitiesByUrlOrderByVersion(Pageable thePage, @Param("url") String theUrl);
|
||||
List<TermConceptMap> getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(Pageable thePage, @Param("url") String theUrl);
|
||||
|
||||
@Query("SELECT cm FROM TermConceptMap cm WHERE cm.myUrl = :url AND cm.myVersion = :version")
|
||||
Optional<TermConceptMap> findTermConceptMapByUrlAndVersion(@Param("url") String theUrl, @Param("version") String theVersion);
|
||||
|
|
|
@ -36,6 +36,7 @@ public interface ITermValueSetDao extends JpaRepository<TermValueSet, Long> {
|
|||
@Query("SELECT vs FROM TermValueSet vs WHERE vs.myResourcePid = :resource_pid")
|
||||
Optional<TermValueSet> findByResourcePid(@Param("resource_pid") Long theResourcePid);
|
||||
|
||||
// Keeping for backwards compatibility but recommend using findTermValueSetByUrlAndNullVersion instead.
|
||||
@Deprecated
|
||||
@Query("SELECT vs FROM TermValueSet vs WHERE vs.myUrl = :url")
|
||||
Optional<TermValueSet> findByUrl(@Param("url") String theUrl);
|
||||
|
|
|
@ -39,7 +39,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
|
|||
import ca.uhn.fhir.rest.param.TokenParamModifier;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.hibernate.query.criteria.internal.CriteriaBuilderImpl;
|
||||
import org.hibernate.query.criteria.internal.predicate.BooleanStaticAssertionPredicate;
|
||||
|
@ -160,7 +160,7 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
From<?, ResourceIndexedSearchParamToken> theFrom,
|
||||
SearchFilterParser.CompareOperation operation,
|
||||
RequestPartitionId theRequestPartitionId) {
|
||||
final List<VersionIndependentConcept> codes = new ArrayList<>();
|
||||
final List<FhirVersionIndependentConcept> codes = new ArrayList<>();
|
||||
String paramName = theSearchParam.getName();
|
||||
|
||||
TokenParamModifier modifier = null;
|
||||
|
@ -214,12 +214,12 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
validateHaveSystemAndCodeForToken(paramName, code, system);
|
||||
codes.addAll(myTerminologySvc.findCodesBelow(system, code));
|
||||
} else {
|
||||
codes.add(new VersionIndependentConcept(system, code));
|
||||
codes.add(new FhirVersionIndependentConcept(system, code));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<VersionIndependentConcept> sortedCodesList = codes
|
||||
List<FhirVersionIndependentConcept> sortedCodesList = codes
|
||||
.stream()
|
||||
.filter(t -> t.getCode() != null || t.getSystem() != null)
|
||||
.sorted()
|
||||
|
@ -234,19 +234,19 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
List<Predicate> retVal = new ArrayList<>();
|
||||
|
||||
// System only
|
||||
List<VersionIndependentConcept> systemOnlyCodes = sortedCodesList.stream().filter(t -> isBlank(t.getCode())).collect(Collectors.toList());
|
||||
List<FhirVersionIndependentConcept> systemOnlyCodes = sortedCodesList.stream().filter(t -> isBlank(t.getCode())).collect(Collectors.toList());
|
||||
if (!systemOnlyCodes.isEmpty()) {
|
||||
retVal.add(addPredicate(theResourceName, paramName, theBuilder, theFrom, systemOnlyCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_ONLY, theRequestPartitionId));
|
||||
}
|
||||
|
||||
// Code only
|
||||
List<VersionIndependentConcept> codeOnlyCodes = sortedCodesList.stream().filter(t -> t.getSystem() == null).collect(Collectors.toList());
|
||||
List<FhirVersionIndependentConcept> codeOnlyCodes = sortedCodesList.stream().filter(t -> t.getSystem() == null).collect(Collectors.toList());
|
||||
if (!codeOnlyCodes.isEmpty()) {
|
||||
retVal.add(addPredicate(theResourceName, paramName, theBuilder, theFrom, codeOnlyCodes, modifier, SearchBuilderTokenModeEnum.VALUE_ONLY, theRequestPartitionId));
|
||||
}
|
||||
|
||||
// System and code
|
||||
List<VersionIndependentConcept> systemAndCodeCodes = sortedCodesList.stream().filter(t -> isNotBlank(t.getCode()) && t.getSystem() != null).collect(Collectors.toList());
|
||||
List<FhirVersionIndependentConcept> systemAndCodeCodes = sortedCodesList.stream().filter(t -> isNotBlank(t.getCode()) && t.getSystem() != null).collect(Collectors.toList());
|
||||
if (!systemAndCodeCodes.isEmpty()) {
|
||||
retVal.add(addPredicate(theResourceName, paramName, theBuilder, theFrom, systemAndCodeCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_AND_VALUE, theRequestPartitionId));
|
||||
}
|
||||
|
@ -272,8 +272,8 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
String valueSet = valueSetUris.iterator().next();
|
||||
ValueSetExpansionOptions options = new ValueSetExpansionOptions()
|
||||
.setFailOnMissingCodeSystem(false);
|
||||
List<VersionIndependentConcept> candidateCodes = myTerminologySvc.expandValueSet(options, valueSet);
|
||||
for (VersionIndependentConcept nextCandidate : candidateCodes) {
|
||||
List<FhirVersionIndependentConcept> candidateCodes = myTerminologySvc.expandValueSet(options, valueSet);
|
||||
for (FhirVersionIndependentConcept nextCandidate : candidateCodes) {
|
||||
if (nextCandidate.getCode().equals(code)) {
|
||||
retVal = nextCandidate.getSystem();
|
||||
break;
|
||||
|
@ -298,7 +298,7 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
}
|
||||
}
|
||||
|
||||
private Predicate addPredicate(String theResourceName, String theParamName, CriteriaBuilder theBuilder, From<?, ResourceIndexedSearchParamToken> theFrom, List<VersionIndependentConcept> theTokens, TokenParamModifier theModifier, SearchBuilderTokenModeEnum theTokenMode, RequestPartitionId theRequestPartitionId) {
|
||||
private Predicate addPredicate(String theResourceName, String theParamName, CriteriaBuilder theBuilder, From<?, ResourceIndexedSearchParamToken> theFrom, List<FhirVersionIndependentConcept> theTokens, TokenParamModifier theModifier, SearchBuilderTokenModeEnum theTokenMode, RequestPartitionId theRequestPartitionId) {
|
||||
if (myDontUseHashesForSearch) {
|
||||
final Path<String> systemExpression = theFrom.get("mySystem");
|
||||
final Path<String> valueExpression = theFrom.get("myValue");
|
||||
|
@ -317,7 +317,7 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
orPredicates.add(orPredicate);
|
||||
break;
|
||||
case SYSTEM_AND_VALUE:
|
||||
for (VersionIndependentConcept next : theTokens) {
|
||||
for (FhirVersionIndependentConcept next : theTokens) {
|
||||
orPredicates.add(theBuilder.and(
|
||||
toEqualOrIsNullPredicate(systemExpression, next.getSystem()),
|
||||
toEqualOrIsNullPredicate(valueExpression, next.getCode())
|
||||
|
|
|
@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.entity;
|
|||
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||
import ca.uhn.fhir.jpa.search.DeferConceptIndexingInterceptor;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.ValidateUtil;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
|
|
|
@ -84,7 +84,7 @@ import ca.uhn.fhir.util.CoverageIgnore;
|
|||
import ca.uhn.fhir.util.StopWatch;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
import ca.uhn.fhir.util.ValidateUtil;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -301,7 +301,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
}
|
||||
|
||||
private void addConceptsToList(IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, String theSystem, List<CodeSystem.ConceptDefinitionComponent> theConcept, boolean theAdd, VersionIndependentConcept theWantConceptOrNull) {
|
||||
private void addConceptsToList(IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, String theSystem, List<CodeSystem.ConceptDefinitionComponent> theConcept, boolean theAdd, FhirVersionIndependentConcept theWantConceptOrNull) {
|
||||
for (CodeSystem.ConceptDefinitionComponent next : theConcept) {
|
||||
if (isNoneBlank(theSystem, next.getCode())) {
|
||||
if (theWantConceptOrNull == null || theWantConceptOrNull.getCode().equals(next.getCode())) {
|
||||
|
@ -388,7 +388,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
deleteValueSetForResource(theResourceTable);
|
||||
}
|
||||
|
||||
private ValueSet expandValueSetInMemory(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpand, VersionIndependentConcept theWantConceptOrNull) {
|
||||
private ValueSet expandValueSetInMemory(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpand, FhirVersionIndependentConcept theWantConceptOrNull) {
|
||||
|
||||
int maxCapacity = myDaoConfig.getMaximumExpansionSize();
|
||||
ValueSetExpansionComponentWithConceptAccumulator expansionComponent = new ValueSetExpansionComponentWithConceptAccumulator(myContext, maxCapacity);
|
||||
|
@ -409,7 +409,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VersionIndependentConcept> expandValueSet(ValueSetExpansionOptions theExpansionOptions, String theValueSet) {
|
||||
public List<FhirVersionIndependentConcept> expandValueSet(ValueSetExpansionOptions theExpansionOptions, String theValueSet) {
|
||||
// TODO: DM 2019-09-10 - This is problematic because an incorrect URL that matches ValueSet.id will not be found in the terminology tables but will yield a ValueSet here. Depending on the ValueSet, the expansion may time-out.
|
||||
|
||||
ValueSet valueSet = fetchCanonicalValueSetFromCompleteContext(theValueSet);
|
||||
|
@ -554,7 +554,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void expandValueSet(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpand, IValueSetConceptAccumulator theValueSetCodeAccumulator, AtomicInteger theCodeCounter, VersionIndependentConcept theWantConceptOrNull) {
|
||||
private void expandValueSet(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpand, IValueSetConceptAccumulator theValueSetCodeAccumulator, AtomicInteger theCodeCounter, FhirVersionIndependentConcept theWantConceptOrNull) {
|
||||
Set<String> addedCodes = new HashSet<>();
|
||||
|
||||
StopWatch sw = new StopWatch();
|
||||
|
@ -640,12 +640,12 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
protected List<VersionIndependentConcept> expandValueSetAndReturnVersionIndependentConcepts(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpandR4, VersionIndependentConcept theWantConceptOrNull) {
|
||||
protected List<FhirVersionIndependentConcept> expandValueSetAndReturnVersionIndependentConcepts(ValueSetExpansionOptions theExpansionOptions, ValueSet theValueSetToExpandR4, FhirVersionIndependentConcept theWantConceptOrNull) {
|
||||
org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent expandedR4 = expandValueSetInMemory(theExpansionOptions, theValueSetToExpandR4, theWantConceptOrNull).getExpansion();
|
||||
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>();
|
||||
for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent nextContains : expandedR4.getContains()) {
|
||||
retVal.add(new VersionIndependentConcept(nextContains.getSystem(), nextContains.getCode(), nextContains.getDisplay(), nextContains.getVersion()));
|
||||
retVal.add(new FhirVersionIndependentConcept(nextContains.getSystem(), nextContains.getCode(), nextContains.getDisplay(), nextContains.getVersion()));
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
/**
|
||||
* @return Returns true if there are potentially more results to process.
|
||||
*/
|
||||
private Boolean expandValueSetHandleIncludeOrExclude(@Nullable ValueSetExpansionOptions theExpansionOptions, IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, ValueSet.ConceptSetComponent theIncludeOrExclude, boolean theAdd, AtomicInteger theCodeCounter, int theQueryIndex, VersionIndependentConcept theWantConceptOrNull) {
|
||||
private Boolean expandValueSetHandleIncludeOrExclude(@Nullable ValueSetExpansionOptions theExpansionOptions, IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, ValueSet.ConceptSetComponent theIncludeOrExclude, boolean theAdd, AtomicInteger theCodeCounter, int theQueryIndex, FhirVersionIndependentConcept theWantConceptOrNull) {
|
||||
|
||||
String system = theIncludeOrExclude.getSystem();
|
||||
boolean hasSystem = isNotBlank(system);
|
||||
|
@ -691,7 +691,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
// just in case there is a registered service that knows how to handle this. This can happen, for example,
|
||||
// if someone creates a valueset that includes UCUM codes, since we don't have a CodeSystem resource for those
|
||||
// but CommonCodeSystemsTerminologyService can validate individual codes.
|
||||
List<VersionIndependentConcept> includedConcepts = null;
|
||||
List<FhirVersionIndependentConcept> includedConcepts = null;
|
||||
if (theWantConceptOrNull != null) {
|
||||
includedConcepts = new ArrayList<>();
|
||||
includedConcepts.add(theWantConceptOrNull);
|
||||
|
@ -699,13 +699,13 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
includedConcepts = theIncludeOrExclude
|
||||
.getConcept()
|
||||
.stream()
|
||||
.map(t -> new VersionIndependentConcept(theIncludeOrExclude.getSystem(), t.getCode()))
|
||||
.map(t -> new FhirVersionIndependentConcept(theIncludeOrExclude.getSystem(), t.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (includedConcepts != null) {
|
||||
int foundCount = 0;
|
||||
for (VersionIndependentConcept next : includedConcepts) {
|
||||
for (FhirVersionIndependentConcept next : includedConcepts) {
|
||||
String nextSystem = next.getSystem();
|
||||
if (nextSystem == null) {
|
||||
nextSystem = system;
|
||||
|
@ -763,10 +763,10 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
for (CanonicalType nextValueSet : theIncludeOrExclude.getValueSet()) {
|
||||
ourLog.debug("Starting {} expansion around ValueSet: {}", (theAdd ? "inclusion" : "exclusion"), nextValueSet.getValueAsString());
|
||||
|
||||
List<VersionIndependentConcept> expanded = expandValueSet(theExpansionOptions, nextValueSet.getValueAsString());
|
||||
List<FhirVersionIndependentConcept> expanded = expandValueSet(theExpansionOptions, nextValueSet.getValueAsString());
|
||||
Map<String, TermCodeSystem> uriToCodeSystem = new HashMap<>();
|
||||
|
||||
for (VersionIndependentConcept nextConcept : expanded) {
|
||||
for (FhirVersionIndependentConcept nextConcept : expanded) {
|
||||
if (theAdd) {
|
||||
|
||||
if (!uriToCodeSystem.containsKey(nextConcept.getSystem())) {
|
||||
|
@ -811,7 +811,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@Nonnull
|
||||
private Boolean expandValueSetHandleIncludeOrExcludeUsingDatabase(IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, ValueSet.ConceptSetComponent theIncludeOrExclude, boolean theAdd, AtomicInteger theCodeCounter, int theQueryIndex, VersionIndependentConcept theWantConceptOrNull, String theSystem, TermCodeSystem theCs) {
|
||||
private Boolean expandValueSetHandleIncludeOrExcludeUsingDatabase(IValueSetConceptAccumulator theValueSetCodeAccumulator, Set<String> theAddedCodes, ValueSet.ConceptSetComponent theIncludeOrExclude, boolean theAdd, AtomicInteger theCodeCounter, int theQueryIndex, FhirVersionIndependentConcept theWantConceptOrNull, String theSystem, TermCodeSystem theCs) {
|
||||
String codeSystemVersion = theIncludeOrExclude.getVersion();
|
||||
TermCodeSystemVersion csv;
|
||||
if (isEmpty(codeSystemVersion)) {
|
||||
|
@ -1507,7 +1507,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
|
||||
@Transactional
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesAbove(String theSystem, String theCode) {
|
||||
public List<FhirVersionIndependentConcept> findCodesAbove(String theSystem, String theCode) {
|
||||
TermCodeSystem cs = getCodeSystem(theSystem);
|
||||
if (cs == null) {
|
||||
return findCodesAboveUsingBuiltInSystems(theSystem, theCode);
|
||||
|
@ -1539,7 +1539,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
|
||||
@Transactional
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesBelow(String theSystem, String theCode) {
|
||||
public List<FhirVersionIndependentConcept> findCodesBelow(String theSystem, String theCode) {
|
||||
TermCodeSystem cs = getCodeSystem(theSystem);
|
||||
if (cs == null) {
|
||||
return findCodesBelowUsingBuiltInSystems(theSystem, theCode);
|
||||
|
@ -1939,8 +1939,8 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
@Transactional
|
||||
public IFhirResourceDaoCodeSystem.SubsumesResult subsumes(IPrimitiveType<String> theCodeA, IPrimitiveType<String> theCodeB,
|
||||
IPrimitiveType<String> theSystem, IBaseCoding theCodingA, IBaseCoding theCodingB) {
|
||||
VersionIndependentConcept conceptA = toConcept(theCodeA, theSystem, theCodingA);
|
||||
VersionIndependentConcept conceptB = toConcept(theCodeB, theSystem, theCodingB);
|
||||
FhirVersionIndependentConcept conceptA = toConcept(theCodeA, theSystem, theCodingA);
|
||||
FhirVersionIndependentConcept conceptB = toConcept(theCodeB, theSystem, theCodingB);
|
||||
|
||||
if (!StringUtils.equals(conceptA.getSystem(), conceptB.getSystem())) {
|
||||
throw new InvalidRequestException("Unable to test subsumption across different code systems");
|
||||
|
@ -2044,10 +2044,10 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
return null;
|
||||
}
|
||||
|
||||
private ArrayList<VersionIndependentConcept> toVersionIndependentConcepts(String theSystem, Set<TermConcept> codes) {
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>(codes.size());
|
||||
private ArrayList<FhirVersionIndependentConcept> toVersionIndependentConcepts(String theSystem, Set<TermConcept> codes) {
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>(codes.size());
|
||||
for (TermConcept next : codes) {
|
||||
retVal.add(new VersionIndependentConcept(theSystem, next.getCode()));
|
||||
retVal.add(new FhirVersionIndependentConcept(theSystem, next.getCode()));
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
@ -2291,7 +2291,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
private String getLatestConceptMapVersion(TranslationRequest theTranslationRequest) {
|
||||
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theConceptMapList = myConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page,
|
||||
List<TermConceptMap> theConceptMapList = myConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page,
|
||||
theTranslationRequest.getUrl().asStringValue());
|
||||
if (!theConceptMapList.isEmpty()) {
|
||||
return theConceptMapList.get(0).getVersion();
|
||||
|
@ -2324,10 +2324,10 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
|
||||
TransactionTemplate txTemplate = new TransactionTemplate(myTransactionManager);
|
||||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||
Optional<VersionIndependentConcept> codeOpt = txTemplate.execute(t -> findCode(theCodeSystem, theCode).map(c -> new VersionIndependentConcept(theCodeSystem, c.getCode())));
|
||||
Optional<FhirVersionIndependentConcept> codeOpt = txTemplate.execute(t -> findCode(theCodeSystem, theCode).map(c -> new FhirVersionIndependentConcept(theCodeSystem, c.getCode())));
|
||||
|
||||
if (codeOpt != null && codeOpt.isPresent()) {
|
||||
VersionIndependentConcept code = codeOpt.get();
|
||||
FhirVersionIndependentConcept code = codeOpt.get();
|
||||
if (!theOptions.isValidateDisplay() || (isNotBlank(code.getDisplay()) && isNotBlank(theDisplay) && code.getDisplay().equals(theDisplay))) {
|
||||
return new CodeValidationResult()
|
||||
.setCode(code.getCode())
|
||||
|
@ -2429,7 +2429,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
return myContext;
|
||||
}
|
||||
|
||||
private void findCodesAbove(CodeSystem theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void findCodesAbove(CodeSystem theSystem, String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
List<CodeSystem.ConceptDefinitionComponent> conceptList = theSystem.getConcept();
|
||||
for (CodeSystem.ConceptDefinitionComponent next : conceptList) {
|
||||
addTreeIfItContainsCode(theSystemString, next, theCode, theListToPopulate);
|
||||
|
@ -2437,8 +2437,8 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
|
||||
public List<FhirVersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>();
|
||||
CodeSystem system = fetchCanonicalCodeSystemFromCompleteContext(theSystem);
|
||||
if (system != null) {
|
||||
findCodesAbove(system, theSystem, theCode, retVal);
|
||||
|
@ -2446,12 +2446,12 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void findCodesBelow(CodeSystem theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void findCodesBelow(CodeSystem theSystem, String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
List<CodeSystem.ConceptDefinitionComponent> conceptList = theSystem.getConcept();
|
||||
findCodesBelow(theSystemString, theCode, theListToPopulate, conceptList);
|
||||
}
|
||||
|
||||
private void findCodesBelow(String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate, List<CodeSystem.ConceptDefinitionComponent> conceptList) {
|
||||
private void findCodesBelow(String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate, List<CodeSystem.ConceptDefinitionComponent> conceptList) {
|
||||
for (CodeSystem.ConceptDefinitionComponent next : conceptList) {
|
||||
if (theCode.equals(next.getCode())) {
|
||||
addAllChildren(theSystemString, next, theListToPopulate);
|
||||
|
@ -2462,8 +2462,8 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
|
||||
public List<FhirVersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>();
|
||||
CodeSystem system = fetchCanonicalCodeSystemFromCompleteContext(theSystem);
|
||||
if (system != null) {
|
||||
findCodesBelow(system, theSystem, theCode, retVal);
|
||||
|
@ -2471,23 +2471,23 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void addAllChildren(String theSystemString, CodeSystem.ConceptDefinitionComponent theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void addAllChildren(String theSystemString, CodeSystem.ConceptDefinitionComponent theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
if (isNotBlank(theCode.getCode())) {
|
||||
theListToPopulate.add(new VersionIndependentConcept(theSystemString, theCode.getCode()));
|
||||
theListToPopulate.add(new FhirVersionIndependentConcept(theSystemString, theCode.getCode()));
|
||||
}
|
||||
for (CodeSystem.ConceptDefinitionComponent nextChild : theCode.getConcept()) {
|
||||
addAllChildren(theSystemString, nextChild, theListToPopulate);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean addTreeIfItContainsCode(String theSystemString, CodeSystem.ConceptDefinitionComponent theNext, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private boolean addTreeIfItContainsCode(String theSystemString, CodeSystem.ConceptDefinitionComponent theNext, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
boolean foundCodeInChild = false;
|
||||
for (CodeSystem.ConceptDefinitionComponent nextChild : theNext.getConcept()) {
|
||||
foundCodeInChild |= addTreeIfItContainsCode(theSystemString, nextChild, theCode, theListToPopulate);
|
||||
}
|
||||
|
||||
if (theCode.equals(theNext.getCode()) || foundCodeInChild) {
|
||||
theListToPopulate.add(new VersionIndependentConcept(theSystemString, theNext.getCode()));
|
||||
theListToPopulate.add(new FhirVersionIndependentConcept(theSystemString, theNext.getCode()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2591,7 +2591,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
}
|
||||
|
||||
@NotNull
|
||||
private VersionIndependentConcept toConcept(IPrimitiveType<String> theCodeType, IPrimitiveType<String> theCodeSystemIdentifierType, IBaseCoding theCodingType) {
|
||||
private FhirVersionIndependentConcept toConcept(IPrimitiveType<String> theCodeType, IPrimitiveType<String> theCodeSystemIdentifierType, IBaseCoding theCodingType) {
|
||||
String code = theCodeType != null ? theCodeType.getValueAsString() : null;
|
||||
String system = theCodeSystemIdentifierType != null ? getUrlFromIdentifier(theCodeSystemIdentifierType.getValueAsString()): null;
|
||||
String systemVersion = theCodeSystemIdentifierType != null ? getVersionFromIdentifier(theCodeSystemIdentifierType.getValueAsString()): null;
|
||||
|
@ -2601,7 +2601,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
|
|||
system = canonicalizedCoding.getSystem();
|
||||
systemVersion = canonicalizedCoding.getVersion();
|
||||
}
|
||||
return new VersionIndependentConcept(system, code, null, systemVersion);
|
||||
return new FhirVersionIndependentConcept(system, code, null, systemVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
|
|||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -34,7 +34,6 @@ import org.hl7.fhir.r4.model.CodeSystem;
|
|||
import org.hl7.fhir.r4.model.CodeableConcept;
|
||||
import org.hl7.fhir.r4.model.Coding;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -48,23 +47,23 @@ public class TermReadSvcDstu2 extends BaseTermReadSvcImpl {
|
|||
@Autowired
|
||||
private IValidationSupport myValidationSupport;
|
||||
|
||||
private void addAllChildren(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void addAllChildren(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
if (isNotBlank(theCode.getCode())) {
|
||||
theListToPopulate.add(new VersionIndependentConcept(theSystemString, theCode.getCode()));
|
||||
theListToPopulate.add(new FhirVersionIndependentConcept(theSystemString, theCode.getCode()));
|
||||
}
|
||||
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent nextChild : theCode.getConcept()) {
|
||||
addAllChildren(theSystemString, nextChild, theListToPopulate);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean addTreeIfItContainsCode(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theNext, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private boolean addTreeIfItContainsCode(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theNext, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
boolean foundCodeInChild = false;
|
||||
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent nextChild : theNext.getConcept()) {
|
||||
foundCodeInChild |= addTreeIfItContainsCode(theSystemString, nextChild, theCode, theListToPopulate);
|
||||
}
|
||||
|
||||
if (theCode.equals(theNext.getCode()) || foundCodeInChild) {
|
||||
theListToPopulate.add(new VersionIndependentConcept(theSystemString, theNext.getCode()));
|
||||
theListToPopulate.add(new FhirVersionIndependentConcept(theSystemString, theNext.getCode()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -96,7 +95,7 @@ public class TermReadSvcDstu2 extends BaseTermReadSvcImpl {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void findCodesAbove(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void findCodesAbove(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
|
||||
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
|
||||
addTreeIfItContainsCode(theSystemString, next, theCode, theListToPopulate);
|
||||
|
@ -104,8 +103,8 @@ public class TermReadSvcDstu2 extends BaseTermReadSvcImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
|
||||
public List<FhirVersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>();
|
||||
org.hl7.fhir.dstu2.model.ValueSet system = (org.hl7.fhir.dstu2.model.ValueSet) myValidationSupport.fetchCodeSystem(theSystem);
|
||||
if (system != null) {
|
||||
findCodesAbove(system, theSystem, theCode, retVal);
|
||||
|
@ -113,12 +112,12 @@ public class TermReadSvcDstu2 extends BaseTermReadSvcImpl {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void findCodesBelow(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
|
||||
private void findCodesBelow(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate) {
|
||||
List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
|
||||
findCodesBelow(theSystemString, theCode, theListToPopulate, conceptList);
|
||||
}
|
||||
|
||||
private void findCodesBelow(String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate, List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList) {
|
||||
private void findCodesBelow(String theSystemString, String theCode, List<FhirVersionIndependentConcept> theListToPopulate, List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList) {
|
||||
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
|
||||
if (theCode.equals(next.getCode())) {
|
||||
addAllChildren(theSystemString, next, theListToPopulate);
|
||||
|
@ -129,8 +128,8 @@ public class TermReadSvcDstu2 extends BaseTermReadSvcImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
|
||||
public List<FhirVersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode) {
|
||||
ArrayList<FhirVersionIndependentConcept> retVal = new ArrayList<>();
|
||||
org.hl7.fhir.dstu2.model.ValueSet system = (org.hl7.fhir.dstu2.model.ValueSet) myValidationSupport.fetchCodeSystem(theSystem);
|
||||
if (system != null) {
|
||||
findCodesBelow(system, theSystem, theCode, retVal);
|
||||
|
|
|
@ -5,15 +5,11 @@ import ca.uhn.fhir.context.support.ConceptValidationOptions;
|
|||
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||
import ca.uhn.fhir.context.support.ValidationSupportContext;
|
||||
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermReadSvcDstu3;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.util.CoverageIgnore;
|
||||
import ca.uhn.fhir.util.ValidateUtil;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.conv30_40.CodeSystem30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
|
@ -23,16 +19,11 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet;
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,9 +10,7 @@ import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElement;
|
|||
import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElementTarget;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.term.IValueSetConceptAccumulator;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -21,7 +19,6 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.ConceptMap;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -71,21 +68,21 @@ public interface ITermReadSvc extends IValidationSupport {
|
|||
|
||||
void expandValueSet(@Nullable ValueSetExpansionOptions theExpansionOptions, IBaseResource theValueSetToExpand, IValueSetConceptAccumulator theValueSetCodeAccumulator);
|
||||
|
||||
List<VersionIndependentConcept> expandValueSet(ValueSetExpansionOptions theExpansionOptions, String theValueSet);
|
||||
List<FhirVersionIndependentConcept> expandValueSet(ValueSetExpansionOptions theExpansionOptions, String theValueSet);
|
||||
|
||||
Optional<TermConcept> findCode(String theCodeSystem, String theCode);
|
||||
|
||||
Set<TermConcept> findCodesAbove(Long theCodeSystemResourcePid, Long theCodeSystemResourceVersionPid, String theCode);
|
||||
|
||||
List<VersionIndependentConcept> findCodesAbove(String theSystem, String theCode);
|
||||
List<FhirVersionIndependentConcept> findCodesAbove(String theSystem, String theCode);
|
||||
|
||||
List<VersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode);
|
||||
List<FhirVersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode);
|
||||
|
||||
Set<TermConcept> findCodesBelow(Long theCodeSystemResourcePid, Long theCodeSystemResourceVersionPid, String theCode);
|
||||
|
||||
List<VersionIndependentConcept> findCodesBelow(String theSystem, String theCode);
|
||||
List<FhirVersionIndependentConcept> findCodesBelow(String theSystem, String theCode);
|
||||
|
||||
List<VersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode);
|
||||
List<FhirVersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode);
|
||||
|
||||
CodeSystem fetchCanonicalCodeSystemFromCompleteContext(String theSystem);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import ca.uhn.fhir.test.utilities.UnregisterScheduledProcessor;
|
|||
import ca.uhn.fhir.util.BundleUtil;
|
||||
import ca.uhn.fhir.util.StopWatch;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
|
@ -507,9 +507,9 @@ public abstract class BaseJpaTest extends BaseTest {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
protected static Set<String> toCodes(List<VersionIndependentConcept> theConcepts) {
|
||||
protected static Set<String> toCodes(List<FhirVersionIndependentConcept> theConcepts) {
|
||||
HashSet<String> retVal = new HashSet<>();
|
||||
for (VersionIndependentConcept next : theConcepts) {
|
||||
for (FhirVersionIndependentConcept next : theConcepts) {
|
||||
retVal.add(next.getCode());
|
||||
}
|
||||
return retVal;
|
||||
|
|
|
@ -111,7 +111,7 @@ public class FhirResourceDaoDstu3ConceptMapTest extends BaseJpaDstu3Test {
|
|||
public void testConceptMapFindTermConceptMapByUrl() {
|
||||
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpConceptMapList = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, CM_URL);
|
||||
List<TermConceptMap> theExpConceptMapList = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, CM_URL);
|
||||
assertEquals(1, theExpConceptMapList.size());
|
||||
assertEquals(CM_URL, theExpConceptMapList.get(0).getUrl());
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class FhirResourceDaoDstu3ConceptMapTest extends BaseJpaDstu3Test {
|
|||
|
||||
// should return the latest one which is v2
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, theUrl);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, theUrl);
|
||||
|
||||
assertEquals(1, theExpSecondOne.size());
|
||||
assertEquals(theUrl, theExpSecondOne.get(0).getUrl());
|
||||
|
@ -171,7 +171,7 @@ public class FhirResourceDaoDstu3ConceptMapTest extends BaseJpaDstu3Test {
|
|||
|
||||
// should return the latest one which in this case is not versioned
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, theUrl);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, theUrl);
|
||||
|
||||
assertEquals(1, theExpSecondOne.size());
|
||||
assertEquals(theUrl, theExpSecondOne.get(0).getUrl());
|
||||
|
|
|
@ -1158,7 +1158,7 @@ public class FhirResourceDaoR4ConceptMapTest extends BaseJpaR4Test {
|
|||
public void testConceptMapFindTermConceptMapByUrl() {
|
||||
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpConceptMapList = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, CM_URL);
|
||||
List<TermConceptMap> theExpConceptMapList = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, CM_URL);
|
||||
assertEquals(1, theExpConceptMapList.size());
|
||||
assertEquals(CM_URL, theExpConceptMapList.get(0).getUrl());
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ public class FhirResourceDaoR4ConceptMapTest extends BaseJpaR4Test {
|
|||
|
||||
// should return the latest one which is v2
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, theUrl);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, theUrl);
|
||||
|
||||
assertEquals(1, theExpSecondOne.size());
|
||||
assertEquals(theUrl, theExpSecondOne.get(0).getUrl());
|
||||
|
@ -1218,7 +1218,7 @@ public class FhirResourceDaoR4ConceptMapTest extends BaseJpaR4Test {
|
|||
|
||||
// should return the latest one which is v2
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, theUrl);
|
||||
List<TermConceptMap> theExpSecondOne = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, theUrl);
|
||||
|
||||
assertEquals(1, theExpSecondOne.size());
|
||||
assertEquals(theUrl, theExpSecondOne.get(0).getUrl());
|
||||
|
|
|
@ -15,7 +15,7 @@ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
|||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
|
@ -1719,7 +1719,7 @@ public class TerminologySvcImplDstu3Test extends BaseJpaDstu3Test {
|
|||
|
||||
@Test
|
||||
public void testFindCodesAboveBuiltInCodeSystem() {
|
||||
List<VersionIndependentConcept> concepts;
|
||||
List<FhirVersionIndependentConcept> concepts;
|
||||
Set<String> codes;
|
||||
|
||||
concepts = myTermSvc.findCodesAbove("http://hl7.org/fhir/allergy-clinical-status", "active");
|
||||
|
@ -1765,7 +1765,7 @@ public class TerminologySvcImplDstu3Test extends BaseJpaDstu3Test {
|
|||
|
||||
@Test
|
||||
public void testFindCodesBelowBuiltInCodeSystem() {
|
||||
List<VersionIndependentConcept> concepts;
|
||||
List<FhirVersionIndependentConcept> concepts;
|
||||
Set<String> codes;
|
||||
|
||||
concepts = myTermSvc.findCodesBelow("http://hl7.org/fhir/allergy-clinical-status", "inactive");
|
||||
|
|
|
@ -322,7 +322,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test {
|
|||
@Override
|
||||
protected void doInTransactionWithoutResult(@Nonnull TransactionStatus theStatus) {
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> optionalConceptMap = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, CM_URL);
|
||||
List<TermConceptMap> optionalConceptMap = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, CM_URL);
|
||||
assertEquals(1, optionalConceptMap.size());
|
||||
|
||||
TermConceptMap conceptMap = optionalConceptMap.get(0);
|
||||
|
@ -501,7 +501,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test {
|
|||
@Override
|
||||
protected void doInTransactionWithoutResult(@Nonnull TransactionStatus theStatus) {
|
||||
Pageable page = PageRequest.of(0, 1);
|
||||
List<TermConceptMap> optionalConceptMap = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, CM_URL);
|
||||
List<TermConceptMap> optionalConceptMap = myTermConceptMapDao.getTermConceptMapEntitiesByUrlOrderByMostRecentUpdate(page, CM_URL);
|
||||
assertEquals(1, optionalConceptMap.size());
|
||||
|
||||
TermConceptMap conceptMap = optionalConceptMap.get(0);
|
||||
|
|
|
@ -7,7 +7,7 @@ import ca.uhn.fhir.context.support.IValidationSupport;
|
|||
import ca.uhn.fhir.context.support.ValidationSupportContext;
|
||||
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.util.VersionIndependentConcept;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.convertors.conv10_50.ValueSet10_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.CodeSystem30_50;
|
||||
|
@ -217,7 +217,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
codeSystemToValidateResource = theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(theCodeSystemIdentifierToValidate);
|
||||
}
|
||||
|
||||
List<VersionIndependentConcept> codesInValueSetExpansion = new ArrayList<>();
|
||||
List<FhirVersionIndependentConcept> codes = new ArrayList<>();
|
||||
switch (theExpansion.getStructureFhirVersionEnum()) {
|
||||
case DSTU2_HL7ORG: {
|
||||
ValueSet expansionVs = (ValueSet) theExpansion;
|
||||
|
@ -300,7 +300,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
codeSystemUrlToValidate = theCodeSystemIdentifierToValidate;
|
||||
}
|
||||
}
|
||||
for (VersionIndependentConcept nextExpansionCode : codesInValueSetExpansion) {
|
||||
for (FhirVersionIndependentConcept nextExpansionCode : codes) {
|
||||
|
||||
boolean codeMatches;
|
||||
if (caseSensitive) {
|
||||
|
@ -480,7 +480,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
|
||||
@Nullable
|
||||
private org.hl7.fhir.r5.model.ValueSet expandValueSetR5(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.r5.model.ValueSet theInput, Function<String, CodeSystem> theCodeSystemLoader, Function<String, org.hl7.fhir.r5.model.ValueSet> theValueSetLoader, @Nullable String theWantSystemIdentifier, @Nullable String theWantCode) {
|
||||
Set<VersionIndependentConcept> concepts = new HashSet<>();
|
||||
Set<FhirVersionIndependentConcept> concepts = new HashSet<>();
|
||||
|
||||
try {
|
||||
expandValueSetR5IncludeOrExclude(theValidationSupportContext, concepts, theCodeSystemLoader, theValueSetLoader, theInput.getCompose().getInclude(), true, theWantSystemIdentifier, theWantCode);
|
||||
|
@ -490,7 +490,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
}
|
||||
|
||||
org.hl7.fhir.r5.model.ValueSet retVal = new org.hl7.fhir.r5.model.ValueSet();
|
||||
for (VersionIndependentConcept next : concepts) {
|
||||
for (FhirVersionIndependentConcept next : concepts) {
|
||||
org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent contains = retVal.getExpansion().addContains();
|
||||
contains.setSystem(next.getSystem());
|
||||
contains.setCode(next.getCode());
|
||||
|
@ -501,7 +501,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void expandValueSetR5IncludeOrExclude(ValidationSupportContext theValidationSupportContext, Set<VersionIndependentConcept> theConcepts, Function<String, CodeSystem> theCodeSystemLoader, Function<String, org.hl7.fhir.r5.model.ValueSet> theValueSetLoader, List<org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent> theComposeList, boolean theComposeListIsInclude, @Nullable String theWantSystemIdentifier, @Nullable String theWantCode) throws ExpansionCouldNotBeCompletedInternallyException {
|
||||
private void expandValueSetR5IncludeOrExclude(ValidationSupportContext theValidationSupportContext, Set<FhirVersionIndependentConcept> theConcepts, Function<String, CodeSystem> theCodeSystemLoader, Function<String, org.hl7.fhir.r5.model.ValueSet> theValueSetLoader, List<org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent> theComposeList, boolean theComposeListIsInclude, @Nullable String theWantSystemIdentifier, @Nullable String theWantCode) throws ExpansionCouldNotBeCompletedInternallyException {
|
||||
String wantSystemUrl = null;
|
||||
String wantSystemVersion = null;
|
||||
if (theWantSystemIdentifier != null) {
|
||||
|
@ -516,7 +516,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent nextInclude : theComposeList) {
|
||||
|
||||
List<VersionIndependentConcept> nextCodeList = new ArrayList<>();
|
||||
List<FhirVersionIndependentConcept> nextCodeList = new ArrayList<>();
|
||||
String includeOrExcludeConceptSystemUrl = nextInclude.getSystem();
|
||||
String includeOrExcludeConceptSystemVersion = nextInclude.getVersion();
|
||||
if (isNotBlank(includeOrExcludeConceptSystemUrl)) {
|
||||
|
@ -612,7 +612,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
throw new ExpansionCouldNotBeCompletedInternallyException();
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent next : subExpansion.getExpansion().getContains()) {
|
||||
nextCodeList.add(new VersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
nextCodeList.add(new FhirVersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -627,11 +627,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
|
||||
}
|
||||
|
||||
private void addCodes(String theCodeSystemUrl, String theCodeSystemVersion, List<CodeSystem.ConceptDefinitionComponent> theSource, List<VersionIndependentConcept> theTarget, Set<String> theCodeFilter) {
|
||||
private void addCodes(String theCodeSystemUrl, String theCodeSystemVersion, List<CodeSystem.ConceptDefinitionComponent> theSource, List<FhirVersionIndependentConcept> theTarget, Set<String> theCodeFilter) {
|
||||
for (CodeSystem.ConceptDefinitionComponent next : theSource) {
|
||||
if (isNotBlank(next.getCode())) {
|
||||
if (theCodeFilter == null || theCodeFilter.contains(next.getCode())) {
|
||||
theTarget.add(new VersionIndependentConcept(theCodeSystemUrl, next.getCode(), next.getDisplay(), theCodeSystemVersion));
|
||||
theTarget.add(new FhirVersionIndependentConcept(theCodeSystemUrl, next.getCode(), next.getDisplay(), theCodeSystemVersion));
|
||||
}
|
||||
}
|
||||
addCodes(theCodeSystemUrl, theCodeSystemVersion, next.getConcept(), theTarget, theCodeFilter);
|
||||
|
@ -642,31 +642,31 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
|
||||
}
|
||||
|
||||
private static void flattenAndConvertCodesDstu2(List<org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<VersionIndependentConcept> theVersionIndependentConcepts) {
|
||||
private static void flattenAndConvertCodesDstu2(List<org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<FhirVersionIndependentConcept> theFhirVersionIndependentConcepts) {
|
||||
for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent next : theInput) {
|
||||
theVersionIndependentConcepts.add(new VersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay()));
|
||||
flattenAndConvertCodesDstu2(next.getContains(), theVersionIndependentConcepts);
|
||||
theFhirVersionIndependentConcepts.add(new FhirVersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay()));
|
||||
flattenAndConvertCodesDstu2(next.getContains(), theFhirVersionIndependentConcepts);
|
||||
}
|
||||
}
|
||||
|
||||
private static void flattenAndConvertCodesDstu3(List<org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<VersionIndependentConcept> theVersionIndependentConcepts) {
|
||||
private static void flattenAndConvertCodesDstu3(List<org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<FhirVersionIndependentConcept> theFhirVersionIndependentConcepts) {
|
||||
for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent next : theInput) {
|
||||
theVersionIndependentConcepts.add(new VersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesDstu3(next.getContains(), theVersionIndependentConcepts);
|
||||
theFhirVersionIndependentConcepts.add(new FhirVersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesDstu3(next.getContains(), theFhirVersionIndependentConcepts);
|
||||
}
|
||||
}
|
||||
|
||||
private static void flattenAndConvertCodesR4(List<org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<VersionIndependentConcept> theVersionIndependentConcepts) {
|
||||
private static void flattenAndConvertCodesR4(List<org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<FhirVersionIndependentConcept> theFhirVersionIndependentConcepts) {
|
||||
for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent next : theInput) {
|
||||
theVersionIndependentConcepts.add(new VersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesR4(next.getContains(), theVersionIndependentConcepts);
|
||||
theFhirVersionIndependentConcepts.add(new FhirVersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesR4(next.getContains(), theFhirVersionIndependentConcepts);
|
||||
}
|
||||
}
|
||||
|
||||
private static void flattenAndConvertCodesR5(List<org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<VersionIndependentConcept> theVersionIndependentConcepts) {
|
||||
private static void flattenAndConvertCodesR5(List<org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent> theInput, List<FhirVersionIndependentConcept> theFhirVersionIndependentConcepts) {
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent next : theInput) {
|
||||
theVersionIndependentConcepts.add(new VersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesR5(next.getContains(), theVersionIndependentConcepts);
|
||||
theFhirVersionIndependentConcepts.add(new FhirVersionIndependentConcept(next.getSystem(), next.getCode(), next.getDisplay(), next.getVersion()));
|
||||
flattenAndConvertCodesR5(next.getContains(), theFhirVersionIndependentConcepts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue