Variant level CSV download - #706
Merged
bencap merged 4 commits intoAug 12, 2026
Merged
Conversation
bencap
marked this pull request as ready for review
August 10, 2026 19:27
bencap
force-pushed
the
feature/bencap/variant-level-csv-download
branch
from
August 10, 2026 19:29
51884a9 to
2c364df
Compare
- Extract `getErrorResponse` out of `api/mavedb/index.ts` and add `describeRequestError` alongside it in the new `src/lib/errors.ts`, replacing the ad hoc `extractErrorDetail` in ScoreSetCalibrationsView - Update all call sites to import from `@/lib/errors` instead of `@/api/mavedb` - Add unit tests covering both exported functions
Add use-csv-namespaces.ts and MvCsvColumnDialog.vue: a composable and dialog that fetch a score set's or variant's available CSV column namespaces from the new discovery endpoints and let a user pick which to include, replacing the score-set custom-download dialog's hand-picked checkbox list (scores/counts/mappedHgvs/etc.) that mapped to query params the API never actually read. Sections are grouped and labeled by the server (Measurements, Annotations, Clinical interpretation, Provenance) rather than hand-maintained client-side, and split by owning score set when a variant's calibrations span more than one. Defaults come from the API's selectedByDefault flag, so a research-use-only or rangeless calibration is offered but opts in explicitly. Wire it up in two places: - MvVariantPreview.vue's "Custom Data" dialog now uses it for score-set downloads instead of the old checkbox dialog - VariantScreen.vue gets a new "Download variant CSV" control backed by the variant-level CSV endpoint, split from the existing VA-Spec annotation downloads since they're a different kind of artifact (flat table vs. nested standard objects); use-variant-lookup.ts gains downloadVariantCsvFile and a shared downloadInProgressLabel Update openapi.d.ts for the new AvailableCsvNamespace / CsvNamespaceGroup schemas and endpoints, and switch score-sets.ts / variants.ts's CSV requests from drop_na_columns and include_post_mapped_hgvs to drop_unused_hgvs_columns and the namespace list, matching the API's new parameter names.
Fix streamAnnotationsInto (use-score-set-downloads.ts) accumulating NDJSON chunks as decoded strings: decoding to UTF-16, then joining, then building a Blob from the result meant a large pathogenicity-statement download held roughly five copies of the payload in memory at once and could run the tab out of it. Accumulate raw Uint8Array chunks instead and build the Blob directly from them, and count newline bytes rather than decoding to track progress. Also make a truncated stream (fewer lines than X-Total-Count) throw instead of silently saving a partial file, since the response has already started by the time that could be detected. Replace the per-feature annotatedDownloadInProgress/Progress state with a single fileDownloadLabel/fileDownloadProgress pair shared by every download this composable offers (scores, counts, mapped variants, custom data, and the VA-Spec streams), via a withIndicator() wrapper that also prevents two downloads running concurrently. Progress is indeterminate except for the VA-Spec streams, which can count records against X-Total-Count. Wire the shared indicator into ScoreSetDownloads.vue as one progress bar under the button row instead of one hung off the annotated-variants split button, disable every download button while any download is in flight, and add reportingFailure() so a rejected download surfaces a toast instead of an unhandled promise rejection in the console. Switch the custom-data dialog to MvCsvColumnDialog, matching MvVariantPreview and VariantScreen.
bencap
force-pushed
the
feature/bencap/variant-level-csv-download
branch
from
August 11, 2026 16:27
2c364df to
9277f0f
Compare
Also includes incidental reformatting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a variant-level CSV download and replaces the score-set custom-download dialog with a shared column picker driven by the API's namespace-discovery endpoints. Requires the API-side
GET /score-sets/{urn}/csv-namespaces,GET /variants/{urn}/csv-namespaces, andGET /variants/{urn}/csv. See VariantEffect/mavedb-api#804.CSV column picker
use-csv-namespaces.tscomposable andMvCsvColumnDialog.vuefetch a score set's or variant's available column namespaces and let the user choose which to include.selectedByDefaultflag, so a research-use-only or rangeless calibration is offered but must be opted into explicitly.MvVariantPreview.vue's "Custom Data" dialog,ScoreSetDownloads.vue, andVariantScreen.vue.Variant-level download
VariantScreen.vuegains a "Download variant CSV" control backed byGET /variants/{urn}/csv, kept separate from the existing VA-Spec annotation downloads.use-variant-lookup.tsgainsdownloadVariantCsvFileand a shareddownloadInProgressLabel.Annotation-stream memory fix
streamAnnotationsIntoaccumulated NDJSON chunks as decoded strings, then joined them, then built aBlobfrom the result — holding roughly five copies of the payload at once, enough to run the tab out of memory on a large pathogenicity-statement download. It now accumulates rawUint8Arraychunks, builds theBlobdirectly from them, and counts newline bytes for progress instead of decoding.X-Total-Countnow throws rather than silently saving a partial file.Shared download indicator
annotatedDownloadInProgress/Progressstate is replaced by a singlefileDownloadLabel/fileDownloadProgresspair covering every download the composable offers (scores, counts, mapped variants, custom data, VA-Spec streams), via awithIndicator()wrapper that also blocks concurrent downloads.ScoreSetDownloads.vuerenders one progress bar under the button row instead of one hung off the annotated-variants split button, and disables every download button while any download is in flight. Progress is indeterminate except for the VA-Spec streams, which count records againstX-Total-Count.reportingFailure()surfaces a rejected download as a toast instead of an unhandled promise rejection.Supporting changes
getErrorResponsemoves out ofapi/mavedb/index.tsinto a newsrc/lib/errors.ts, joined bydescribeRequestError, which replaces the ad hocextractErrorDetailinScoreSetCalibrationsView.vue. All call sites now import from@/lib/errors.score-sets.tsandvariants.tsswitch their CSV requests fromdrop_na_columnsandinclude_post_mapped_hgvstodrop_unused_hgvs_columnsplus the namespace list, matching the API's parameter names.openapi.d.tsregenerated for theAvailableCsvNamespaceandCsvNamespaceGroupschemas and the new endpoints.Tests
Unit tests added for
use-csv-namespaces,use-score-set-downloads, andlib/errors.