-
Notifications
You must be signed in to change notification settings - Fork 4
Signal data improvements #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
| paths : paths, | ||
| files : fileNames | ||
| }, | ||
| success: function (response) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be transacted?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
If it isn't referenced, then I'd say remove it. Could be worth tracking down in version control where it went defunct. |
There was a problem hiding this 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)); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
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.
| 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)); |
| } | ||
| } | ||
| else | ||
| throw new RuntimeException(String.format("Unexpected number of rows returned for DataFileUrl '%s': %d", url, rows.size())); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
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.
| 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)); |
| //TODO: Should probably do something here... | ||
| } | ||
| failure: LABKEY.Utils.getCallbackWrapper(function(json, response, opts) { | ||
| LABKEY.Utils.alert('Error', 'Unable to save run : ' + response.exception); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
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').
| LABKEY.Utils.alert('Error', 'Unable to save run : ' + response.exception); | |
| LABKEY.Utils.alert('Error', 'Unable to save run : ' + (response.exception || 'Unknown error')); |
| } | ||
| , scope: this | ||
| failure: LABKEY.Utils.getCallbackWrapper(function(json, response, opts) { | ||
| LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + response.exception); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
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').
| LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + response.exception); | |
| LABKEY.Utils.alert('Error', 'Unable to resolve file resources : ' + (response.exception || 'Unknown error')); |
Rationale
Address a few problems / inefficiencies with the signal data module that were discovered during client troubleshooting sessions:
Experiment.saveBatch.apirequest.ExpDataobjects on the server was performed for each row in the run results. Refactor thegetSignalDataResourceAction.apiaction to handle all files in the run.