Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Description

This PR adds an editable table interface for PDF-only uploads, allowing users to manually create reference entries and assign PDFs when no bibliography file is provided.

Core Changes:

  • Automatic table generation: Shows editable table when PDFs uploaded without bibliography, initializes with 3 empty rows
  • Multi-select PDF assignment: Files column uses Tabulator list editor with multiselect, dynamically populated from uploaded PDFs
  • Reference validation: Enforces unique + required constraints on reference column, required on files column
  • Unmapped PDF tracking: Displays count and list of PDFs not assigned to any reference
  • Real-time analysis sync: Edits to reference/files columns trigger analysis status updates via deep watch on dataframe data hash

Implementation:

// Dynamic columns with PDF multi-select
editableTableColumns: [
  { field: "reference", frozen: true, validator: ["required", "unique"] },
  { field: "files", frozenRight: true, editor: "list", 
    editorParams: { values: pdfFileOptions, multiselect: true } }
]

// Auto-sync table edits to dataframe format
handleTableCellEdit(cell) {
  editableTableData = editableTable.getData()
  syncEditableTableToBibData()  // Converts to TableData with filePaths
}

Data Flow:
PDFs uploaded → shouldShowEditableTable → User edits → syncEditableTableToBibData → Analysis pipeline

Leverages existing BaseSimpleTable/RenderTable components and domain entities (TableData, DataFrameSchema). Backward compatible—bibliography upload hides table and resumes standard flow.

Related Tickets & Documents

Closes #191

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Steps to QA

  1. Upload PDF files without a bibliography file
  2. Verify editable table appears with reference, title, authors, year, journal, doi, files columns
  3. Edit reference column → verify unique validation (duplicate values rejected)
  4. Click files column → verify multi-select dropdown shows all uploaded PDFs
  5. Assign PDFs to references → verify unmapped PDF count updates below table
  6. Upload bibliography file afterward → verify table disappears and standard flow resumes
  7. Check import analysis → verify status reflects manual entries

Added/updated tests?

  • Yes
  • 8 unit tests in useImportFileUploadViewModel.spec.ts covering table visibility, column configuration, unmapped tracking, and data sync

Added/updated documentations?

  • No, and this is why: MVP feature, documentation can be added in follow-up based on user feedback
  • I need help with writing docs

Checklist

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Editable Table with File Path Matching for PDF-Only Uploads</issue_title>
<issue_description># Add Editable Table with File Path Matching for PDF-Only Uploads

Problem

When users upload PDFs without bibliography files, they currently have no way to create reference entries or match PDFs to file paths for extraction. This limits the usefulness of the PDF-first upload flow.

Solution

Create a MVP editable table interface that allows users to:

  1. Generate reference entries from uploaded PDFs (initially start with an empty editable table)
  2. Manually edit reference metadata (title, authors, etc.)
  3. Match PDFs to file paths for extraction
  4. Add custom reference keys

Requirements

Core Functionality

  1. Automatic Table Generation: When PDFs are uploaded without bibliography files, automatically generate an empty table with reference and files columns
  2. Editable Fields: Allow editing and adding additionally columns (title, authors, year, journal, DOI, etc.) (already implemented in RenderTable)
  3. File Path Matching: Listing uploaded PDFs that have mapped to the metadata table entries or not

UI Components

  1. Table Interface: Data table with inline editing capabilities
  2. File Matching: multi-selection interface to match 1 or more PDFs to each reference
  3. Metadata Extraction: Extract basic metadata from PDF headers/OCR when possible

Integration Points

  1. PDF Processing: Extract metadata from uploaded PDFs on the backend
  2. File Matching Logic: Intelligent matching based on filename patterns, extracted titles, etc.
  3. Fallback Creation: Generate placeholder entries when metadata extraction fails

Files to Modify

  • extralit-frontend/components/features/import/file-upload/ImportFileUpload.vue :
    • Integrate new table creation flow with editable table (by default) and validators for unique value in the reference column.
    • Additionally the files column (frozen right) need to be a multi value list editor where user can multi-select the uploaded pdf file paths to each reference, configured in tableColumns passed to BaseSimpleTable. See https://tabulator.info/docs/6.3/edit#editor-list
    • Potentially need to create list of PDF files not yet mapped to a reference
  • extralit-frontend/components/features/import/analysis/useImportAnalysisTableViewModel.ts, trigger update on status on cell edits on reference or files column.

Files for reference

  • extralit-frontend/v1/domain/services/FileMatchingService.ts - only run when a BIB/CSV file uploaded for the initial pdf file mapping
  • extralit-frontend/components/features/import/file-upload/CsvColumnSelection.vue - only use for field mapping (column renaming to reference column) with uploaded CSV

Acceptance Criteria

  • Users can upload PDFs and get an editable table of reference entries
  • Table allows inline editing of all reference fields
  • PDF-to-entry matching works multi-select
  • Uses existing validators for files and reference column

Dependencies

Comments on the Issue (you are @copilot in this section)

Custom agent used: ddd-architect
Delivers high-quality, production-ready codebases grounded in domain-driven design principles with clear, pragmatic documentation.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 7, 2025 23:32
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Copilot AI changed the title [WIP] Add editable table for PDF-only uploads with path matching [Feature] Add editable table with PDF file matching for PDF-only uploads Dec 7, 2025
Copilot AI requested a review from JonnyTran December 7, 2025 23:39
- Update `BaseSimpleTable` adapter to pass the full column configuration (including editor params) instead of just name/type.
- Update `RenderTable` logic to respect custom column settings (like `editor: "list"`) by prioritizing schema config over defaults.
- Add watcher to `columnsConfig` in `RenderTable` to ensure dropdown options update reactively when new files are uploaded.
- Add missing `$emit('cell-edited')` in `RenderTable`'s tabulator handler.
- Ensures parent components are notified of changes to trigger state updates like the unmapped files counter.
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.

Add Editable Table with File Path Matching for PDF-Only Uploads

3 participants