Changelog

Release notes and runtime details.

System info
app name
ImagingOverreads
rails version
7.1.3.4
ruby version
3.0.7
ruby platform
x86_64-linux
environment
production
rad env
production
site url
radiology.wisc.edu
relative url root
/a/imaging-overreads
current time
2025-11-14 14:23:11 -0600
Release notes
## [v2.1.9] — 2025-11-13
### Added
- **Abnormal Findings Workflow (MSK)** — introduces a static interface for documenting whether a visit’s findings are *Normal*, *Abnormal (no follow-up)*, or *Abnormal (follow-up recommended)*.  
  This section will later trigger automated email alerts to study coordinators and Principal Investigators when follow-up is required.
- **Allows users to add new PIs and Coordinators

## [v2.1.8] — 2025-11-10
### Added
- **MSK Exam Search page** — a dedicated interface for browsing, filtering, and sorting all MSK exams (resolved and unresolved).  
  Includes Ransack-based search by subject, study, reader, and date range, plus status filters for Unresolved and Resolved exams.
- **Dashboard statistics** in the *Find Exams* section — displays Total, Unresolved, Resolved, and Last 30 Days exam counts for quick at-a-glance insights.

### Changed
- **MSK Control Center layout:** standardized column widths so *Find Exams* and *Recent Exams* cards align visually.
- **Reading Pools and Studies** sections restructured into a unified left-side stack for balanced presentation and improved readability.

## [v2.1.7] — 2025-11-09
### Added
- **Joint Information fields** on MSK Visits — enables structured recording of joint-specific data (joint name, laterality, region, and “Other” text when applicable).
- **Auto-population logic** for joint data during Visit creation, ensuring smoother entry for returning participants.

### Changed
- **Removed `energy_or_duration_text`** column and all associated form fields to streamline the MSK Visit form.
- **Updated Visit accordion display** to include joint summary information alongside medications and pain details.

### Fixed
- Minor UI spacing and alignment adjustments in the Visit accordion headers for consistent readability.

## [v2.1.6] — 2025-11-07
### Added
- Current Medications field on MSK Visits — records patients’ current meds and auto-prefills from the previous visit for continuity.
- Medications section added to the Visit accordion view, showing a concise summary and optional full list reveal.

### Improved
- Updated MSK Visit controller logic to seed visit numbers and copy forward prior visit data automatically. 
- UI refinements in accordion badges for clarity and consistent layout spacing.

## [v2.1.5] — 2025-11-07
### Fixed 
- Fixes to calculate_age method

## [v2.1.4] — 2025-11-06
### Fixed
- Age at Time of Scan now calculates from the exam’s Scan Date (not today) and also shows Current Age in parentheses. Handles nil dates and respects app timezone.
- Move away from radweb email group

### Technical
- Added age_years_on(dob, as_of_date) (and optional age_ym_on) helper; replaced previous calculate_age usage in the Subject card.

## [v2.1.3] — 2025-11-06
### Added
- **MSK Visit Resolution Panel:** users can now mark a visit as *resolved* with optional **resolution notes**.
    - A new card appears within each visit accordion.
    - Once resolved, the visit displays a green badge with the resolution date and notes; a **Reopen** button restores it to open status.
- **Body Diagram modal:** added a top-right **“Body Diagram”** button on the MSK Exam page that opens a full-size reference image in a Bootstrap modal.
- **Unresolved-only Reading Pool:** implemented logic to display only exams with at least one unresolved visit, ensuring accurate exam lists and reader counts.

### Fixed
- **Reader pool counts:** dashboard tallies now accurately reflect unresolved exams per reader — exams with *all visits resolved* are no longer counted.

### Changed
- **MSK Exam Visit schema:** renamed `reader_id` → `resolver_id` and added `resolution_notes` column to support the new resolution workflow.

## [v2.1.2] — 2025-10-31
### Fixed
- Reading pool lists now load **chronologically by Scan Date (newest first)** by default, eliminating the need to manually click the column header.
- Prior scan matching is now **case-insensitive** — entries such as `RMR123`, `rmr123`, and `Rmr123` are treated as equivalent, ensuring no priors are missed due to letter casing.

