8000 Fix/Use relative paths in annotation project exports by mbsantiago · Pull Request #67 · mbsantiago/whombat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix/Use relative paths in annotation project exports #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 9, 2025

Conversation

mbsantiago
Copy link
Owner

This PR addresses an issue where annotation project exports included absolute paths to recordings instead of paths relative to a common base directory. Absolute paths are undesirable as they reduce portability and may leak personal folder structures.

Root Cause

The problem was traced to the whombat.routes.annotation_project.download function, which handles the export of annotation projects in AEOF format. Although the conversion function accepts an optional audio_dir parameter to compute relative paths, this argument was not being utilized.

Solution

Because recordings within a single annotation project may originate from different datasets—each with its own root directory—it wasn’t feasible to simply make paths relative to their individual dataset roots. Furthermore, the same recording might appear in multiple datasets with different root paths, complicating the decision further.

To resolve this, I implemented a new annotation_project.get_base_dir function, which computes the first common parent directory across all dataset root directories involved in the project. This common base directory is then used to generate relative paths for all recordings in the export.

This approach allows users to copy or share the annotation project folder (or any subsection of it) while maintaining a consistent internal structure. Importing such a project elsewhere should work without modification, improving portability and usability.

Additional Changes

  • Updated the export logic to use the computed base_dir.
  • Added unit tests for:
    • get_base_dir with multiple datasets.
    • The single-dataset case to confirm it returns that dataset's root directory.
    • Ensuring the exported annotation project uses paths relative to base_dir.

Copy link
codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.13%. Comparing base (bd6736d) to head (c4a7585).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
back/src/whombat/routes/annotation_projects.py 0.00% 2 Missing ⚠️
back/src/whombat/api/annotation_projects.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #67      +/-   ##
==========================================
+ Coverage   66.94%   67.13%   +0.19%     
==========================================
  Files         184      184              
  Lines        8455     8465      +10     
==========================================
+ Hits         5660     5683      +23     
+ Misses       2795     2782      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mbsantiago mbsantiago merged commit 6c9af5a into main Apr 9, 2025
9 checks passed
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.

1 participant
0