Skip to content

Conversation

@david-roper
Copy link
Collaborator

@david-roper david-roper commented Oct 22, 2025

refactor to use removeSubjectIDScope method instead

Summary by CodeRabbit

  • Refactor
    • Improved subject ID normalization in data exports using standardized utilities for consistent handling across CSV, TSV, and other export formats.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

This PR consolidates subject ID normalization across two files by replacing custom afterFirstDollar helper functions with a standardized removeSubjectIdScope utility from the shared @opendatacapture/subject-utils package.

Changes

Cohort / File(s) Summary
Subject ID scope removal utility consolidation
apps/api/src/instrument-records/instrument-records.service.ts, apps/web/src/hooks/useInstrumentVisualization.ts
Removed local afterFirstDollar helper functions and replaced all occurrences with removeSubjectIdScope from subject-utils for standardized subject ID normalization in export logic

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • joshunrau

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "refactor: use removeSubjectIDScope method instead of regex function" directly and accurately describes the main change in the pull request. The changeset consistently replaces the local afterFirstDollar helper function across two files with the imported removeSubjectIdScope utility from @opendatacapture/subject-utils. The title is concise, uses the appropriate "refactor" prefix, and is specific enough that a reviewer scanning history would immediately understand the intent and scope of the change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between caad09f and 3272e17.

📒 Files selected for processing (2)
  • apps/api/src/instrument-records/instrument-records.service.ts (3 hunks)
  • apps/web/src/hooks/useInstrumentVisualization.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/api/src/instrument-records/instrument-records.service.ts (1)
packages/subject-utils/src/index.ts (1)
  • removeSubjectIdScope (34-39)
apps/web/src/hooks/useInstrumentVisualization.ts (1)
packages/subject-utils/src/index.ts (1)
  • removeSubjectIdScope (34-39)
🔇 Additional comments (4)
apps/api/src/instrument-records/instrument-records.service.ts (2)

17-17: LGTM! Consolidates subject ID normalization.

Using the shared utility from @opendatacapture/subject-utils eliminates local code duplication and ensures consistent subject ID handling across the codebase.


184-184: LGTM! Subject ID transformation applied correctly.

The refactor correctly replaces the previous helper with removeSubjectIdScope in both export branches, maintaining consistent behavior.

Also applies to: 207-207

apps/web/src/hooks/useInstrumentVisualization.ts (2)

6-6: LGTM! Standardizes subject ID handling.

The import aligns with the refactor in the API service, ensuring consistent subject ID normalization across frontend and backend.


76-76: LGTM! CSV/TSV exports correctly normalized.

The refactor correctly applies removeSubjectIdScope across all CSV/TSV export paths (wide and long formats), ensuring consistent subject ID handling.

Also applies to: 109-109, 121-121


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@joshunrau joshunrau merged commit bfe3f6b into DouglasNeuroInformatics:main Oct 22, 2025
2 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.

2 participants