Added an indexed order column to TermValueSetConcept for improved fetching.
This commit is contained in:
parent
aa9a984075
commit
ea19b46f60
|
@ -149,7 +149,7 @@ public class DaoConfig {
|
|||
/**
|
||||
* EXPERIMENTAL - Do not use in production! Do not change default of {@code false}!
|
||||
*/
|
||||
private boolean myPreExpandValueSetsExperimental = false;
|
||||
private boolean myPreExpandValueSetsExperimental = true;
|
||||
private boolean myFilterParameterEnabled = false;
|
||||
private StoreMetaSourceInformationEnum myStoreMetaSourceInformation = StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID;
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ public interface ITermValueSetConceptDao extends JpaRepository<TermValueSetConce
|
|||
@Modifying
|
||||
void deleteByTermValueSetId(@Param("pid") Long theValueSetId);
|
||||
|
||||
@Query("SELECT vsc from TermValueSetConcept vsc LEFT OUTER JOIN FETCH vsc.myDesignations WHERE vsc.myValueSet.myId = :pid")
|
||||
@Query("SELECT vsc from TermValueSetConcept vsc LEFT OUTER JOIN FETCH vsc.myDesignations WHERE vsc.myValueSet.myId = :pid ORDER BY vsc.myOrder ASC")
|
||||
Slice<TermValueSetConcept> findByTermValueSetIdAndPreFetchDesignations(Pageable thePage, @Param("pid") Long theValueSetId);
|
||||
|
||||
@Query("SELECT vsc FROM TermValueSetConcept vsc WHERE vsc.myValueSet.myId = :pid AND vsc.mySystem = :system_url AND vsc.myCode = :codeval")
|
||||
|
|
|
@ -40,7 +40,8 @@ import static org.apache.commons.lang3.StringUtils.length;
|
|||
* bork up migration tasks.
|
||||
*/
|
||||
@Table(name = "TRM_VALUESET_CONCEPT", uniqueConstraints = {
|
||||
@UniqueConstraint(name = "IDX_VS_CONCEPT_CS_CD", columnNames = {"VALUESET_PID", "SYSTEM_URL", "CODEVAL"})
|
||||
@UniqueConstraint(name = "IDX_VS_CONCEPT_CS_CD", columnNames = {"VALUESET_PID", "SYSTEM_URL", "CODEVAL"}),
|
||||
@UniqueConstraint(name = "IDX_VS_CONCEPT_ORDER", columnNames = {"VALUESET_PID", "VALUESET_ORDER"})
|
||||
})
|
||||
@Entity()
|
||||
public class TermValueSetConcept implements Serializable {
|
||||
|
@ -56,6 +57,12 @@ public class TermValueSetConcept implements Serializable {
|
|||
@JoinColumn(name = "VALUESET_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VALUESET_PID"))
|
||||
private TermValueSet myValueSet;
|
||||
|
||||
@Column(name = "VALUESET_PID", insertable = false, updatable = false, nullable = false)
|
||||
private Long myValueSetPid;
|
||||
|
||||
@Column(name = "VALUESET_ORDER", nullable = false)
|
||||
private int myOrder;
|
||||
|
||||
@Transient
|
||||
private String myValueSetUrl;
|
||||
|
||||
|
@ -87,6 +94,15 @@ public class TermValueSetConcept implements Serializable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return myOrder;
|
||||
}
|
||||
|
||||
public TermValueSetConcept setOrder(int theOrder) {
|
||||
myOrder = theOrder;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getValueSetUrl() {
|
||||
if (myValueSetUrl == null) {
|
||||
myValueSetUrl = getValueSet().getUrl();
|
||||
|
@ -173,6 +189,8 @@ public class TermValueSetConcept implements Serializable {
|
|||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("myId", myId)
|
||||
.append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
||||
.append("myValueSetPid", myValueSetPid)
|
||||
.append("myOrder", myOrder)
|
||||
.append("myValueSetUrl", this.getValueSetUrl())
|
||||
.append("myValueSetName", this.getValueSetName())
|
||||
.append("mySystem", mySystem)
|
||||
|
|
|
@ -52,10 +52,16 @@ public class TermValueSetConceptDesignation implements Serializable {
|
|||
@JoinColumn(name = "VALUESET_CONCEPT_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VALUESET_CONCEPT_PID"))
|
||||
private TermValueSetConcept myConcept;
|
||||
|
||||
@Column(name = "VALUESET_CONCEPT_PID", insertable = false, updatable = false, nullable = false)
|
||||
private Long myConceptPid;
|
||||
|
||||
@ManyToOne()
|
||||
@JoinColumn(name = "VALUESET_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VSCD_VS_PID"))
|
||||
private TermValueSet myValueSet;
|
||||
|
||||
@Column(name = "VALUESET_PID", insertable = false, updatable = false, nullable = false)
|
||||
private Long myValueSetPid;
|
||||
|
||||
@Transient
|
||||
private String myValueSetUrl;
|
||||
|
||||
|
@ -202,7 +208,9 @@ public class TermValueSetConceptDesignation implements Serializable {
|
|||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("myId", myId)
|
||||
.append(myConcept != null ? ("myConcept - id=" + myConcept.getId()) : ("myConcept=(null)"))
|
||||
.append("myConceptPid", myConceptPid)
|
||||
.append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)"))
|
||||
.append("myValueSetPid", myValueSetPid)
|
||||
.append("myValueSetUrl", this.getValueSetUrl())
|
||||
.append("myValueSetName", this.getValueSetName())
|
||||
.append("myLanguage", myLanguage)
|
||||
|
|
|
@ -97,6 +97,7 @@ public class ValueSetConceptAccumulator implements IValueSetConceptAccumulator {
|
|||
|
||||
TermValueSetConcept concept = new TermValueSetConcept();
|
||||
concept.setValueSet(myTermValueSet);
|
||||
concept.setOrder(myConceptsSaved);
|
||||
concept.setSystem(theSystem);
|
||||
concept.setCode(theCode);
|
||||
if (isNotBlank(theDisplay)) {
|
||||
|
|
|
@ -2097,11 +2097,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus());
|
||||
|
||||
TermValueSetConcept concept = termValueSet.getConcepts().get(0);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8450-9", concept.getCode());
|
||||
assertEquals("Systolic blood pressure--expiration", concept.getDisplay());
|
||||
assertEquals(2, concept.getDesignations().size());
|
||||
assertEquals(0, concept.getOrder());
|
||||
|
||||
TermValueSetConceptDesignation designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2118,20 +2119,22 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systoliskt blodtryck - utgång", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(1);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("11378-7", concept.getCode());
|
||||
assertEquals("Systolic blood pressure at First encounter", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(1, concept.getOrder());
|
||||
|
||||
// ...
|
||||
|
||||
concept = termValueSet.getConcepts().get(22);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8491-3", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 1 hour minimum", concept.getDisplay());
|
||||
assertEquals(1, concept.getDesignations().size());
|
||||
assertEquals(22, concept.getOrder());
|
||||
|
||||
designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2141,11 +2144,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(23);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8492-1", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 8 hour minimum", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(23, concept.getOrder());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2195,11 +2199,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus());
|
||||
|
||||
TermValueSetConcept concept = termValueSet.getConcepts().get(0);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8450-9", concept.getCode());
|
||||
assertEquals("Systolic blood pressure--expiration", concept.getDisplay());
|
||||
assertEquals(2, concept.getDesignations().size());
|
||||
assertEquals(0, concept.getOrder());
|
||||
|
||||
TermValueSetConceptDesignation designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2216,20 +2221,22 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systoliskt blodtryck - utgång", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(1);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("11378-7", concept.getCode());
|
||||
assertEquals("Systolic blood pressure at First encounter", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(1, concept.getOrder());
|
||||
|
||||
// ...
|
||||
|
||||
concept = termValueSet.getConcepts().get(22);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8491-3", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 1 hour minimum", concept.getDisplay());
|
||||
assertEquals(1, concept.getDesignations().size());
|
||||
assertEquals(22, concept.getOrder());
|
||||
|
||||
designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2239,11 +2246,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(23);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8492-1", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 8 hour minimum", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(23, concept.getOrder());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2293,11 +2301,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus());
|
||||
|
||||
TermValueSetConcept concept = termValueSet.getConcepts().get(0);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8450-9", concept.getCode());
|
||||
assertEquals("Systolic blood pressure--expiration", concept.getDisplay());
|
||||
assertEquals(2, concept.getDesignations().size());
|
||||
assertEquals(0, concept.getOrder());
|
||||
|
||||
TermValueSetConceptDesignation designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2314,20 +2323,22 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systoliskt blodtryck - utgång", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(1);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("11378-7", concept.getCode());
|
||||
assertEquals("Systolic blood pressure at First encounter", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(1, concept.getOrder());
|
||||
|
||||
// ...
|
||||
|
||||
concept = termValueSet.getConcepts().get(22 - 2);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8491-3", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 1 hour minimum", concept.getDisplay());
|
||||
assertEquals(1, concept.getDesignations().size());
|
||||
assertEquals(22, concept.getOrder());
|
||||
|
||||
designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2337,11 +2348,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(23 - 2);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8492-1", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 8 hour minimum", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(23, concept.getOrder());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2391,11 +2403,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus());
|
||||
|
||||
TermValueSetConcept concept = termValueSet.getConcepts().get(0);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8450-9", concept.getCode());
|
||||
assertEquals("Systolic blood pressure--expiration", concept.getDisplay());
|
||||
assertEquals(2, concept.getDesignations().size());
|
||||
assertEquals(0, concept.getOrder());
|
||||
|
||||
TermValueSetConceptDesignation designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2412,20 +2425,22 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systoliskt blodtryck - utgång", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(1);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("11378-7", concept.getCode());
|
||||
assertEquals("Systolic blood pressure at First encounter", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(1, concept.getOrder());
|
||||
|
||||
// ...
|
||||
|
||||
concept = termValueSet.getConcepts().get(22 - 2);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8491-3", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 1 hour minimum", concept.getDisplay());
|
||||
assertEquals(1, concept.getDesignations().size());
|
||||
assertEquals(22, concept.getOrder());
|
||||
|
||||
designation = concept.getDesignations().get(0);
|
||||
assertEquals("nl", designation.getLanguage());
|
||||
|
@ -2435,11 +2450,12 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue());
|
||||
|
||||
concept = termValueSet.getConcepts().get(23 - 2);
|
||||
ourLog.info("Code:\n" + concept.toString());
|
||||
ourLog.info("Concept:\n" + concept.toString());
|
||||
assertEquals("http://acme.org", concept.getSystem());
|
||||
assertEquals("8492-1", concept.getCode());
|
||||
assertEquals("Systolic blood pressure 8 hour minimum", concept.getDisplay());
|
||||
assertEquals(0, concept.getDesignations().size());
|
||||
assertEquals(23, concept.getOrder());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,15 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
Builder.BuilderWithTableName termValueSetTable = version.onTable("TRM_VALUESET");
|
||||
termValueSetTable.addColumn("TOTAL_CONCEPTS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
termValueSetTable.addColumn("TOTAL_CONCEPT_DESIGNATIONS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
|
||||
// TermValueSetConcept
|
||||
version.startSectionWithMessage("Processing table: TRM_VALUESET_CONCEPT");
|
||||
Builder.BuilderWithTableName termValueSetConceptTable = version.onTable("TRM_VALUESET_CONCEPT");
|
||||
termValueSetConceptTable.addColumn("VALUESET_ORDER").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT);
|
||||
termValueSetConceptTable
|
||||
.addIndex("IDX_VS_CONCEPT_ORDER")
|
||||
.unique(true)
|
||||
.withColumns("VALUESET_PID", "VALUESET_ORDER");
|
||||
}
|
||||
|
||||
protected void init400() {
|
||||
|
|
Loading…
Reference in New Issue