Skip to content
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

feat(website): Add new form to submit individual sequences #3710

Open
wants to merge 65 commits into
base: main
Choose a base branch
from

Conversation

fhennig
Copy link
Contributor

@fhennig fhennig commented Feb 18, 2025

resolves #3226
resolves #3722

preview URL: https://submission-via-form.loculus.org/dummy-organism/submission/2/submit?inputMode=form

updated docs page: https://docs-submission-via-form.loculus.org/for-users/submit-sequences/

Summary

  • Adds a new inputMode URL param to the submit endpoint with values form and bulk. If it is omitted, we default back to the 'bulk' variant.
  • There is a tab-style selector for bulk vs form submission (see screenshot below)
  • Fixed a mini hydration bug where a td was nested in a div
  • Drop mention of specific data use terms from Acknowledgement section ('Revise' page incorrectly states open data use terms. #3722)
  • Small improvement also for the edit form: internally generated TSV file now uses a library with escaping etc instead of pure string interpolation.

Tests

  • Add new tests for SubmissionRouteUtils
  • Added new tests for the input form (FormOrUploadWrapper.spec.tsx). Test that errors are raised when files or form input is missing. Test that all of the form that gets included in the TSV and also that escaping works.
  • Expanded SubmissionForm tests - submit not only via files, but also via form for some cases.
  • New integration test that submits a sequence via the form

Implementation notes

  • The Edit form as well as the file upload section of the submission form have been extracted into dedicated components
  • A new FormOrUploadWrapper wraps both and makes it easy to switch between them, returning just files which can then be used for uploading
  • Submission form allows manually entering a Submission ID - this is implemented by allowing all noEdit fields to be in fact edited on initial submission - AFAICT this was only used for submission ID and accession (only the submission ID is shown in the 'submit' form).

Screenshot

image

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by an appropriate test.

@fhennig fhennig added the preview Triggers a deployment to argocd label Feb 18, 2025
@fhennig fhennig self-assigned this Feb 18, 2025
@fhennig fhennig marked this pull request as draft February 18, 2025 10:36
@fhennig fhennig force-pushed the submission-via-form branch 2 times, most recently from 6e00612 to 5dd4bf5 Compare February 20, 2025 09:48
@fhennig fhennig force-pushed the submission-via-form branch from 1a4178f to f52fc56 Compare February 21, 2025 13:00
@rneher
Copy link

rneher commented Feb 23, 2025

just quickly tested this. I think that it is a bit surprising to land on the submission form for a single sequence by default. I would keep the default as the file upload and suggest that prominent button something with something like "Single sequence submission via form" takes you to the form.

@rneher
Copy link

rneher commented Feb 23, 2025

also. looks like the fields don't accept long enough entries
image

Probably better as a wrapping text field.

@theosanderson
Copy link
Member

also. looks like the fields don't accept long enough entries

I couldn't reproduce this - my theory is it must have been about some field rather than the sequences

Probably better as a wrapping text field.

These text fields for sequences are definitely really problematic. I mostly of think they should in the more final version be file upload components (for the one segment). Copying and pasting sequences feels generally bad practice?

@theosanderson
Copy link
Member

I made some UX suggestions at https://subform2.loculus.org/cchf/submission/1/submit (username: superuser, pw: superuser) for some future version of this (some after this PR), which I've also mentioned on Slack.

@rneher
Copy link

rneher commented Feb 24, 2025

also. looks like the fields don't accept long enough entries

I couldn't reproduce this - my theory is it must have been about some field rather than the sequences

Definitely reproducible for me in CCHF

@rneher
Copy link

rneher commented Feb 24, 2025

Might have been because my sequences included a fasta header. Seems to work without fasta header.

@fhennig fhennig force-pushed the submission-via-form branch from 74a7377 to 5b00d6a Compare February 24, 2025 10:20
@fhennig
Copy link
Contributor Author

fhennig commented Feb 24, 2025

Thanks for your input! I quite like your suggestions Theo, I think I'd maybe just merge them in?

For the sequence fields, maybe we can look into doing already client-side validation, so the users can't submit incorrect characters - or at least, showhow show a better error message.

@theosanderson
Copy link
Member

theosanderson commented Feb 24, 2025

Might have been because my sequences included a fasta header. Seems to work without fasta header.

OK yeah so I think what's happening here is that the whole sequence is being interpreted as the FASTA header

My own preferred way forward on this (and related issues) would be to create a new high priority issue to change all these sequence input text-boxes to upload-a-fasta-file-with-a-single-sequence components.

@fhennig
Copy link
Contributor Author

fhennig commented Feb 24, 2025

Since this PR is already quite large, I have made an issue for follow up changes to the form itself: #3740

I want to keep this PR to just the initial creation of the single-sequence submission feature, and the refactoring of the internal components.

IMO it'll be easier to review that way.

@fhennig fhennig force-pushed the submission-via-form branch 2 times, most recently from 1a26723 to 7d81b49 Compare February 25, 2025 10:04
@fhennig fhennig marked this pull request as ready for review February 25, 2025 10:05

1. Log into your account, and then click 'Submit' in the top-right corner of the website.
2. Select the organism that you'd like to submit sequences for.
3. Click on 'Submit single sequence'.
Copy link
Member

Choose a reason for hiding this comment

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

(we should update this)

@@ -6,10 +6,11 @@ import NeedToLogin from '../common/NeedToLogin.astro';

interface Props {
title: string;
disablePageTitle?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

nbd but I guess this may not be needed any more? But it's fine if you want to keep it anyway

* In 'form' mode, a form is displayed, and the user can directly enter stuff into the form to upload their
* metadata. In 'bulk' mode, the user needs to upload files containing the sequences and metadata.
* Either way, the component turns the uploaded data into files, so they can be submitted to the API.
* Set the 'fileCreatorSetter' to get the files - have a look at existing usage on how this works.
Copy link
Member

@theosanderson theosanderson Feb 25, 2025

Choose a reason for hiding this comment

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

Should this be setFileFactory ?

const [columnMapping, setColumnMapping] = useState<ColumnMapping | null>(null);

useEffect(() => {
setFileFactory(() => {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I really understand this (which isn't a huge problem). Could you explain a bit about why this works like this (in this thread, not in code necessarily)?

Copy link
Member

Choose a reason for hiding this comment

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

It would probably be nice to split some of these components into separate files

Copy link
Member

Choose a reason for hiding this comment

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

I asked a question below about why we've moved to the "factory" model but it may actuallly be easier discussed here.

Copy link
Member

@theosanderson theosanderson left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! Looks great

As we've discussed, the sequence input is very suboptimal (as it is on the edit page) but we want to tackle this as the next PR in this theme.

I'd like to understand why we have this slightly concept logic with a "factory" that's the main remaining thing that I'd like to get my head around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Triggers a deployment to argocd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Revise' page incorrectly states open data use terms. Submit individual sequences via a form
3 participants