Skip to content

[FIX] Import Analysis and Batch Refactoring, File Matching algorithm, Document Panel#130

Merged
dawn-tran merged 21 commits into
developfrom
fix/collapse-pdf-viewer-on-no-document
Aug 14, 2025
Merged

[FIX] Import Analysis and Batch Refactoring, File Matching algorithm, Document Panel#130
dawn-tran merged 21 commits into
developfrom
fix/collapse-pdf-viewer-on-no-document

Conversation

@JonnyTran
Copy link
Copy Markdown
Member

No description provided.

JonnyTran and others added 15 commits August 13, 2025 13:22
…xtralit/extralit into fix/collapse-pdf-viewer-on-no-document
- Collapse document panel when no document is available
- Show message when document is missing instead of PDF viewer
- Add createParams method to GetDocumentByIdUseCase
- Refactor useDocumentViewModel to use createParams and expand/collapse panel
- Update tests for new document panel logic
- Update useDocumentViewModel to utilize new use case for fetching documents by record metadata.
- Simplify document panel behavior by removing unnecessary state management for panel expansion.
- Adjust HorizontalResizable component to use optional chaining for safer DOM element access.
- Clean up FocusAnnotation.vue template for improved readability.
…ation component to use new translation keys

- Changed confirmation messages in BaseFlowModal.vue to use the new translation key for cancel confirmation.
- Updated FocusAnnotation.vue to display a consistent message for document loading status using the new translation key.
- Enhanced useImportBatchProgressViewModel.ts to include import history tracking and improved error handling during import history creation.
- Updated matchFiles method to accept TableData type for dataframeData.
- Enhanced matching phases with clearer comments and improved handling of entries with and without file attributes.
- Replaced webkit path matching with exact matching for entries lacking file attributes.
- Introduced new methods for checking reference and title matches as substrings.
- Removed deprecated methods and streamlined the matching process for better performance and clarity.
@JonnyTran JonnyTran requested review from a team as code owners August 14, 2025 02:36
@JonnyTran JonnyTran requested review from Copilot and removed request for a team August 14, 2025 02:41
@Extralit Extralit deleted a comment from codecov-commenter Aug 14, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 14, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 27.77778% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ures/annotation/container/mode/FocusAnnotation.vue 0.00% 6 Missing ⚠️
...onents/base/base-resizable/HorizontalResizable.vue 0.00% 3 Missing ⚠️
...mponents/base/base-resizable/VerticalResizable.vue 0.00% 1 Missing ⚠️
...tures/annotation/settings/SettingsInfoReadOnly.vue 0.00% 1 Missing ⚠️
...nd/components/features/documents/DocumentsList.vue 0.00% 1 Missing ⚠️
extralit/src/extralit/datasets/_io/_disk.py 75.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

❗ There is a different number of reports uploaded between BASE (dbaf4c9) and HEAD (0f704b0). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (dbaf4c9) HEAD (0f704b0)
extralit-server 1 0
Flag Coverage Δ
extralit 66.44% <80.00%> (+0.06%) ⬆️
extralit-server ?
frontend 11.49% <7.69%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mponents/base/base-breadcrumbs/BaseBreadcrumbs.vue 0.00% <ø> (ø)
...it-frontend/components/base/base-code/BaseCode.vue 0.00% <ø> (ø)
.../components/base/base-flow-modal/BaseFlowModal.vue 84.61% <ø> (ø)
...ents/features/annotation/settings/SettingsInfo.vue 0.00% <ø> (ø)
...s/features/import/analysis/ImportAnalysisTable.vue 54.82% <100.00%> (-1.94%) ⬇️
...ents/features/import/history/ImportHistoryList.vue 0.00% <ø> (ø)
...s/user-settings/user-token/UserToken.component.vue 0.00% <ø> (ø)
extralit/src/extralit/settings/_resource.py 84.63% <100.00%> (+0.26%) ⬆️
...mponents/base/base-resizable/VerticalResizable.vue 0.00% <0.00%> (ø)
...tures/annotation/settings/SettingsInfoReadOnly.vue 0.00% <0.00%> (ø)
... and 4 more

... and 180 files with indirect coverage changes

Components Coverage Δ
extralit 66.44% <80.00%> (+0.06%) ⬆️
extralit-server ∅ <ø> (∅)
extralit-frontend 11.49% <7.69%> (-0.05%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements import analysis and batch refactoring with file matching algorithm and document panel improvements. The changes span backend file handling, frontend component updates, and dependency management to enhance the document import workflow.

Key Changes:

  • Enhanced file matching algorithm with simplified two-phase approach (maximum prefix path matching and exact matching)
  • Refactored import analysis and batch progress view models for better type safety and error handling
  • Updated document view model to use new GetDocumentByRecordMetadataUseCase with improved document loading logic

Reviewed Changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
extralit/src/extralit/settings/_resource.py Removes file existence check and adds parent directory creation for JSON exports
extralit/src/extralit/datasets/_io/_disk.py Improves path handling with tilde expansion and better directory creation
extralit/pyproject.toml Updates pandera and numpy version constraints
extralit-frontend/v1/domain/usecases/get-document-by-record-metadata-use-case.ts Renames and enhances document use case with parameter creation method
extralit-frontend/v1/domain/services/FileMatchingService.ts Simplifies file matching algorithm to two-phase approach
extralit-frontend/components/features/import/useImportBatchProgressViewModel.ts Adds import history tracking and enhanced type safety
extralit-frontend/components/features/annotation/container/mode/useDocumentViewModel.ts Updates to use new document use case with improved error handling
extralit-frontend/translation/en.js Reorganizes translation keys and adds document not found message
extralit-frontend/components/base/* Updates component references to use PascalCase naming

matchFiles(files: File[], dataframeData): FileMatchingResult {
matchFiles(files: File[], dataframeData: TableData): FileMatchingResult {
// @ts-ignore
const entries: ParsedEntry[] = dataframeData?.data || [];
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using @ts-ignore suppresses TypeScript warnings but should be avoided. Consider properly typing the dataframeData parameter or using a more specific type assertion.

Suggested change
const entries: ParsedEntry[] = dataframeData?.data || [];
const entries: ParsedEntry[] = (dataframeData?.data as ParsedEntry[]) || [];

Copilot uses AI. Check for mistakes.
} catch (error) {
} catch (error: any) {
hasError.value = true;
errorMessage.value = error.message || "Failed to analyze import";
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type for error handling reduces type safety. Consider using 'unknown' or a more specific error type.

Suggested change
errorMessage.value = error.message || "Failed to analyze import";
} catch (error: unknown) {
hasError.value = true;
if (typeof error === "object" && error !== null && "message" in error && typeof (error as any).message === "string") {
errorMessage.value = (error as { message: string }).message;
} else {
errorMessage.value = "Failed to analyze import";
}

Copilot uses AI. Check for mistakes.
path = Path(path)
if path.exists():
raise FileExistsError(f"File {path} already exists")
path.parent.mkdir(parents=True, exist_ok=True)
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the file existence check could lead to unintentional file overwrites. Consider adding a parameter to control overwrite behavior or logging when files are being overwritten.

Copilot uses AI. Check for mistakes.
@JonnyTran JonnyTran requested a review from a team as a code owner August 14, 2025 02:48
@dawn-tran dawn-tran merged commit 224fe8a into develop Aug 14, 2025
5 of 10 checks passed
@dawn-tran dawn-tran deleted the fix/collapse-pdf-viewer-on-no-document branch August 14, 2025 15:57
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.

4 participants