Skip to content

feat!(backend, website): add a new backend endpoint to get organism for an accession#6255

Open
anna-parker wants to merge 14 commits intomainfrom
get-sequenceentries-backend
Open

feat!(backend, website): add a new backend endpoint to get organism for an accession#6255
anna-parker wants to merge 14 commits intomainfrom
get-sequenceentries-backend

Conversation

@anna-parker
Copy link
Copy Markdown
Contributor

@anna-parker anna-parker commented Apr 10, 2026

resolves #6265

Generated with claude CLI

Backend: New endpoint GET /get-details

Given a list of accession and/or accessionVersions return details such as isRevocation and organism. This allows us to e.g. know which organism an accession belongs to without querying every LAPIS instance. Currently LAPIS is configured on an organism level and cannot perform such queries, if LAPIS becomes able to do this we can always remove this endpoint.

New files:

  • SearchController.kt — top-level controller (no organism prefix) with the new endpoint

Modified files:

  • SubmissionTypes.kt — added AccessionVersionWithOrganism data class (accession, version, organism, isRevocation,
    submittedAt as unix timestamp)
  • SubmissionDatabaseService.kt — added streamSequenceEntryVersionsForAccessions() that queries sequence_entries_view
    for released entries matching the given accessions/accession-versions
  • SequenceEntriesView.kt — added accessionIsOneOf() helper method

Endpoint behavior:

  • ?accessionsOrAccessionVersions=LOC_000S01D → returns all released versions of that accession
  • ?accessionsOrAccessionVersions=LOC_000S01D.1 → returns that specific released version
  • Only returns APPROVED_FOR_RELEASE entries (no auth required)
  • Returns NDJSON, sorted by accession then version
    ### Website: Use backend instead of all-LAPIS queries

findOrganismAndData.ts (details page): Instead of querying all LAPIS instances in parallel, now calls backend once to
get organism, then calls only the correct LAPIS instance. The "no version" redirect case is handled directly from the
backend result (finds max version).

getVersionsData.ts (versions page): Instead of querying all LAPIS instances, calls backend once to get organism, then
queries only that organism's LAPIS for version history.

SeqSetRecordsTableWithMetadata.tsx (seqsets): Instead of querying all LAPIS instances in parallel for each record,
calls backend once to get organism for all accessions, then queries only the relevant LAPIS instances (one per
distinct organism in the seqset).

backendClient.ts — added getSequenceEntryVersions() method that parses the NDJSON response.

backend.ts — added accessionVersionWithOrganism Zod schema and AccessionVersionWithOrganism type.

Screenshot

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)

🚀 Preview: https://get-sequenceentries-backe.loculus.org

@anna-parker anna-parker changed the title feat!(backend, website): add a new backend endpoint that returns deta… feat!(backend, website): add a new backend endpoint get-sequence-entry-versions Apr 10, 2026
@anna-parker anna-parker added the preview Triggers a deployment to argocd label Apr 10, 2026
@anna-parker anna-parker marked this pull request as ready for review April 10, 2026 15:21
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 10, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@anna-parker anna-parker changed the title feat!(backend, website): add a new backend endpoint get-sequence-entry-versions feat!(backend, website): add a new backend endpoint to get organism for an accession Apr 11, 2026
)
}

fun streamDetailsForAccessions(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wonder if I should actually move this to a new file called SearchService.kt?

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.

Accession search and details pages must call each LAPIS instance to figure out which organism an accession belongs to

1 participant