SACGF / SACGF/variantgrid

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

Open
#1,615 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
3
Avg merge
9h 28m
Merged PRs (30d)
42

Description

🤖 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:
- https://app.rollbar.com/a/jimmy.andrews/fix/item/VariantGrid/7040
- https://app.rollbar.com/a/jimmy.andrews/fix/item/VariantGrid/7041

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.