### Added
- **MSK Visit attachments:** users can now upload files (PDF, images, and `.docx`). Each attachment shows action buttons for **Open in new tab** or **Download**; non-previewable types (e.g., `.docx`) are clearly labeled **Download only**.
- **Downloads menu in top nav (MSK):** quick links to **FDG PET MR Pain Questionnaire** and **CRF Biswal Pain Survey & Body Diagram** (subpath-safe; Turbo disabled for file links).

### Changed
- **Form submission flow:** disabled Turbo on Visit edit forms and now redirect back to the Exam show (anchored to the updated visit) to prevent show/edit content blending.

## [v2.1.2] — 2025-10-31
### Fixed
- Reading pool lists now load **chronologically by Scan Date (newest first)** by default, eliminating the need to manually click the column header.
- Prior scan matching is now **case-insensitive** — entries such as `RMR123`, `rmr123`, and `Rmr123` are treated as equivalent, ensuring no priors are missed due to letter casing.

## [v2.1.1] — 2025-10-21
### Added
- Pool now only lists unresolved exams (exams with any open visits).
- Added clear visit metrics (open / resolved / total) per exam row
- Improved table alignment and readability
- Preloaded study and reader data for faster load times.

## [v2.1.0] — 2025-10-20
### Added
- **Prior Exam Matching (MSK):**
  - Implemented logic to match prior exams by `subject_id` and display them on the MSK Exam detail view.
  - Added new two-column layout for exam pages with a summary sidebar and improved readability.
  - Links to prior exams now open in a new browser tab.

- **Coordinator / PI Entry Form:**
  - Support for creating multiple visits per exam.
  - Improved handling of missing fields when creating new MSK exams.
  - Added ability to edit existing MSK exams directly from the exam page.

- **Visits Entry Form:**
  - Added visit edit functionality.
  - Implemented shorter and clearer visit form layout.
  - Added *Joint* and *Spine* form fields.
  - Added *Pain Tracking* fields (pain range, peak pain, cause of significant pain).
  - Enabled *Medication Tracking* per visit.
  - Added *IRB approval logic* and *patient feedback tracking*.
  - Enabled automatic removal of exams from reader queue once all visits are resolved.

### Changed
- Redesigned **MSK Exam Show Page** to a cleaner two-column layout:
  - Left: visit accordion and management tools.
  - Right: sticky summary sidebar with prior exams, exam metadata, and quick actions.
- Improved page responsiveness and consistency with the Neuro Overreads layout.

## [v2.0.8] — 2025-10-15 - Fixed
- Neuro: prevent `[]=` on `nil` in `Neuro::ExamsController#create` by routing “new diagnosis” inputs through `exam_params` and setting `diagnosis_id` safely.
- Reading Pools: Ransack sort by **Scanner** now works (`left_joins(:scanner)` + permitted association).
- Reading Pools: Ransack sort by **Lab** now works (`left_joins(study: :lab)` + nested association allowances).

## [v2.0.7] — 2025-10-02 — Fix syntax error
- Fix syntax error 

## [v2.0.6] — 2025-10-02 — Fix ransack sorting
- Users can sort on study, lab, and scanner

## [v2.0.5] — 2025-10-02 — Fix bug with redirect
- Fix routing issue after login

## [v2.0.4] — 2025-10-01 — Fix to prior exams
- Fix bug with reading pool not showing the correct name

## [v2.0.3] — 2025-10-01 — Fix to prior exams
- Fix pathing to display prior exam

## [v2.0.2] — 2025-09-29 — Fix to banner
- remove banner from msk section

## [v2.0.1] — 2025-09-29 — Hot fixes to 
- Fix daily report
- update the Banner messages to be less annoying

