-
Notifications
You must be signed in to change notification settings - Fork 9
update processed data endpoint #5460
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
6a0e6ad to
a5922bd
Compare
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const existingDataRows = Object.entries(initialData.originalData.unalignedNucleotideSequences).map( | ||
| ([key, value]) => ({ | ||
| // TODO: older entries will still have the segmentName and not the fastaHeader as a key | ||
| label: key, // TODO: In future prepro will map the fastaHeader to the segment (will be added to the label) | ||
| fastaHeader: maxNumberRows > 1 ? key : initialData.submissionId, | ||
| value: value, | ||
| initialValue: value, | ||
| key: EditableSequences.getNextKey(), | ||
| }), | ||
| ([key, value]) => { | ||
| const mapped = fastaHeaderMap[key].join(', ') || ''; | ||
| const label = !mapped | ||
| ? `${key} (could not be classified)` |
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.
Guard missing segment mapping before accessing
.join
fromInitialData in EditableSequences inverts sequenceNameToFastaHeaderMap and then calls fastaHeaderMap[key].join(', '). For fasta headers that were not mapped, fastaHeaderMap[key] is undefined, so the .join call throws a TypeError and prevents the sequences form from rendering right when the code intends to show “could not be classified”. Default to an empty array before joining (e.g. (fastaHeaderMap[key] ?? []).join(', ')).
Useful? React with 👍 / 👎.
resolves #
to be merged into #5402 when it works
Screenshot
As prepro now assigns the segments the website does not know which entry in the original data corresponds to which segment - this updates prepro to also return a map with this information.
PR Checklist
🚀 Preview: https://improve-endpoints.loculus.org