Skip to content

Fixed issues with DNA file uploads#48

Merged
vishakh merged 3 commits into
mainfrom
bugfix/fix_upload_issues
Jun 22, 2026
Merged

Fixed issues with DNA file uploads#48
vishakh merged 3 commits into
mainfrom
bugfix/fix_upload_issues

Conversation

@vishakh

@vishakh vishakh commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Parser (lib/genotype-parser.ts)

Rewrote the genotype file parser to fix a 57% upload failure rate identified via GA4 analytics. The failures broke down into two root causes: format detection routing files to the wrong parser, and individual parsers rejecting valid rows from edge-case provider exports.

Format coverage added or fixed:

  • MyHeritage CSV — malformed double-quote escaping ("rs1"",""1"",...) now handled by stripping all " characters from field values
  • FTDNA famfinder — column header lives in a # comment line and uses name instead of rsid; both are now recognized
  • LivingDNA allele format — 5-column layout (rsid chr pos allele1 allele2) now combined into a 2-char genotype
  • AncestryDNA chromosome 26 — mitochondrial chromosome normalized to MT
  • AncestryDNA multi-separator — extra tabs creating empty fields now filtered before column indexing
  • Generic 4-column TSV/CSVRSID CHROMOSOME POSITION GENOTYPE headers with tab/comma delimiters now routed to the Monadic parser; purely space-separated headers fall through to the 23andMe whitespace parser to avoid a delimiter mismatch
  • CRLF line endingssplit('\n') replaced with split(/\r?\n/) across all parsers

Detection logic hardened: AncestryDNA detection now skips # lines (avoids false-matching 23andMe comment headers); detection scans 50 lines instead of 20 to handle files with long metadata preambles.

Upload UX (app/components/UserDataUpload.tsx, app/globals.css)

  • Error display now shows the actual failure reason instead of the generic "Upload failed" tooltip
  • Added a provider hint below the upload button ("23andMe, AncestryDNA, MyHeritage, FTDNA, LivingDNA, and more")
  • Removed redundant pre-validation in the click handler that silently swallowed errors without setting error state
  • console.error now emits structured diagnostics on parse and upload failures

Analytics (lib/analytics.ts)

  • genotype_file_loaded now includes detected_format (23andme / ancestrydna / monadic) and file_extension
  • genotype_file_upload_failed now includes file_extension
  • File extension derived via lastIndexOf('.') so extensionless filenames do not leak as the extension value in analytics events

@vishakh vishakh self-assigned this Jun 22, 2026
@vishakh vishakh added the bug Something isn't working label Jun 22, 2026
@vishakh vishakh merged commit 55d5018 into main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant