Skip to content

Commit

Permalink
Ticket 47772: Improve performance when loading Learn about pages - St…
Browse files Browse the repository at this point in the history
…udies (#595)

- Decouple Learn Studies grid from the Overview/details page.
- Create a new StudyOverview store and model in order to load and display Study Overview separately from the Study grid.
- Unrelated to perf improvements - BCR query fixes.
  • Loading branch information
labkey-bpatel authored Jul 29, 2023
1 parent ea2fad4 commit 64f3f3e
Show file tree
Hide file tree
Showing 11 changed files with 783 additions and 316 deletions.
2 changes: 1 addition & 1 deletion resources/queries/cds/lineage_alignment.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SELECT
aseq.mab_id,
algn.sequence_id,
algn.locus,
Expand Down Expand Up @@ -66,7 +67,6 @@ algn.v_sequence_end,
algn.v_germline_start,
algn.v_germline_end,
algn.d_sequence_start,
2
algn.d_sequence_end,
algn.d_germline_start,
algn.d_germline_end,
Expand Down
2 changes: 1 addition & 1 deletion resources/queries/cds/lineage_sequence_germline.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ SELECT
aseq.lineage
FROM sequence_germline AS sgrm
JOIN antibody_sequence AS aseq ON sgrm.sequence_id = aseq.sequence_id
LEFT JOIN preferred_allele AS pref ON pref.sequence_id = sgrm.sequence_id AND pref.allele = sgrm.al
LEFT JOIN preferred_allele AS pref ON pref.sequence_id = sgrm.sequence_id AND pref.allele = sgrm.allele
28 changes: 25 additions & 3 deletions src/org/labkey/cds/CDSController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1122,14 +1122,36 @@ else if (isPost())
}
}

public static class StudyProtocolForm
{
String _prot;

public String getProt()
{
return _prot;
}

public void setProt(String prot)
{
_prot = prot;
}

}

