Skip to content

Classification export: accept the 'a' allele shortcut in allele= param (e.g. a9678) and validate #1615

Description

@davmlaw

🤖 Written by Claude

The classification export API accepts a debug allele= query param which is parsed with a bare int(allele_str) in ClassificationFilter.from_request (classification/views/exports/classification_export_filter.py:476). A non-numeric value raises ValueError and 500s the export endpoint.

Crucially, a is the allele shortcut used in search (e.g. searching a9678 resolves allele 9678), so users naturally pass allele=a9678. Rather than just rejecting it, the export form should accept that shortcut:

  • strip a leading a (so a9678 and 9678 both resolve to allele 9678), consistent with search;
  • validate the remainder is an integer;
  • return a clean 400 for genuinely invalid input instead of a 500.

Seen on shariant / sharianttest:

Split out of #1601 (which now covers only the genome-build and grouping-id 404 cases).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions