Skip to content

refactor(score-sets): extract CSV export logic into score_set_csv module - #801

Open
bencap wants to merge 1 commit into
release-2026.2.8from
chore/bencap/csv-generation-refactor
Open

refactor(score-sets): extract CSV export logic into score_set_csv module#801
bencap wants to merge 1 commit into
release-2026.2.8from
chore/bencap/csv-generation-refactor

Conversation

@bencap

@bencap bencap commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Move all CSV-generation code for score set variant downloads out of score_sets.py into a new dedicated mavedb/lib/score_set_csv.py module, splitting it into pure functions (column planning, header assembly, row formatting) and DB-bound fetching to keep the logic testable in isolation.

  • Add parse_clinvar_namespace() to clinvar/utils.py, replacing the inline regex parsing that lived in score_sets.py
  • Add is_csv_output_null() to mave/utils.py to centralize null-value detection used when formatting CSV output
  • Move variant_to_csv_row, variants_to_csv_rows, get_score_set_variants_as_csv, and drop_na_columns_from_csv_file_rows into score_set_csv.py, and update routers/score_sets.py and scripts/export_public_data.py to import from the new location
  • Move corresponding tests into tests/lib/test_score_set_csv.py and add new unit tests for parse_clinvar_namespace and is_csv_output_null

Move all CSV-generation code for score set variant downloads out of
score_sets.py into a new dedicated mavedb/lib/score_set_csv.py module,
splitting it into pure functions (column planning, header assembly,
row formatting) and DB-bound fetching to keep the logic testable in
isolation.

- Add parse_clinvar_namespace() to clinvar/utils.py, replacing the
  inline regex parsing that lived in score_sets.py
- Add is_csv_output_null() to mave/utils.py to centralize null-value
  detection used when formatting CSV output
- Move variant_to_csv_row, variants_to_csv_rows,
  get_score_set_variants_as_csv, and drop_na_columns_from_csv_file_rows
  into score_set_csv.py, and update routers/score_sets.py and
  scripts/export_public_data.py to import from the new location
- Move corresponding tests into tests/lib/test_score_set_csv.py and add
  new unit tests for parse_clinvar_namespace and is_csv_output_null
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 30939617491

Warning

No base build found for commit 95a2917 on release-2026.2.8.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 89.032%

Details

  • Patch coverage: 5 uncovered changes across 1 file (235 of 240 lines covered, 97.92%).

Uncovered Changes

File Changed Covered %
src/mavedb/lib/score_set_csv.py 220 215 97.73%
Total (6 files) 240 235 97.92%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 14351
Covered Lines: 12777
Line Coverage: 89.03%
Coverage Strength: 0.89 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: extract score set CSV generation into a dedicated, tested module

2 participants