Cleanup following paired programming with JA.
This commit is contained in:
parent
6ec991cd39
commit
4fc0ad6f0a
|
@ -149,7 +149,7 @@ public class DaoConfig {
|
||||||
/**
|
/**
|
||||||
* EXPERIMENTAL - Do not use in production! Do not change default of {@code false}!
|
* EXPERIMENTAL - Do not use in production! Do not change default of {@code false}!
|
||||||
*/
|
*/
|
||||||
private boolean myPreExpandValueSetsExperimental = true; // FIXME: DM 2019-09-03 - Return to false.
|
private boolean myPreExpandValueSetsExperimental = true; // FIXME: DM 2019-09-03 - Return to false before merging into master.
|
||||||
private boolean myFilterParameterEnabled = false;
|
private boolean myFilterParameterEnabled = false;
|
||||||
private StoreMetaSourceInformationEnum myStoreMetaSourceInformation = StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID;
|
private StoreMetaSourceInformationEnum myStoreMetaSourceInformation = StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,8 +21,6 @@ package ca.uhn.fhir.jpa.dao.data;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
|
import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Slice;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
@ -40,13 +38,6 @@ public interface ITermValueSetConceptDao extends JpaRepository<TermValueSetConce
|
||||||
@Modifying
|
@Modifying
|
||||||
void deleteByTermValueSetId(@Param("pid") Long theValueSetId);
|
void deleteByTermValueSetId(@Param("pid") Long theValueSetId);
|
||||||
|
|
||||||
// FIXME: DM 2019-09-05 - Let's try removing the pre-fetch and the code in BaseHapiTerminologySvcImpl that handles designations so we can compare the processing time. 1/2
|
|
||||||
// @Query("SELECT vsc from TermValueSetConcept vsc WHERE vsc.myValueSetPid = :pid ORDER BY vsc.myOrder")
|
|
||||||
// Slice<TermValueSetConcept> findByTermValueSetIdAndPreFetchDesignations(Pageable thePage, @Param("pid") Long theValueSetId);
|
|
||||||
|
|
||||||
@Query("SELECT vsc from TermValueSetConcept vsc LEFT OUTER JOIN FETCH vsc.myDesignations WHERE vsc.myValueSetPid = :pid ORDER BY vsc.myOrder")
|
|
||||||
Slice<TermValueSetConcept> findByTermValueSetIdAndPreFetchDesignations(Pageable thePage, @Param("pid") Long theValueSetId);
|
|
||||||
|
|
||||||
@Query("SELECT vsc FROM TermValueSetConcept vsc WHERE vsc.myValueSetPid = :pid AND vsc.mySystem = :system_url AND vsc.myCode = :codeval")
|
@Query("SELECT vsc FROM TermValueSetConcept vsc WHERE vsc.myValueSetPid = :pid AND vsc.mySystem = :system_url AND vsc.myCode = :codeval")
|
||||||
Optional<TermValueSetConcept> findByTermValueSetIdSystemAndCode(@Param("pid") Long theValueSetId, @Param("system_url") String theSystem, @Param("codeval") String theCode);
|
Optional<TermValueSetConcept> findByTermValueSetIdSystemAndCode(@Param("pid") Long theValueSetId, @Param("system_url") String theSystem, @Param("codeval") String theCode);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package ca.uhn.fhir.jpa.dao.data;
|
package ca.uhn.fhir.jpa.dao.data;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceSearchView;
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermValueSetConceptView;
|
import ca.uhn.fhir.jpa.entity.TermValueSetConceptView;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -33,6 +30,6 @@ import java.util.List;
|
||||||
public interface ITermValueSetConceptViewDao extends JpaRepository<TermValueSetConceptView, Long> {
|
public interface ITermValueSetConceptViewDao extends JpaRepository<TermValueSetConceptView, Long> {
|
||||||
|
|
||||||
@Query("SELECT v FROM TermValueSetConceptView v WHERE v.myConceptValueSetPid = :pid AND v.myConceptOrder >= :from AND v.myConceptOrder < :to ORDER BY v.myConceptOrder")
|
@Query("SELECT v FROM TermValueSetConceptView v WHERE v.myConceptValueSetPid = :pid AND v.myConceptOrder >= :from AND v.myConceptOrder < :to ORDER BY v.myConceptOrder")
|
||||||
List<TermValueSetConceptView> findConceptsByValueSetPid(@Param("from") int theOffset, @Param("to") int theToIndex, @Param("pid") Long thePid);
|
List<TermValueSetConceptView> findByTermValueSetId(@Param("from") int theFrom, @Param("to") int theTo, @Param("pid") Long theValueSetId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||||
import ca.uhn.fhir.util.ValidateUtil;
|
import ca.uhn.fhir.util.ValidateUtil;
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
@ -67,7 +66,7 @@ public class TermValueSet implements Serializable {
|
||||||
@Column(name = "VSNAME", nullable = true, length = MAX_NAME_LENGTH)
|
@Column(name = "VSNAME", nullable = true, length = MAX_NAME_LENGTH)
|
||||||
private String myName;
|
private String myName;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myValueSet")
|
@OneToMany(mappedBy = "myValueSet", fetch = FetchType.LAZY)
|
||||||
private List<TermValueSetConcept> myConcepts;
|
private List<TermValueSetConcept> myConcepts;
|
||||||
|
|
||||||
@Column(name = "TOTAL_CONCEPTS", nullable = false)
|
@Column(name = "TOTAL_CONCEPTS", nullable = false)
|
||||||
|
@ -82,6 +81,9 @@ public class TermValueSet implements Serializable {
|
||||||
@Column(name = "EXPANSION_STATUS", nullable = false, length = MAX_EXPANSION_STATUS_LENGTH)
|
@Column(name = "EXPANSION_STATUS", nullable = false, length = MAX_EXPANSION_STATUS_LENGTH)
|
||||||
private TermValueSetPreExpansionStatusEnum myExpansionStatus;
|
private TermValueSetPreExpansionStatusEnum myExpansionStatus;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private transient Integer myHashCode;
|
||||||
|
|
||||||
public TermValueSet() {
|
public TermValueSet() {
|
||||||
super();
|
super();
|
||||||
myExpansionStatus = TermValueSetPreExpansionStatusEnum.NOT_EXPANDED;
|
myExpansionStatus = TermValueSetPreExpansionStatusEnum.NOT_EXPANDED;
|
||||||
|
@ -196,7 +198,10 @@ public class TermValueSet implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getUrl().hashCode();
|
if (myHashCode == null) {
|
||||||
|
myHashCode = getUrl().hashCode();
|
||||||
|
}
|
||||||
|
return myHashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -194,15 +194,15 @@ public class TermValueSetConcept implements Serializable {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||||
.append("myId", myId)
|
.append("myId", myId)
|
||||||
// .append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
.append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
||||||
.append("myValueSetPid", myValueSetPid)
|
.append("myValueSetPid", myValueSetPid)
|
||||||
.append("myOrder", myOrder)
|
.append("myOrder", myOrder)
|
||||||
// .append("myValueSetUrl", this.getValueSetUrl())
|
.append("myValueSetUrl", this.getValueSetUrl())
|
||||||
// .append("myValueSetName", this.getValueSetName())
|
.append("myValueSetName", this.getValueSetName())
|
||||||
.append("mySystem", mySystem)
|
.append("mySystem", mySystem)
|
||||||
.append("myCode", myCode)
|
.append("myCode", myCode)
|
||||||
.append("myDisplay", myDisplay)
|
.append("myDisplay", myDisplay)
|
||||||
// .append(myDesignations != null ? ("myDesignations - size=" + myDesignations.size()) : ("myDesignations=(null)"))
|
.append(myDesignations != null ? ("myDesignations - size=" + myDesignations.size()) : ("myDesignations=(null)"))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,12 +213,12 @@ public class TermValueSetConceptDesignation implements Serializable {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||||
.append("myId", myId)
|
.append("myId", myId)
|
||||||
// .append(myConcept != null ? ("myConcept - id=" + myConcept.getId()) : ("myConcept=(null)"))
|
.append(myConcept != null ? ("myConcept - id=" + myConcept.getId()) : ("myConcept=(null)"))
|
||||||
.append("myConceptPid", myConceptPid)
|
.append("myConceptPid", myConceptPid)
|
||||||
// .append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
.append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
||||||
.append("myValueSetPid", myValueSetPid)
|
.append("myValueSetPid", myValueSetPid)
|
||||||
// .append("myValueSetUrl", this.getValueSetUrl())
|
.append("myValueSetUrl", this.getValueSetUrl())
|
||||||
// .append("myValueSetName", this.getValueSetName())
|
.append("myValueSetName", this.getValueSetName())
|
||||||
.append("myLanguage", myLanguage)
|
.append("myLanguage", myLanguage)
|
||||||
.append("myUseSystem", myUseSystem)
|
.append("myUseSystem", myUseSystem)
|
||||||
.append("myUseCode", myUseCode)
|
.append("myUseCode", myUseCode)
|
||||||
|
|
|
@ -30,25 +30,22 @@ import java.io.Serializable;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Immutable
|
@Immutable
|
||||||
@Subselect("select " +
|
@Subselect(
|
||||||
" CONCAT(vsc.PID, ' ', cd.PID) as PID," +
|
"SELECT CONCAT(vsc.PID, ' ', vscd.PID) AS PID, " +
|
||||||
" vsc.PID as CONCEPT_PID, " +
|
" vsc.PID AS CONCEPT_PID, " +
|
||||||
" cd.PID as DESIG_PID, " +
|
" vsc.VALUESET_PID AS CONCEPT_VALUESET_PID, " +
|
||||||
" vsc.CODEVAL as CONCEPT_CODE, " +
|
" vsc.VALUESET_ORDER AS CONCEPT_VALUESET_ORDER, " +
|
||||||
" vsc.DISPLAY as CONCEPT_DISPLAY, " +
|
" vsc.SYSTEM_URL AS CONCEPT_SYSTEM_URL, " +
|
||||||
" vsc.VALUESET_ORDER as CONCEPT_ORDER, " +
|
" vsc.CODEVAL AS CONCEPT_CODEVAL, " +
|
||||||
" vsc.SYSTEM_URL as CONCEPT_SYSTEM_URL, " +
|
" vsc.DISPLAY AS CONCEPT_DISPLAY, " +
|
||||||
" vsc.VALUESET_PID as CONCEPT_VS_PID, " +
|
" vscd.PID AS DESIGNATION_PID, " +
|
||||||
// " cd.VALUESET_CONCEPT_PID as VALUESET2_35_1_, " +
|
" vscd.LANG AS DESIGNATION_LANG, " +
|
||||||
" cd.LANG as DESIG_LANG, " +
|
" vscd.USE_SYSTEM AS DESIGNATION_USE_SYSTEM, " +
|
||||||
" cd.USE_CODE as DESIG_USE_CODE, " +
|
" vscd.USE_CODE AS DESIGNATION_USE_CODE, " +
|
||||||
" cd.USE_DISPLAY as DESIG_USE_DISPLAY, " +
|
" vscd.USE_DISPLAY AS DESIGNATION_USE_DISPLAY, " +
|
||||||
" cd.USE_SYSTEM as DESIG_USE_SYSTEM, " +
|
" vscd.VAL AS DESIGNATION_VAL " +
|
||||||
" cd.VAL as DESIG_VAL " +
|
"FROM TRM_VALUESET_CONCEPT vsc " +
|
||||||
" from TRM_VALUESET_CONCEPT vsc " +
|
" LEFT OUTER JOIN TRM_VALUESET_C_DESIGNATION vscd ON vsc.PID = vscd.VALUESET_CONCEPT_PID"
|
||||||
" left outer join TRM_VALUESET_C_DESIGNATION cd on vsc.PID=cd.VALUESET_CONCEPT_PID "
|
|
||||||
// +
|
|
||||||
// " order by vsc.VALUESET_ORDER"
|
|
||||||
)
|
)
|
||||||
public class TermValueSetConceptView implements Serializable {
|
public class TermValueSetConceptView implements Serializable {
|
||||||
|
|
||||||
|
@ -57,38 +54,50 @@ public class TermValueSetConceptView implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@Column(name="PID")
|
@Column(name="PID")
|
||||||
private String myPid;
|
private String myPid;
|
||||||
|
|
||||||
@Column(name = "CONCEPT_PID")
|
@Column(name = "CONCEPT_PID")
|
||||||
private Long myConceptPid;
|
private Long myConceptPid;
|
||||||
@Column(name = "DESIG_PID")
|
|
||||||
private Long myDesigPid;
|
@Column(name = "CONCEPT_VALUESET_PID")
|
||||||
@Column(name = "CONCEPT_CODE")
|
private Long myConceptValueSetPid;
|
||||||
private String myConceptCode;
|
|
||||||
@Column(name = "CONCEPT_DISPLAY")
|
@Column(name = "CONCEPT_VALUESET_ORDER")
|
||||||
private String myConceptDisplay;
|
|
||||||
@Column(name = "CONCEPT_ORDER")
|
|
||||||
private int myConceptOrder;
|
private int myConceptOrder;
|
||||||
|
|
||||||
@Column(name = "CONCEPT_SYSTEM_URL")
|
@Column(name = "CONCEPT_SYSTEM_URL")
|
||||||
private String myConceptSystemUrl;
|
private String myConceptSystemUrl;
|
||||||
@Column(name = "CONCEPT_VS_PID")
|
|
||||||
private Long myConceptValueSetPid;
|
@Column(name = "CONCEPT_CODEVAL")
|
||||||
@Column(name = "DESIG_LANG")
|
private String myConceptCode;
|
||||||
private String myDesigLang;
|
|
||||||
@Column(name = "DESIG_USE_CODE")
|
@Column(name = "CONCEPT_DISPLAY")
|
||||||
private String myDesigUseCode;
|
private String myConceptDisplay;
|
||||||
@Column(name = "DESIG_USE_DISPLAY")
|
|
||||||
private String myDesigUseDisplay;
|
@Column(name = "DESIGNATION_PID")
|
||||||
@Column(name = "DESIG_USE_SYSTEM")
|
private Long myDesignationPid;
|
||||||
private String myDesigUseSystem;
|
|
||||||
@Column(name = "DESIG_VAL")
|
@Column(name = "DESIGNATION_LANG")
|
||||||
private String myDesigVal;
|
private String myDesignationLang;
|
||||||
|
|
||||||
|
@Column(name = "DESIGNATION_USE_SYSTEM")
|
||||||
|
private String myDesignationUseSystem;
|
||||||
|
|
||||||
|
@Column(name = "DESIGNATION_USE_CODE")
|
||||||
|
private String myDesignationUseCode;
|
||||||
|
|
||||||
|
@Column(name = "DESIGNATION_USE_DISPLAY")
|
||||||
|
private String myDesignationUseDisplay;
|
||||||
|
|
||||||
|
@Column(name = "DESIGNATION_VAL")
|
||||||
|
private String myDesignationVal;
|
||||||
|
|
||||||
|
|
||||||
public Long getConceptPid() {
|
public Long getConceptPid() {
|
||||||
return myConceptPid;
|
return myConceptPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDesigPid() {
|
public String getConceptSystemUrl() {
|
||||||
return myDesigPid;
|
return myConceptSystemUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConceptCode() {
|
public String getConceptCode() {
|
||||||
|
@ -99,35 +108,27 @@ public class TermValueSetConceptView implements Serializable {
|
||||||
return myConceptDisplay;
|
return myConceptDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getConceptOrder() {
|
public Long getDesignationPid() {
|
||||||
return myConceptOrder;
|
return myDesignationPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConceptSystemUrl() {
|
public String getDesignationLang() {
|
||||||
return myConceptSystemUrl;
|
return myDesignationLang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getConceptValueSetPid() {
|
public String getDesignationUseSystem() {
|
||||||
return myConceptValueSetPid;
|
return myDesignationUseSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDesigLang() {
|
public String getDesignationUseCode() {
|
||||||
return myDesigLang;
|
return myDesignationUseCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDesigUseCode() {
|
public String getDesignationUseDisplay() {
|
||||||
return myDesigUseCode;
|
return myDesignationUseDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDesigUseDisplay() {
|
public String getDesignationVal() {
|
||||||
return myDesigUseDisplay;
|
return myDesignationVal;
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesigUseSystem() {
|
|
||||||
return myDesigUseSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesigVal() {
|
|
||||||
return myDesigVal;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import ca.uhn.fhir.jpa.dao.data.*;
|
||||||
import ca.uhn.fhir.jpa.entity.*;
|
import ca.uhn.fhir.jpa.entity.*;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||||
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
|
|
||||||
import ca.uhn.fhir.jpa.util.ScrollableResultsIterator;
|
import ca.uhn.fhir.jpa.util.ScrollableResultsIterator;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
|
@ -68,7 +67,6 @@ import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
@ -530,75 +528,64 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
|
|
||||||
private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) {
|
private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) {
|
||||||
int conceptsExpanded = 0;
|
int conceptsExpanded = 0;
|
||||||
|
int designationsExpanded = 0;
|
||||||
int toIndex = theOffset + theCount;
|
int toIndex = theOffset + theCount;
|
||||||
|
Collection<TermValueSetConceptView> conceptViews = myTermValueSetConceptViewDao.findByTermValueSetId(theOffset, toIndex, theTermValueSet.getId());
|
||||||
|
|
||||||
// Slice<TermValueSetConcept> slice = myValueSetConceptDao.findByTermValueSetIdAndPreFetchDesignations(SearchCoordinatorSvcImpl.toPage(theOffset, toIndex), theTermValueSet.getId());
|
if (conceptViews.isEmpty()) {
|
||||||
Pageable page = SearchCoordinatorSvcImpl.toPage(theOffset, toIndex);
|
logConceptsExpanded("No concepts to expand. ", theTermValueSet, conceptsExpanded);
|
||||||
Collection<TermValueSetConceptView> slice = myTermValueSetConceptViewDao.findConceptsByValueSetPid(theOffset, toIndex, theTermValueSet.getId());
|
|
||||||
|
|
||||||
if (slice.isEmpty()) {
|
|
||||||
logConceptsExpanded(theTermValueSet, conceptsExpanded);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Long, ValueSet.ValueSetExpansionContainsComponent> pidToConcept = new HashMap<>();
|
Map<Long, ValueSet.ValueSetExpansionContainsComponent> pidToConcept = new HashMap<>();
|
||||||
|
for (TermValueSetConceptView conceptView : conceptViews) {
|
||||||
|
|
||||||
int designationsExpanded = 0;
|
Long conceptPid = conceptView.getConceptPid();
|
||||||
for (TermValueSetConceptView concept : slice) {
|
|
||||||
|
|
||||||
Long conceptPid = concept.getConceptPid();
|
|
||||||
ValueSet.ValueSetExpansionContainsComponent containsComponent;
|
ValueSet.ValueSetExpansionContainsComponent containsComponent;
|
||||||
|
|
||||||
if (!pidToConcept.containsKey(conceptPid)) {
|
if (!pidToConcept.containsKey(conceptPid)) {
|
||||||
containsComponent = theExpansionComponent.addContains();
|
containsComponent = theExpansionComponent.addContains();
|
||||||
containsComponent.setSystem(concept.getConceptSystemUrl());
|
containsComponent.setSystem(conceptView.getConceptSystemUrl());
|
||||||
containsComponent.setCode(concept.getConceptCode());
|
containsComponent.setCode(conceptView.getConceptCode());
|
||||||
containsComponent.setDisplay(concept.getConceptDisplay());
|
containsComponent.setDisplay(conceptView.getConceptDisplay());
|
||||||
pidToConcept.put(conceptPid, containsComponent);
|
pidToConcept.put(conceptPid, containsComponent);
|
||||||
} else {
|
} else {
|
||||||
containsComponent = pidToConcept.get(conceptPid);
|
containsComponent = pidToConcept.get(conceptPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (concept.getDesigPid() != null) {
|
// TODO: DM 2019-08-17 - Implement includeDesignations parameter for $expand operation to designations optional.
|
||||||
|
if (conceptView.getDesignationPid() != null) {
|
||||||
ValueSet.ConceptReferenceDesignationComponent designationComponent = containsComponent.addDesignation();
|
ValueSet.ConceptReferenceDesignationComponent designationComponent = containsComponent.addDesignation();
|
||||||
designationComponent.setLanguage(concept.getDesigLang());
|
designationComponent.setLanguage(conceptView.getDesignationLang());
|
||||||
designationComponent.setUse(new Coding(
|
designationComponent.setUse(new Coding(
|
||||||
concept.getDesigUseSystem(),
|
conceptView.getDesignationUseSystem(),
|
||||||
concept.getDesigUseCode(),
|
conceptView.getDesignationUseCode(),
|
||||||
concept.getDesigUseDisplay()));
|
conceptView.getDesignationUseDisplay()));
|
||||||
designationComponent.setValue(concept.getDesigVal());
|
designationComponent.setValue(conceptView.getDesignationVal());
|
||||||
|
|
||||||
if (++designationsExpanded % 250 == 0) {
|
if (++designationsExpanded % 250 == 0) {
|
||||||
logDesignationsExpanded(theTermValueSet, designationsExpanded);
|
logDesignationsExpanded("Expansion of designations in progress. ", theTermValueSet, designationsExpanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
logDesignationsExpanded(theTermValueSet, designationsExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: DM 2019-08-17 - Implement includeDesignations parameter for $expand operation to make this optional.
|
|
||||||
// FIXME: DM 2019-09-05 - Let's try removing the pre-fetch and the code in BaseHapiTerminologySvcImpl that handles designations so we can compare the processing time. 2/2
|
|
||||||
// expandDesignations(theTermValueSet, concept, containsComponent);
|
|
||||||
|
|
||||||
if (++conceptsExpanded % 250 == 0) {
|
if (++conceptsExpanded % 250 == 0) {
|
||||||
logConceptsExpanded(theTermValueSet, conceptsExpanded);
|
logConceptsExpanded("Expansion of concepts in progress. ", theTermValueSet, conceptsExpanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logConceptsExpanded(theTermValueSet, conceptsExpanded);
|
logDesignationsExpanded("Finished expanding designations. ", theTermValueSet, designationsExpanded);
|
||||||
|
logConceptsExpanded("Finished expanding concepts. ", theTermValueSet, conceptsExpanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logConceptsExpanded(TermValueSet theTermValueSet, int theConceptsExpanded) {
|
private void logConceptsExpanded(String thePrefix, TermValueSet theTermValueSet, int theConceptsExpanded) {
|
||||||
if (theConceptsExpanded > 0) {
|
if (theConceptsExpanded > 0) {
|
||||||
// FIXME: DM 2019-09-05 - Account for in progress vs. total.
|
ourLog.info("{}Have expanded {} concepts in ValueSet[{}]", thePrefix, theConceptsExpanded, theTermValueSet.getUrl());
|
||||||
ourLog.info("Have expanded {} concepts in ValueSet[{}]", theConceptsExpanded, theTermValueSet.getUrl());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logDesignationsExpanded(TermValueSet theValueSet, int theDesignationsExpanded) {
|
private void logDesignationsExpanded(String thePrefix, TermValueSet theTermValueSet, int theDesignationsExpanded) {
|
||||||
if (theDesignationsExpanded > 0) {
|
if (theDesignationsExpanded > 0) {
|
||||||
// FIXME: DM 2019-09-05 - Account for in progress vs. total.
|
ourLog.info("{}Have expanded {} designations in ValueSet[{}]", thePrefix, theDesignationsExpanded, theTermValueSet.getUrl());
|
||||||
// FIXME: DM 2019-09-06 - Change to debug.
|
|
||||||
ourLog.info("Have expanded {} designations in ValueSet[{}]", theDesignationsExpanded, theValueSet.getUrl());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,6 +633,8 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: DM 2019-09-06 - After handling excludes, we need to adjust TermValueSetConcept.myOrder to account for any gaps.
|
||||||
|
|
||||||
ourLog.info("Done working with {} in {}ms", valueSetInfo, sw.getMillis());
|
ourLog.info("Done working with {} in {}ms", valueSetInfo, sw.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1838,8 +1827,8 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
ourLog.info("Done storing TermConceptMap[{}]", termConceptMap.getId());
|
ourLog.info("Done storing TermConceptMap[{}]", termConceptMap.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DM 2019-09-05 - Return to 600000
|
// FIXME: DM 2019-09-05 - Return to 600000 before merging into master.
|
||||||
@Scheduled(fixedDelay = 600000) // 10 minutes.
|
@Scheduled(fixedDelay = 6000) // 10 minutes.
|
||||||
@Override
|
@Override
|
||||||
public synchronized void preExpandDeferredValueSetsToTerminologyTables() {
|
public synchronized void preExpandDeferredValueSetsToTerminologyTables() {
|
||||||
if (isNotSafeToPreExpandValueSets()) {
|
if (isNotSafeToPreExpandValueSets()) {
|
||||||
|
|
Loading…
Reference in New Issue