Skip to content

Conversation

@labkey-klum
Copy link
Contributor

Rationale

Address a few problems / inefficiencies with the signal data module that were discovered during client troubleshooting sessions:

  • No feedback given to the user during assay run creation if an error was reported by the server during the Experiment.saveBatch.api request.
  • Validation of the run data files and creation of the ExpData objects on the server was performed for each row in the run results. Refactor the getSignalDataResourceAction.api action to handle all files in the run.
  • Miscellaneous clean up.

@labkey-klum
Copy link
Contributor Author

resultupdate.js contains code that basically implements the update view for a result row. There is no UI connection to this view and I'm wondering @labkey-nicka if you had any insight to it's history and whether it might be something we can delete?

paths : paths,
files : fileNames
},
success: function (response) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Consider using LABKEY.Utils.getCallbackWrapper() instead so this code isn't responsible for decoding the response. Same for changes in resultupdate.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, done.

int idx = 0;

if (null != resource)
for (String path : form.getPaths())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be transacted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, agreed

FileContentService svc = FileContentService.get();
TableInfo ti = ExpSchema.TableType.Data.createTable(new ExpSchema(getUser(), c), ExpSchema.TableType.Data.toString(), null);
QueryUpdateService qus = ti.getUpdateService();
int maxUrlSize = ExperimentService.get().getTinfoData().getColumn("DataFileURL").getScale();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ExpDataTable.Column.DataFileUrl.name() here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

List<Map<String, String>> results = new ArrayList<>();
Container c = getContainer();
FileContentService svc = FileContentService.get();
TableInfo ti = ExpSchema.TableType.Data.createTable(new ExpSchema(getUser(), c), ExpSchema.TableType.Data.toString(), null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just use the ExperimentService.get().getTinfoData() here instead? And get the update service from it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's the DbSchema table not the QuerySchema table, but ExpSchema(getUser(), getContainer()).getDatasTable() is more concise.

@labkey-nicka
Copy link
Contributor

resultupdate.js contains code that basically implements the update view for a result row. There is no UI connection to this view and I'm wondering @labkey-nicka if you had any insight to it's history and whether it might be something we can delete?

If it isn't referenced, then I'd say remove it. Could be worth tracking down in version control where it went defunct.

@labkey-klum labkey-klum requested a review from Copilot September 17, 2025 22:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses inefficiencies in the signal data module by refactoring the API to handle multiple files in a single request, adding error handling for run creation failures, and performing miscellaneous cleanup.

  • Refactored API to process all files in a run at once instead of per-row processing
  • Added error feedback to users when run creation fails
  • Cleaned up imports and improved error handling throughout

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
SignalDataController.java Refactored API to handle multiple files in one request, updated form structure and validation
uploadResultFiles.js Added error handling for failed run save operations
UploadLog.js Updated to use batch file processing and improved error handling
resultupdate.js Modified to use new batch API format
mockSignalDataWatch.html Updated to work with new batch API response format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
else
{
throw new ValidationException(String.format("The data file URL is too long to store in the database (max %d).", maxUrlSize));
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message should provide more context about what failed. Consider including the actual file name or path that caused the issue to help users identify which specific file has the problem.

Suggested change
throw new ValidationException(String.format("The data file URL is too long to store in the database (max %d).", maxUrlSize));
throw new ValidationException(String.format("The data file URL for file '%s' (path: '%s') is too long to store in the database (max %d).", file.getName(), path, maxUrlSize));

Copilot uses AI. Check for mistakes.
}
}
else
throw new RuntimeException(String.format("Unexpected number of rows returned for DataFileUrl '%s': %d", url, rows.size()));
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message could be more helpful by explaining what the expected number of rows should be (which appears to be 1 based on the context). Consider changing to 'Expected 1 row but got %d rows for DataFileUrl...' to make the issue clearer.

Suggested change
throw new RuntimeException(String.format("Unexpected number of rows returned for DataFileUrl '%s': %d", url, rows.size()));
throw new RuntimeException(String.format("Expected 1 row but got %d rows for DataFileUrl '%s'", rows.size(), url));

Copilot uses AI. Check for mistakes.
//TODO: Should probably do something here...
}
failure: LABKEY.Utils.getCallbackWrapper(function(json, response, opts) {
LABKEY.Utils.alert('Error', 'Unable to save run : ' + response.exception);
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message concatenation could result in 'Unable to save run : undefined' if response.exception is undefined. Consider using optional chaining or a fallback message like 'Unable to save run: ' + (response.exception || 'Unknown error').

Suggested change
LABKEY.Utils.alert('Error', 'Unable to save run : ' + response.exception);
LABKEY.Utils.alert('Error', 'Unable to save run : ' + (response.exception || 'Unknown error'));

Copilot uses AI. Check for mistakes.
}
, scope: this
failure: LABKEY.Utils.getCallbackWrapper(function(json, response, opts) {
LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + response.exception);
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous error message, this could display 'undefined' if response.exception is not set. Consider adding a fallback: 'Unable to resolve file resources: ' + (response.exception || 'Unknown error').

Suggested change
LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + response.exception);
LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + (response.exception || 'Unknown error'));

Copilot uses AI. Check for mistakes.
@labkey-klum labkey-klum merged commit 111622c into develop Sep 22, 2025
5 checks passed
@labkey-klum labkey-klum deleted the fb_issue_53786 branch September 22, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants