feat!(website, backend): Update bulk file submission/revision format to use metadata file - #6922
feat!(website, backend): Update bulk file submission/revision format to use metadata file#6922tombch wants to merge 42 commits into
Conversation
…file category json if they exist, and centralised file validation after creation in aux table
…xisting tests working
…ly, with file paths for linking to metadata columns
…pplying of file maps to metadata tsv
…dividual submissions, and updated website tests
…culus into bulk-file-submissions
… different failed file linkages (missing from upload, metadata etc) and reflected the results of this in the UI for bulk submissions. removed submissionFileMapping linked/unlinked status as no longer needed
…ed/restructured FolderUploadComponent tests
| headers.push(sourceHeader); | ||
| indices.push(sourceIndex); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Another thing to note - the files category columns currently appear as unmapped in the column mapper - they should probably be recognised as input fields similar to fastaIds field
… adding, replacing and discarding files
|
Claude finished @tombch's task in 5m 41s —— View job Claude finished reviewingSummary This is a well-structured refactor that moves bulk file linkage from a separate JSON mapping into Backend parsing ( Two minor issues left as inline comments:
I also independently confirmed the concern raised in your own review comment on No security, performance, or documentation concerns beyond what's noted above. Didn't run the test suites myself (no Docker/gradle execution in this session) — the existing coverage looks thorough for the new logic. |
| validateSubmissionIdSetsForFiles(metadataSubmissionIds, fileSubmissionIds) | ||
| validateFileGroupOwnership(submittedFiles, submissionParams, uploadId) | ||
| submissionMetrics.timeWritePhase(endpoint, organism, VALIDATE_FILE_MAPPING_PHASE) { | ||
| // File mappings in submissionParams can contain submission Ids not present in the metadata |
There was a problem hiding this comment.
Ah do I understand correctly that the backend actually still supports the old submission format and will accept having the files in a fileMapping JSON?
Sounds like a good rollout strategy! It might be good to still have a follow up PR where the JSON is completely removed to ensure the removal will be smooth - I started doing that locally now and does seem like it will still be a bit of a change!
There was a problem hiding this comment.
Yeah, currently I haven't removed any of the separate file mapping stuff from the backend, but for single and bulk submission/revision the website now sends the file mapping within the metadata tsv. The submit-edited-data endpoint didn't have to change how it handled the file mapping as that one is completely JSON for everything
| } | ||
|
|
||
| // TODO: Update when moving away from UUIDs to more user-friendly file IDs | ||
| val fileId = try { |
There was a problem hiding this comment.
we discussed adding a specific length check for now to improve the error message in case part of the UUID is accidentally deleted
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
There was a problem hiding this comment.
but maybe it's quick enough it doesn't matter :)
| submissionMetrics.timeWritePhase(endpoint, organism, VALIDATE_FILE_MAPPING_PHASE) { | ||
| // File mappings in submissionParams can contain submission Ids not present in the metadata | ||
| // This is implicitly validated for the file mappings within the metadata column | ||
| // TODO: This can be removed once file mappings JSON support is removed |
There was a problem hiding this comment.
The backend tests actually all still rely on the fact that the fileMapping can be passed in submission and do not check that the files will also be parsed from the metadata. I guess this PR is for an intermittent state where both submission options work but might still make sense to update at least some of the tests - I ended up doing that in #7012 (when the fileMapping JSON is completely removed)
…opefully more readable with comments
|
@tombch and I discussed some blockers for merging this PR:
|
| const text = columnMapping | ||
| ? await (await columnMapping.applyTo(metadataFile)).text() | ||
| : await metadataFile.text(); | ||
| if (!controller.signal.aborted) { |
There was a problem hiding this comment.
its probably nicer to use if (controller.signal.aborted) return; to have less indented code
| const [columnMapping, setColumnMapping] = useState<ColumnMapping | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| const controller = new AbortController(); |
There was a problem hiding this comment.
Im not sure we actually need a controller I think just a boolean called cancelled would be enough (it needs to be set to true in the cleanup function)

resolves #6883 and #5820
PR description and docs still need updating with further details
Summary
Restructures how files are submitted in bulk submissions/revisions, as well as how file mappings are provided from the website to the backend for submissions/revisions - previously, bulk and form website submission/revisions attached a separate file mapping object. Now, file mappings for each submission are written to the metadata file by the website before sending for submission/revision.
New
files.<category>columns are introduced within the metadata, and uploaded files must be linked to within here - this can be done simply by adding a space separated list of: the file names (name1 name2 name3, if uploading a flat folder of files) or the file paths (name1::path1 name2::path2 name3::path3, if uploading a more complicated folder structure, to allow for different submissions to use the same file name within a bulk upload).Screenshot
fileName::filePathin metadata file:PR Checklist
🚀 Preview: https://bulk-file-submissions.loculus.org