Allow studies to prevent new timepoint creation on data import.#5075
Allow studies to prevent new timepoint creation on data import.#5075labkey-klum merged 16 commits intodevelopfrom
Conversation
…eation of new timepoints if the study is configured as such
…set imports, to the newer universal one
|
WARNING: This PR appears to have the default title generated by GitHub. Please use something more descriptive. |
| isFailForUndefinedVisits: <%=bean.isFailForUndefinedVisits()%>, | ||
| isCloudRoot: <%=bean.isCloudRoot()%>, // Remove as part of Issue #43835 | ||
| showFailForUndefinedVisits: <%=timepointType == null || timepointType == TimepointType.VISIT%> | ||
| showFailForUndefinedVisits: <%=(timepointType == null || timepointType == TimepointType.VISIT) && ((study == null) || !study.isFailForUndefinedTimepoints())%> |
There was a problem hiding this comment.
This hides the legacy advanced folder import UI to fail for undefined visits if this is already configured at the study level.
| Study study = StudyService.get().getStudy(getContainer()); | ||
| if (loadInfo.getRowCount() > 0 && failForUndefinedVisits && study.getTimepointType() == TimepointType.VISIT) | ||
| checkForUndefinedVisits(loadInfo, study); | ||
|
|
There was a problem hiding this comment.
This is the legacy folder import check, the new check is below in resyncStudy
| { | ||
| result = StudyManager.getInstance().ensureVisit(this, null, sequenceNumBD, null, false); | ||
| result = StudyManager.getInstance().getVisit(this, null, sequenceNumBD, null); | ||
| } |
There was a problem hiding this comment.
Change this to getVisit; the last parameter was saveIfNew and this was the only usage of that method. Got rid of the old method.
| { | ||
| List<Double> undefinedSequenceNums = StudyManager.getInstance().getUndefinedSequenceNumsForDataset(_datasetDefinition.getContainer(), _datasetDefinition.getDatasetId()); | ||
| if (!undefinedSequenceNums.isEmpty()) | ||
| // check for undefined visits and don't commit the data if there are errors |
There was a problem hiding this comment.
Swap out the legacy check for the newer check.
| <labkey:input type="radio" name="timepointType" id="continuousTimepointType" value="<%=TimepointType.CONTINUOUS%>" checked="<%=(form.getTimepointType() == TimepointType.CONTINUOUS)%>" onChange="document.getElementById('defaultDurationRow').style.display = document.getElementById('dateTimepointType').checked ? 'table-row' : 'none'; document.getElementById('defaultDateRow').style.display = document.getElementById('continuousTimepointType').checked ? 'none' : 'table-row';" /> Continuous | ||
| <labkey:input type="radio" formGroup="false" name="timepointType" id="dateTimepointType" value="<%=TimepointType.DATE%>" checked="<%=(form.getTimepointType() == TimepointType.DATE)%>" onChange="document.getElementById('defaultDurationRow').style.display = document.getElementById('dateTimepointType').checked ? 'table-row' : 'none'; document.getElementById('defaultDateRow').style.display = document.getElementById('continuousTimepointType').checked ? 'none' : 'table-row';" /> Dates | ||
| <labkey:input type="radio" formGroup="false" name="timepointType" value="<%=TimepointType.VISIT%>" checked="<%=(form.getTimepointType() == TimepointType.VISIT || form.getTimepointType() == null)%>" onChange="document.getElementById('defaultDurationRow').style.display = document.getElementById('dateTimepointType').checked ? 'table-row' : 'none'; document.getElementById('defaultDateRow').style.display = document.getElementById('continuousTimepointType').checked ? 'none' : 'table-row';" /> Assigned Visits | ||
| <labkey:input type="radio" formGroup="false" name="timepointType" id="continuousTimepointType" value="<%=TimepointType.CONTINUOUS%>" checked="<%=(form.getTimepointType() == TimepointType.CONTINUOUS)%>" onChange="document.getElementById('defaultDurationRow').style.display = document.getElementById('dateTimepointType').checked ? 'table-row' : 'none'; document.getElementById('defaultDateRow').style.display = document.getElementById('continuousTimepointType').checked ? 'none' : 'table-row';" /> Continuous |
There was a problem hiding this comment.
Unrelated to this ticket but the create study page layout was off.
There was a problem hiding this comment.
FYI: I fixed this in a PR earlier today 😄 https://github.com/LabKey/platform/pull/5071/files#diff-d865ecd1f5c16055018efd9c61efa77f323780055e97efe390e52411199d6c33
There was a problem hiding this comment.
Great, I'll merge develop into my branch to pick up your change.
| * @param potentiallyDeletedParticipants optionally, the specific participants that may have been removed from the | ||
| * study. If null, all participants will be checked to see if they are still in the study. | ||
| * @param participantVisitResyncRequired If true, will force an update of the ParticipantVisit mapping for this study | ||
| * @param forceUpdateCohorts If true, forces updateParticipantCohorts() (specimen import case) |
There was a problem hiding this comment.
forceUpdateCohorts was never used.
| clickAndWait(Locator.linkWithText(CALC_COL_QUERY_SNAPSHOT)); | ||
| waitForSnapshotUpdate("-2"); | ||
| waitForSnapshotUpdate("999151515"); | ||
|
|
There was a problem hiding this comment.
Test was failing because the QuerySnapshot was being deleted before the snapshot had a chance to update itself.
| if (target.getDefaultTimepointDuration() < 1) | ||
| errors.reject(ERROR_MSG, "Default timepoint duration must be a positive number."); | ||
| StudyImpl study = getStudy(); | ||
| if (study.getTimepointType() == TimepointType.DATE) |
There was a problem hiding this comment.
curious why we are checking the timepoint type for the study and the target props form object (one here and one a few lines below). would they really ever differ?
There was a problem hiding this comment.
Good question, both JSP's (manageVisits.jsp, manageTimepoints.jsp) now use the same controller endpoint. I had to make it a little more fault tolerant of the values getting posted. Perhaps I should make it clearer to the endpoint what type of information is being posted.
|
|
||
| // after the data has been imported, configure the new study setting for undefined timepoints | ||
| if (sourceStudy.isFailForUndefinedTimepoints()) | ||
| mutableStudy.setFailForUndefinedTimepoints(true); |
There was a problem hiding this comment.
good call on needing to apply this after the visit map is created for the new study (as mentioned in the PR message).
Rationale
tracking issue
Studies will automatically create new timepoints when data (dataset or specimen) is introduced into the study. In limited situations clients may not want this to happen. Years ago we added a folder import check for visit based studies only to fail if the data would introduce any new visits.
This PR takes it a step farther by introducing a study wide setting to disallow the creation of new timepoints for all of the pathways that data can flow into a study:
The new configuration UI is under the manage visit/timepoint link off of the manage study page.
Changes
StudyManager.ensureVisitsprovides a single choke point to allow/disallow the timepoint creation, but provided no way to report back errors. The method now accepts a parameter to fail for undefined timepoints and will return aValidationExceptionto indicate any errors. There were many code paths into this method that needed to thread through the parameter as well as consume the return value where appropriate.