## [v2.0.0] — 2025-09-29 — MSK demo workflow & program-scoped foundation
### Added
- **MSK demo workflow (preview):** Introduced `Msk::` namespace with initial exam flow and UI. Labeled as preview to set expectations while features are still evolving.
- **MSK preview note in-card:** Moved the “MSK workflow is in preview.” notice into the MSK card/footer to reduce global noise while keeping visibility where it matters.
- **Program-scoped UI groundwork:** Added/extended layout selection so program areas (MSK/Neuro) render the correct layout when browsing program-specific pages (e.g., profile pages under `/msk/...`).

### Changed
- **Top navigation clarity:** Improved the brand/left link’s role as a clear “App Home” to choose MSK vs Neuro; added iconography and labeling to make the landing choice more obvious.
- **Admin area under namespace:** Consolidated admin screens (e.g., Logs) under `Admin::` with correct path helpers (e.g., `admin_logs_path`, `logs_modal_admin_logs_path`). Updated pagination and modal links to match namespaced routing.
- **Reader report plumbing (non-breaking):** Kept the rake entry point stable (`reports:send_daily_report`) while tightening instrumentation and environment handling (see DevOps). Mailer remains program-aware for Neuroradiology readers in production.

## [v1.4.9] - 2025-09-9 - General reading pool fix
- Exclude exams that do not need overread

## [v1.4.8] - 2025-09-9 - Namespacing & Program Slugs
- Added **program-scoped routes** (`/:program/studies`) with helpers like `program_studies_path(program_slug)`.
- Introduced **ProgramScoped** concern to set `current_program`/`program_slug` and switch layouts per program.
- Centralized allowed slugs via **`PROGRAM_SLUGS`** initializer; added **`Program.resolve!(slug)`** and kept `Program.msk/neuro` finders.

## [v1.4.7] - 2025-09-5 - Hotfix
- Edit studies form fix

## [v1.4.6] - 2025-09-4 - Hotfix
- Fix link route

## [v1.4.5] - 2025-09-4 - Hotfix
- Added example Reading Pool table 
- Added example resolution page for readers

## [v1.4.4] - 2025-09-3 - Hotfix
- Fix error in search page

## [v1.4.3] - 2025-09-3 - Added MSK Workflow Support
- Introduced new Musculoskeletal (MSK) workflow for overread requests.
- Coordinators and PIs can now create MSK exams using a dedicated intake form and study selection.
- MSK studies and submissions are tracked alongside existing Neuro overreads.
- Added support for MSK-specific exam details (joints, laterality, procedure context, etc.).

## [v1.4.2] - 2025-08-14
- Fix rspec error

## [v1.4.1] - 2025-08-14
- Added optional `month`/`months` parameter to Panda Data export for filtering by `created_at` (scan entry date) within the last N months.
- Updated Panda Data project instructions to document the new filter.

## [v1.4.0] - 2025-08-01
- Alphabetize dropdown menu

## [v1.3.9] - 2025-08-01
- Display diagonses that are active

## [v1.3.8] - 2025-08-01
- Fix tag/commit issue

## [v1.3.7] - 2025-08-01
- Change entry form from Gender to sex
  - added additional option for "intersex"
- Fix unit testing using docker-compose.test.yml file

## [v1.3.6] - 2025-07-30
### Added
- Added ability for users to add a new dialog
- Added a search field for studies list

## [v1.3.5] - 2025-07-25
### Fix
- Fix hardcoded email

## [v1.3.4] - 2025-07-23
### Fix
- Daily status report bug

## [v1.3.3] - 2025-07-23
### Added
- Created MVC scaffold for `Program` model, including model, controller, views, and associated request specs.
- Added Bootstrap-styled layout to `programs/index.html.erb` for a cleaner UI.
- Implemented model spec (`program_spec.rb`) with validations and attribute tests.
- Included uniqueness validation test for `Role` model scoped to `resource_type` and `resource_id`.

### Fix
- Fix the "Select Principal Investigator" dropdown option in the choose role page

## [v1.3.2] - 2025-07-21
### Added
- Scoped the following roles to a `Program` resource:
  - `reader`
  - `principal_investigator`
