Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions study/src/org/labkey/study/controllers/StudyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ public static class OverviewForm extends DatasetFilterForm
{
private String _qcState;
private String[] _visitStatistic = new String[0];
private String _cohortFilterType;

public String getQCState()
{
Expand Down Expand Up @@ -686,6 +687,16 @@ private Set<VisitStatistic> getVisitStatistics()

return set;
}

public String getCohortFilterType()
{
return _cohortFilterType;
}

public void setCohortFilterType(String cohortFilterType)
{
_cohortFilterType = cohortFilterType;
}
}


Expand Down Expand Up @@ -715,6 +726,17 @@ public ModelAndView getView(OverviewForm form, BindException errors) throws Exce
bean.cohortFilter = CohortFilterFactory.getFromURL(getContainer(), getUser(), getViewContext().getActionURL(), DatasetQueryView.DATAREGION);

VisitManager visitManager = StudyManager.getInstance().getVisitManager(bean.study);

if (null != bean.cohortFilter)
{
if (!visitManager.supportedCohortFilterTypes().contains(bean.cohortFilter.getType()))
{
errors.rejectValue("cohortFilterType", ERROR_MSG, bean.cohortFilter.getType() + " is not supported.");
// CohortFilterFactory.getFromURL() returns NULL for unrecognized and continues, let's do the same
bean.cohortFilter = null;
}
}

bean.visitMapSummary = visitManager.getVisitSummary(getUser(), bean.cohortFilter, bean.qcStates, bean.stats, bean.showAll);

return new StudyJspView<>(_study, "/org/labkey/study/view/overview.jsp", bean, errors);
Expand Down
1 change: 1 addition & 0 deletions study/src/org/labkey/study/view/overview.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
out.print(unsafe("<label><input id=\"" + id + "\" name=\"visitStatistic\" value=\"" + h(stat.name()) + "\" type=\"checkbox\"" + checked(checked) + ">" + h(stat.getDisplayString(study)) + "</label>\n"));
}
%>
<labkey:errors></labkey:errors>
</labkey:form>
<br><br>
<table id="studyOverview" class="labkey-data-region-legacy labkey-show-borders" style="border-collapse:collapse;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public String getPluralLabel()
return "Timepoints";
}

@Override
public Set<CohortFilter.Type> supportedCohortFilterTypes()
{
return Set.of(CohortFilter.Type.PTID_CURRENT, CohortFilter.Type.PTID_INITIAL);
}

@Override
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public SequenceVisitManager(StudyImpl study)
super(study);
}

@Override
public Set<CohortFilter.Type> supportedCohortFilterTypes()
{
return Set.of(CohortFilter.Type.PTID_CURRENT, CohortFilter.Type.PTID_INITIAL, CohortFilter.Type.DATA_COLLECTION);
}

@Override
@Nullable
protected SQLFragment getVisitSummarySql(StudyQuerySchema sqs, CohortFilter cohortFilter, QCStateSet qcStates, Set<VisitStatistic> stats, boolean showAll)
Expand Down
2 changes: 2 additions & 0 deletions study/src/org/labkey/study/visitmanager/VisitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ protected void updateParticipantVisitTableAfterInsert(@Nullable User user, @Null
*/
protected abstract @NotNull ValidationException updateVisitTable(User user, @Nullable Logger logger, boolean failForUndefinedVisits);

public abstract Set<CohortFilter.Type> supportedCohortFilterTypes();

// Produce appropriate SQL for getVisitSummary(). The SQL must select dataset ID, sequence number, and then the specified statistics;
// it also needs to filter by cohort and qcstates.
@Nullable
Expand Down