@RequiresPermission(ReadPermission.class)
public static class GetNonIntegratedDocumentAction extends ReadOnlyApiAction<Object>
public static class GetNonIntegratedDocumentAction extends ReadOnlyApiAction<StudyProtocolForm>
{
@Override
public Object execute(Object o, BindException errors)
public Object execute(StudyProtocolForm protocol, BindException errors)
{
TableInfo tableInfo = QueryService.get().getUserSchema(getUser(), getContainer(), "cds").getTable("learn_documentsforstudies", null);
Filter filter = new SimpleFilter(FieldKey.fromString("document_type"), "Non-Integrated Assay");
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("document_type"), "Non-Integrated Assay");

if (null != protocol && StringUtils.isNotBlank(protocol.getProt()))
{
filter.addCondition(FieldKey.fromString("prot"), protocol.getProt());
}

TableSelector tableSelector = new TableSelector(tableInfo, filter, null);
List<StudyDocumentObj> niDocuments = tableSelector.getArrayList(StudyDocumentObj.class);

Expand Down
2 changes: 2 additions & 0 deletions src/org/labkey/cds/view/template/ConnectorTemplate.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
srcPath + "/app/model/Assay.js",
srcPath + "/app/model/Labs.js",
srcPath + "/app/model/Study.js",
srcPath + "/app/model/StudyOverview.js",
srcPath + "/app/model/StudyProducts.js",
srcPath + "/app/model/VariableList.js",
srcPath + "/app/model/Report.js",
Expand All @@ -321,6 +322,7 @@
srcPath + "/app/store/Assay.js",
srcPath + "/app/store/Labs.js",
srcPath + "/app/store/Study.js",
srcPath + "/app/store/StudyOverview.js",
srcPath + "/app/store/StudyProducts.js",
srcPath + "/app/store/VariableList.js",
srcPath + "/app/store/Report.js",
Expand Down
2 changes: 2 additions & 0 deletions webapp/Connector/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Ext4.define('Connector.cube.Configuration', {
detailCollection: 'Connector.app.store.Study',
detailModel: 'Connector.app.model.Study',
detailView: 'Connector.app.view.Study',
detailItemCollection: 'Connector.app.store.StudyOverview',
itemDetailTabs: [{
url: 'overview',
isDefault: true,
Expand Down Expand Up @@ -833,6 +834,7 @@ Ext4.define('Connector.cube.Configuration', {
supportsSummary: true,
summaryTargetLevel: 'path::0|1',
detailCollection: undefined,
detailItemCollection: undefined,
detailModel: undefined,
detailView: undefined,
itemDetail: undefined,
Expand Down
2 changes: 2 additions & 0 deletions webapp/Connector/extapp.lib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<script path="Connector/src/app/model/Assay.js"/>
<script path="Connector/src/app/model/Labs.js"/>
<script path="Connector/src/app/model/Study.js"/>
<script path="Connector/src/app/model/StudyOverview.js"/>
<script path="Connector/src/app/model/StudyProducts.js"/>
<script path="Connector/src/app/model/VariableList.js"/>
<script path="Connector/src/app/model/Report.js"/>
Expand All @@ -176,6 +177,7 @@
<script path="Connector/src/app/store/Assay.js"/>
<script path="Connector/src/app/store/Labs.js"/>
<script path="Connector/src/app/store/Study.js"/>
<script path="Connector/src/app/store/StudyOverview.js"/>
<script path="Connector/src/app/store/StudyProducts.js"/>
<script path="Connector/src/app/store/VariableList.js"/>
<script path="Connector/src/app/store/Report.js"/>
Expand Down
49 changes: 0 additions & 49 deletions webapp/Connector/src/app/model/Study.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,20 @@ Ext.define('Connector.app.model.Study', {
{name: 'Container'},
{name: 'network'},
{name: 'label', sortType: 'asUCString'},
{name: 'short_name'},
{name: 'study_title'},
{name: 'type'},
{name: 'status'},
{name: 'stage'},
{name: 'species'},
{name: 'population'},
{name: 'executive_summary'},
{name: 'description'},
{name: 'strategy'},
{name: 'groups'},
{name: 'groups_header'},
{name: 'groups_data'},
{name: 'treatment_schema_link'},
{name: 'rationale'},
{name: 'hypothesis'},
{name: 'objectives'},
{name: 'methods'},
{name: 'assay_schema_link'},
{name: 'findings'},
{name: 'conclusions'},
{name: 'publications'},
{name: 'start_date', defaultValue: undefined },
{name: 'public_date', defaultValue: undefined },
{name: 'data_availability'},
{name: 'ni_data_availability'},
{name: 'data_accessible'},
{name: 'cavd_affiliation'},
{name: 'cavd_affiliation_filename'},
{name: 'cavd_affiliation_file_path'},
{name: 'cavd_affiliation_file_accessible'},
{name: 'cavd_affiliation_file_has_permission'},
{name: 'study_cohort'},
{name: 'first_enr_date', defaultValue: undefined },
{name: 'followup_complete_date', defaultValue: undefined },
{name: 'discussion'},
{name: 'context'},
{name: 'grant_pi_name'},
{name: 'grant_pi_email'},
{name: 'grant_pm_name'},
{name: 'grant_pm_email'},
{name: 'investigator_name'},
{name: 'investigator_email'},
{name: 'primary_poc_name'},
{name: 'primary_poc_email'},
{name: 'date_to_sort_on', sortType: function(dateToSortOn) {
if (!dateToSortOn)
return;
Expand Down Expand Up @@ -98,30 +67,12 @@ Ext.define('Connector.app.model.Study', {
{name: 'products', convert : Connector.model.Filter.asArray},
{name: 'product_classes', convert : Connector.model.Filter.asArray},
{name: 'product_names', convert : Connector.model.Filter.asArray},
{name: 'assays', convert : Connector.model.Filter.asArray},
{name: 'groups_treatment_schema', defaultValue: undefined},
{name: 'methods_assay_schema', defaultValue: undefined},
{name: 'assays_added_count'},
{name: 'ni_assays_added_count'},
{name: 'assays_added', convert : Connector.model.Filter.asArray},
{name: 'ni_assays_added', convert : Connector.model.Filter.asArray},
{name: 'atlas_link'},
{name: 'cavd_link'},

{name: 'protocol_docs_and_study_plans', convert : Connector.model.Filter.asArray},
{name: 'protocol_docs_and_study_plans_has_permission'},
{name: 'data_listings_and_reports', convert : Connector.model.Filter.asArray},
{name: 'data_listings_and_reports_has_permission'},
{name: 'non_integrated_assay_data', convert : Connector.model.Filter.asArray},
{name: 'non_integrated_assay_data_has_permission'},
{name: 'publications', convert : Connector.model.Filter.asArray},
{name: 'pub_available_data_count'},
{name: 'relationships', convert : Connector.model.Filter.asArray},
{name: 'clintrials_id'},
{name: 'specimen_repository_label'},
{name: 'monoclonal_antibodies', convert : Connector.model.Filter.asArray},
{name: 'interactive_reports', convert : Connector.model.Filter.asArray},
{name: 'curated_groups', convert : Connector.model.Filter.asArray},
{name: 'data_types_available', convert : Connector.model.Filter.asArray},
{name: 'data_available'}
]
Expand Down
128 changes: 128 additions & 0 deletions webapp/Connector/src/app/model/StudyOverview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright (c) 2023 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
Ext.define('Connector.app.model.StudyOverview', {

extend : 'Ext.data.Model',

idProperty: 'study_name',

resolvableField: 'label',

dataAvailabilityField: 'assays_added',

ni_dataAvailabilityField: 'ni_assays_added',

fields: [
{name: 'study_name'},
{name: 'Container'},
{name: 'network'},
{name: 'label', sortType: 'asUCString'},
{name: 'short_name'},
{name: 'study_title'},
{name: 'type'},
{name: 'status'},
{name: 'stage'},
{name: 'species'},
{name: 'population'},
{name: 'executive_summary'},
{name: 'description'},
{name: 'strategy'},
{name: 'groups'},
{name: 'groups_header'},
{name: 'groups_data'},
{name: 'treatment_schema_link'},
{name: 'rationale'},
{name: 'hypothesis'},
{name: 'objectives'},
{name: 'methods'},
{name: 'assay_schema_link'},
{name: 'findings'},
{name: 'conclusions'},
{name: 'publications'},
{name: 'start_date', defaultValue: undefined },
{name: 'public_date', defaultValue: undefined },
{name: 'data_availability'},
{name: 'ni_data_availability'},
{name: 'data_accessible'},
{name: 'cavd_affiliation'},
{name: 'cavd_affiliation_filename'},
{name: 'cavd_affiliation_file_path'},
{name: 'cavd_affiliation_file_accessible'},
{name: 'cavd_affiliation_file_has_permission'},
{name: 'study_cohort'},
{name: 'first_enr_date', defaultValue: undefined },
{name: 'followup_complete_date', defaultValue: undefined },
{name: 'discussion'},
{name: 'context'},
{name: 'grant_pi_name'},
{name: 'grant_pi_email'},
{name: 'grant_pm_name'},
{name: 'grant_pm_email'},
{name: 'investigator_name'},
{name: 'investigator_email'},
{name: 'primary_poc_name'},
{name: 'primary_poc_email'},
{name: 'date_to_sort_on', sortType: function(dateToSortOn) {
if (!dateToSortOn)
return;

var row = dateToSortOn.split("|");
var stage = row[0];
var date = new Date(row[1]);

switch (stage) {
case "In Progress":
stage = 1;
break;
case "Assays Completed":
stage = 2;
break;
case "Primary Analysis Complete":
stage = 3;
break;
default:
stage = 4;
break;
}

return [stage,
date.getFullYear(),
date.getMonth().toString().length == 1 ? '0' + date.getMonth() : date.getMonth(),
date.getDay().toString().length == 1 ? '0' + date.getDay() : date.getDay()].join('');
}},
{name: 'start_year'},
{name: 'product_to_sort_on'},
{name: 'products', convert : Connector.model.Filter.asArray},
{name: 'product_classes', convert : Connector.model.Filter.asArray},
{name: 'product_names', convert : Connector.model.Filter.asArray},
{name: 'assays', convert : Connector.model.Filter.asArray},
{name: 'groups_treatment_schema', defaultValue: undefined},
{name: 'methods_assay_schema', defaultValue: undefined},
{name: 'assays_added_count'},
{name: 'ni_assays_added_count'},
{name: 'assays_added', convert : Connector.model.Filter.asArray},
{name: 'ni_assays_added', convert : Connector.model.Filter.asArray},
{name: 'atlas_link'},
{name: 'cavd_link'},

{name: 'protocol_docs_and_study_plans', convert : Connector.model.Filter.asArray},
{name: 'protocol_docs_and_study_plans_has_permission'},
{name: 'data_listings_and_reports', convert : Connector.model.Filter.asArray},
{name: 'data_listings_and_reports_has_permission'},
{name: 'non_integrated_assay_data', convert : Connector.model.Filter.asArray},
{name: 'non_integrated_assay_data_has_permission'},
{name: 'publications', convert : Connector.model.Filter.asArray},
{name: 'pub_available_data_count'},
{name: 'relationships', convert : Connector.model.Filter.asArray},
{name: 'clintrials_id'},
{name: 'specimen_repository_label'},
{name: 'monoclonal_antibodies', convert : Connector.model.Filter.asArray},
{name: 'interactive_reports', convert : Connector.model.Filter.asArray},
{name: 'curated_groups', convert : Connector.model.Filter.asArray},
{name: 'data_types_available', convert : Connector.model.Filter.asArray},
{name: 'data_available'}
]
});
Loading

0 comments on commit 64f3f3e

Please sign in to comment.