ClinVar export: a rejected batch leaves its exports 'Up to Date' and out of later batches

Open
#2,626 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
databases

Research direction

Start with classification/models/clinvar_export_models.py and trace ClinVarExportBatch.reject(), add_record, and create_batches; then read clinvar_export_sync.py at _handle_request_response and _handle_response_file. The proposal leaves the submission display behavior and automatic re-queue policy unresolved, so first establish those decisions with maintainers. Done means rejected batches update submission and export statuses consistently and eligible exports behave as agreed in a later batch; verify with the Shariant test-mode cases described in the issue.

Written by the indexing model from the issue text.

Description

🤖 Written by Claude

Problem

When a ClinVarExportBatch is rejected, its exports are left reporting Up to Date even though nothing reached ClinVar, and nothing puts them back in the queue.

ClinVarExportBatches.add_record (classification/models/clinvar_export_models.py) sets each ClinVarExport to UP_TO_DATE as soon as it is put in a batch. Only the admin "Reject" action (ClinVarExportBatch.reject) re-evaluates the exports afterwards, via export.update(). The two ways the sync rejects a batch don't:

  • clinvar_export_sync.py _handle_request_response: ClinVar returns an error the code treats as our data issue (ClinVarRequestExceptionType.OUR_DATA_ISSUE). The batch becomes REJECTED, but its submissions stay WAITING and its exports stay UP_TO_DATE with no error showing.
  • _handle_response_file: a response file with totalSuccess == 0. The batch becomes REJECTED. Each submission is marked ERROR, so the grid shows "ClinVar Error", but the export is still UP_TO_DATE.

ClinVarExportBatch.create_batches only picks up NEW_SUBMISSION / CHANGES_PENDING exports, so these records stay out of every later batch. That lasts until their classification changes, someone runs a force-update prepare, or someone regenerates the batch (only possible for the latest batch of a ClinVar key). The integration status panel does show the rejected batch.

Related display problems:

  • ClinVarExportSubmissionStatus has no REJECTED value, so the TODO in reject() (submissions.update('status', ClinVarExportSubmissionStatus.REJECTED)) can't be written as it stands. A rejected batch's submissions show "Waiting" forever.
  • ClinVarExport.last_submission (behind "Last Submission Status", "Last Submission Error" and the "Latest Batch" export columns) includes rejected batches. ClinVarExport.previous_submission, which the converter diffs against, excludes them. After a reject, the export page shows the rejected submission's status, and the "Previous ClinVarSubmission (pk)" label next to the diff names a different submission from the one compared.
  • The "Latest Batch Status" export column (clinvar_export_view.py _batch_status) is missing a return, so it is always blank. This one is fixed directly on master, not here.

Proposal

  1. Add ClinVarExportSubmissionStatus.REJECTED (a migration, since it adds a choice).
  2. Do rejection in one place, the model method ClinVarExportBatch.reject(), and have both sync paths call it: mark the batch REJECTED, mark its still-WAITING submissions REJECTED (keep ERROR where ClinVar said so per record), then update() each export. An export whose last non-rejected submission differs from the current data then goes back to CHANGES_PENDING / NEW_SUBMISSION, ready for the next batch.
  3. Decide what "last submission" means on the page: exclude rejected batches as previous_submission does, or keep showing the rejected one but label it as rejected.

Open question: after an OUR_DATA_ISSUE rejection, should the records re-queue automatically (they would be rejected again until the data is fixed) or wait for a person? Re-queuing loops if nothing changes, so CHANGES_PENDING with the batch error shown might need a guard.

Testing

Shariant: reject a batch from admin and via a ClinVar test-mode error response. Check the exports' status and "Last Submission Status", and that a new batch picks them up as decided above.
VariantGrid: same, on a deployment with a ClinVar key configured.

Dominant language
Python
Stars
31
Forks
4
Avg merge
4h 52m
Merged PRs (30d)
183

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SACGF/variantgrid

All issues in SACGF/variantgrid

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.