- Hidden form field support for `program` in both AD and manual user creation forms.

### Changed
- `UsersController#create_user`:
  - Assigns roles like `reader` and `principal_investigator` with associated `Program` resource.
  - Global roles like `admin` and `lab_support` remain unscoped.
  - Flash messages now include program context where applicable.
- Role assignment logic now prevents assigning duplicate scoped roles.

### Fixed
- Bug where scoped roles were being assigned without program resource in manual form.
- Fixed incorrect passing of `program` to global roles (`admin`, `lab_support`).

### UI
- Added `short_name` column to `programs` table for abbreviated display names (e.g., `"Neuro"` for `"Neuroradiology"`).
- Added `Program#display_name` method to return `short_name` if present.
- Added `Role#display_name` method to map long role names to short labels (e.g., `"principal_investigator"` → `"PI"`).

### Developer Notes
- To scope the Reader and Principal Investigator role, run these commands in rails console
```
neuro = Program.find_by(name: "Neuroradiology")

# Find all global (non-scoped) reader roles
global_reader_role = Role.find_by(
  name: "principal_investigator",
  resource_type: nil,
  resource_id: nil
)

# Fetch all users who currently have the global reader role
users = User.joins(:roles).where(roles: { id: global_reader_role.id })

# Update each user: remove global role, add program-scoped role
users.find_each do |user|
  user.remove_role(:principal_investigator)
  user.add_role(:principal_investigator, neuro)
  puts "Updated user #{user.id} - #{user.email}"
end

neuro = Program.find_by(name: "Neuroradiology")

# Find all global (non-scoped) reader roles
global_reader_role = Role.find_by(
  name: "reader",
  resource_type: nil,
  resource_id: nil
)

# Fetch all users who currently have the global reader role
users = User.joins(:roles).where(roles: { id: global_reader_role.id })

# Update each user: remove global role, add program-scoped role
users.find_each do |user|
  user.remove_role(:reader)
  user.add_role(:reader, neuro)
  puts "Updated user #{user.id} - #{user.email}"
end
```

## [v1.3.1] - 2025-07-17
### Added
- Added `program_id` foreign key to `coordinator_requests` table, linking each request to a `Program`.
- Created model associations: `CoordinatorRequest belongs_to :program`, `Program has_many :coordinator_requests`.

### Changed
- Updated `request_role` method in `WelcomeController` to temporarily assign the "Neuroradiology" program to new coordinator requests.
- Refactored `confirm_reader` method to assign the `:coordinator` role scoped to the associated `program`.

### Notes
- run `rails db:migration` to add the foreign key reference in the programs table

## [v1.3.0] - 2025-07-17
✅ Role Management Enhancements
- Refactored coordinator role to require a Program association (e.g., Neuroradiology, Nuclear Medicine).
- Removed support for global coordinator roles; all role assignments are now resource-scoped.
- Added support for assigning program-specific coordinator roles during user creation and editing

### Refactor coordinator role migration
- Run this in rails console
``` 
neuro = Program.find_by(name: "Neuroradiology")
global_coordinator_role = Role.find_by(
  name: "coordinator",
  resource_type: nil,
  resource_id: nil
)

users = User.joins(:roles).where(roles: { id: global_coordinator_role.id })

users.find_each do |user|
  user.remove_role(:coordinator)
  user.add_role(:coordinator, neuro)
  puts "Updated user #{user.id} - #{user.email}"
end
  
```

## [v1.2.7] - 2025-07-14
### Added
- Reader column to the exam table

## [v1.2.6] - 2025-07-02
### Added
- Added **Edit Exam** button next to the Delete button on the exam details page for easier navigation.

### Changed
- Updated Exam `update` action logic:
  - Redirect now goes to the Reading Pool **only if a summary is present** (indicating the exam was read).
  - Otherwise, after a successful update, users are redirected back to the exam’s show page.
- Improved study dropdown in the exam form:
  - The study select box now displays both Lab and Study names (e.g. “UWNI - Study A”) as the selected text.
  - Maintains optgroup grouping of studies by Lab for better organization.
  
