This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository contains the ClinVar Curation Chrome Extension (v3.4), a specialized tool for ClinGen curation workflow. The extension scrapes ClinVar UI HTML to create a form that allows curators to capture actions and reasons related to ClinVar submissions (SCVs) that may need re-assessment or removal to improve ClinVar data quality.
- scvc/manifest.json - Chrome Extension Manifest v3 configuration with OAuth2 Google Sheets integration
- scvc/background.js - Service worker handling authentication, Google Sheets API calls, and message passing
- scvc/content.js - Content script that extracts ClinVar data from NCBI pages using regex and XPath
- scvc/popup.js - Popup UI logic for annotation forms, validation, and user interactions
- scvc/popup.html - Extension popup interface (not tracked but referenced)
- Data Extraction: Content script scrapes ClinVar variation pages using XPath selectors and regex patterns
- UI Population: Extracted data populates the extension popup with SCV submission details
- Annotation Capture: Users select actions (Flagging Candidate, Remove Flagged Submission, No Change) and reasons
- Authentication: Background script handles Google OAuth2 authentication and user profile retrieval
- Data Persistence: Annotations are appended to secured Google Sheets via Sheets API v4
The extractClinVarData() function in content.js extracts:
- VCV accession and variation ID
- Variant name and germline classification
- Review status and evaluation dates
- SCV submission details (submitter, interpretation, dates, review status)
- Production Spreadsheet:
1dUnmBZSnz3aeB948b7pIq0iT7_FuCDvtv6FXaVsNcOo - Test Spreadsheet:
1HVQgZ_uGkzaazgIgz86h-5H-oEfHFFllwqT5jJbw6Do(used in popup.js) - Range: 'SCVs' sheet for appending curation data
- OAuth Scope:
https://www.googleapis.com/auth/spreadsheets
- Host Permissions:
https://www.ncbi.nlm.nih.gov/clinvar/variation/* - Content Script Matching: ClinVar variation pages only
- Required Permissions: activeTab, scripting, identity, storage, declarativeContent, tabs
This is a Chrome extension with no automated tests. Testing requires:
- Load extension in Chrome developer mode from the
scvc/directory - Navigate to a ClinVar variation page (e.g.,
https://www.ncbi.nlm.nih.gov/clinvar/variation/12345/) - Click the extension icon to test data extraction and UI functionality
- Verify Google Sheets integration with proper OAuth authentication
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked" and select the
scvc/directory - The extension will appear in Chrome's toolbar
The content script uses several critical regex patterns that may need updates when ClinVar UI changes:
subm_scv_re: Extracts submitter info and SCV accessionsinterp_re: Captures interpretation and evaluation datesreview_method_re: Matches review status and method informationvcv_accession_re&vcv_variation_id_re: Extract VCV identifiers
The extension includes comprehensive error handling for:
- Authentication failures (OAuth token issues)
- Missing user profile information
- Google Sheets API errors
- Content script data extraction failures
- Form validation (required fields, action-reason dependencies)
The extension supports these annotation actions:
- Flagging Candidate: Mark submissions for potential removal with categorized reasons
- Remove Flagged Submission: Process already flagged submissions
- No Change: Document review with no action required
Reason categories for flagging include submission errors, unnecessary conflicting interpretations, old/outlier/unsupported submissions, and miscellaneous (including non-monogenic phenotype classifications).
- No package.json, build system, or automated testing - this is a vanilla JavaScript Chrome extension
- The extension frequently breaks due to ClinVar UI changes requiring updates to XPath selectors and regex patterns
- Production uses different spreadsheet ID than the one hardcoded in popup.js
- All console logging includes timestamps for debugging message passing between scripts
- Extension requires users to sync their browser profile with Google account for authentication