## [v1.2.5] - 2025-07-01
### Fixed
- Fixed an error in `ExamsController#create` where the `@studies` instance variable was not set when rendering the form after a failed save.

## [v1.2.4] - 2025-06-25
### Added
- Implemented `ApplicationSetting.instance` as a true singleton accessor to ensure only one configuration record exists.
- Created comprehensive RSpec tests for `ApplicationSetting` model covering:
- Added tests to ensure `User.display_banner` is toggled when banner message is updated.

### Fixed
- Replaced outdated validation-based singleton enforcement (`validates :id`) with exception-based enforcement using `before_create`.

### Improved
- Added logging when `admin_email` is missing in non-production environments to assist with debugging.

## [v1.2.3] - 2025-06-25
### Added
- **Monthly Usage Report**: Summarizes total exams submitted each month, grouped by year, with a single table layout. Available to admins and readers.
- **Per-Study Usage Breakdown**: Displays exams submitted per study over the last 5 years, with a column for each year, plus total submissions and active status.
- **User Activity Report**: Tracks user roles, last sign-in, active status, and exam submission totals over the past 5 years, with breakdown by year.

### UI Enhancements
- Added "Reports" dropdown to the top navigation bar with links to:
  - Monthly Usage Report
  - Per-Study Usage
  - User Activity Report
- Used contextual Bootstrap styling (e.g., `table-success`, `badge`) for improved visual clarity.

### Security & Access Control
- All reports require user to be either an `admin` or a `reader` (`authorized_as_reader_or_admin!`).

## v1.2.2 - 2025-06-24
### Fixed
- Fixed `ActionView::Template::Error` caused by `@studies` being `nil` when rendering the exam form after validation failure. Added a `before_action :set_studies` to ensure `@studies` is always set in `ExamsController#create`.
- Fixed issue where `comparison_date_cannot_be_before_scan_date` validation caused form rendering to fail by ensuring controller sets necessary data.

### Added
- RSpec model validations for `Exam`, `Study`, `Lab`, `Diagnosis`, and `Log` models.
- Scope tests for `Exam.unread`.
- Tests for file presence validation in `ExamAttachment` using `FactoryBot` with attached test files.

## v1.2.1 - 2025-06-23
- RSpec test coverage for the `Study` model, including:
  - Validations and associations
  - `after_initialize` behavior to assign default program ("Neuroradiology")
  - Ransack configuration via `.ransackable_attributes` and `.ransackable_associations`
  - Edge cases for blank coordinator IDs, invalid billing arrangements, and default values
  
## v1.2.0 - 2025-06-19
- Renamed `users.role` to `users.requested_role` to reduce confusion with actual assigned roles via Rolify.
- Changed `on_holds.reader_id` column type from text to integer for data integrity.
- Removed unused `lab_id` column from `labs` table
- Removed migrations logic

## v1.1.21 - 2025-06-18
- Fix bug causing error when creating a new PI 

## v1.1.20 - 2025-06-17
- Fixes to abnormal email attachment for missing field and incorrect name

## v1.1.19 - 2025-06-16
- Improved coordinator request approval flow:
  - Added friendly feedback for users who re-click confirmation links after approval.
  - Clarified flash messages for already-approved coordinator requests.
- Improvements to Manual user sign-up flow
- Flash notifications on successful account creation.
- Resolved issue where manual passwords weren’t being saved due to strong-params guard.

## v1.1.18 - 2025-06-05
- Preserve original URL during authentication:
  - Users are now redirected back to their originally requested page (e.g., `/panda`) after logging in
  - Improves support for automation tools and redirect-following scripts
  
## v1.1.17 - 2025-06-04
- Remove auth token from panda page

## v1.1.16 - 2025-06-04
- Allow users to post to the panda page

## v1.1.15 - 2025-06-02
- CC the reader on email notification sent to PI's and Coordinators
- Improved formatting of abnormal report `.doc` attachments:
    - Added bordered tables for clearer layout
    - Centered and italicized header to match legacy style
    - Included all missing metadata fields (scan date, PI, coordinators, contact info)
    - Replaced placeholder date in filename with actual date (e.g., `2025-06-02`)
    - Enhanced disclaimer styling for readability
    
## v1.1.14 - 2025-05-30
- Fix email bug for abnormal report attachment

## v1.1.13 - 2025-05-29
- Added delete functionality for exams

## v1.1.12 - 2025-05-27
- Send admin email notification upon role request
- Fix role removal in admin form
- Improve PI confirm coordinator confirmation message

## v1.1.11 - 2025-05-19
- Fix diagonsis form fields
- Improvements to formatting on studies list

## v1.1.10 - 2025-05-19
- Allow On-hold to be released by anyone

## v1.1.4 - v1.1.9 - 2025-05-15
- Fix coordinator insert
- Fix bug that would not allow users to select multiple coordinators
- Fixed an issue that sometimes prevented a Study from being saved when Coordinators were selected.
- Resolved a problem that caused an error message to appear when creating a new Study.
- Fix study dropdown menu for principal investigators

## v1.1.3 - 2025-05-14
### Improvements
- Refactored the Users index page to improve performance by eager-loading roles and removing in-place role editing.
- Added role management fields to the User edit page (admin-only).
- Coordinator role assignment now clears any pending Coordinator request and resets the user's `role` field.
- Daily Reader Report emails now include a direct link to access the application homepage.

## v1.1.2 - 2025-05-13
### Improvements
- Added funding to the billing reports page
- Role requested information and notification

## v1.1.1 - 2025-05-08
### Fixed
- Fix authorization issue that blocked Readers from submitting an exam as "On Hold"

## v1.1.0 - 2025-05-08
### Fixed
- Corrected an issue where unchecking a user role did not properly remove the role from the database.
- Improved handling of New User creation during Study#new when no Study record exists yet.
- Updated user authentication flow with clearer flash alert messages.
- Fixed inconsistencies in redirects to fallback paths when study context was missing.

## v1.0.9 (2025-04-25)
- Fixed search filter for exams that are "on hold"
- Fixed redirect error upon authentication

## v1.0.8 (2025-04-28)
- Implemented placeholder email generation (missing-email-<username>@placeholder.local) when LDAP mail attribute is missing
- Incomplete users are redirected to edit their profile after login
- Successful profile completion redirects users to root dashboard
- Added Admin-only editable fields (username and password) on the users#edit page

## v1.0.7 (2025-04-21)
- Add safe handling for missing LDAP mail attribute when creating new users

## v1.0.6 (2025-04-17)
- Fixed crash caused by missing `mail` attribute in LDAP user login
- Added defensive handling for missing email values during AD authentication
- Simulated missing LDAP `mail` attribute in development for testing edge cases

## v1.0.5 (2025-04-16)
- Hot fix to search page

## v1.0.4 (2025-04-16)
- Fixed Ransack-related table sorting bugs across multiple views
- Added dynamic modal system to logs#index for viewing detailed log information
- AJAX-powered modals allow users to inspect individual log entries without leaving the page
- Improved log table layout and viewer link styling
- Minor controller and view cleanups for consistency

## v1.0.3 (2025-04-15)
- Fix migrations error for adding studies

## v1.0.2 (2025-04-14)
- Added global banner alert system for application-wide announcements
- Admins can edit banner content via Application Settings
- Users can dismiss banner; dismissal is tracked per user
- Added buttons to force-show or hide the banner for all users
- Improved styling and layout of the Application Settings page
- 
## v1.0.1 (2025-04-02)
- Fixes to search filters

## v1.0.0 (2025-03-27)
- MVP release

## v0.0.2 (02-27-2025) - Fix authorization
- coordinator requests fixed
- improvements to table data
- format email notification

## v0.0.1 (02-21-2025) - Base app MVP 
- Enter Scans
- Reading pools
- Billing Page
- Search page
- Coordinator Request workflow
- Email notifications