Skip to content

[PP-3488] Add the published date, bisac tags, and age ranges to the inventory report.#2986

Merged
dbernstein merged 5 commits intomainfrom
feature/PP-3488-add-columns-to-inventory-report
Jan 23, 2026
Merged

[PP-3488] Add the published date, bisac tags, and age ranges to the inventory report.#2986
dbernstein merged 5 commits intomainfrom
feature/PP-3488-add-columns-to-inventory-report

Conversation

@dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Jan 15, 2026

Description

This PR adds the aforementioned fields to the inventory report. If there are multiple bisac tags and/or age ranges they are aggregated in the appropriate fields. If there are no associated bisac classifications, then the columns will appear empty.
The unit tests were updated .

Motivation and Context

https://ebce-lyrasis.atlassian.net/browse/PP-3488

How Has This Been Tested?

Unit tests updated.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@dbernstein dbernstein marked this pull request as draft January 15, 2026 22:41
@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.98%. Comparing base (9b3fd4b) to head (cdfe25f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2986   +/-   ##
=======================================
  Coverage   92.97%   92.98%           
=======================================
  Files         459      459           
  Lines       43276    43288   +12     
  Branches     6034     6034           
=======================================
+ Hits        40238    40250   +12     
  Misses       1966     1966           
  Partials     1072     1072           

☔ 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.

@dbernstein dbernstein marked this pull request as ready for review January 15, 2026 23:27
@dbernstein dbernstein requested a review from a team January 15, 2026 23:28
@dbernstein dbernstein force-pushed the feature/PP-3488-add-columns-to-inventory-report branch from 034eb17 to 6978b3c Compare January 16, 2026 18:30
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Looks good. I added a couple comments to consider before merging.

classification_alias = aliased(Classification)
subject_alias = aliased(Subject)
bisac_value = func.coalesce(subject_alias.name, subject_alias.identifier)
age_range_value = cast(subject_alias.target_age, String)
Copy link
Member

Choose a reason for hiding this comment

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

The target_age column is an INT4RANGE type. What kind of output does casting it to a String produce? Is it the format that end users will expect? I think it'll end up using PG interval notation, which I'm not sure end users will understand.

Comment on lines +412 to +416
.outerjoin(
bisac_subquery,
(bisac_subquery.c.data_source_id == DataSource.id)
& (bisac_subquery.c.identifier_id == Edition.primary_identifier_id),
)
Copy link
Member

Choose a reason for hiding this comment

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

Minor: If a book has BISAC classifications from multiple data sources, this would only show the ones from the same data source as the license pool. Not sure if we'll come across this case, but a book could have BISAC classifications from other sources, and those wouldn't be included. Might be worth validating this with production data.

Comment on lines +289 to +293
expected_age_range_one = db.session.scalar(
select(cast(Subject.target_age, String)).where(
Subject.id == bisac_subject_one.id
)
)
Copy link
Member

Choose a reason for hiding this comment

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

Minor: The test queries the database to determine the expected age range format rather than asserting a specific format. While this ensures the test passes regardless of PostgreSQL's representation, it doesn't explicitly verify that the format is correct or user-friendly. Might be nice to have an explicit assertion.

@dbernstein dbernstein force-pushed the feature/PP-3488-add-columns-to-inventory-report branch from 6978b3c to 5c84ed9 Compare January 23, 2026 21:32
…an identifier, not just the ones associated with a particular data source. Also change the delimited from a comma to a pipe for bisac_subjects and age_ranges and ensure that the values are unique.
@dbernstein dbernstein force-pushed the feature/PP-3488-add-columns-to-inventory-report branch from 5c84ed9 to 31f6b63 Compare January 23, 2026 21:33
@dbernstein
Copy link
Contributor Author

@jonathangreen : thanks for the review - I incorporated your feedback before merging.

@dbernstein dbernstein enabled auto-merge (squash) January 23, 2026 21:34
@dbernstein dbernstein disabled auto-merge January 23, 2026 21:39
@dbernstein dbernstein enabled auto-merge (squash) January 23, 2026 21:40
@dbernstein dbernstein merged commit 37577ad into main Jan 23, 2026
19 checks passed
@dbernstein dbernstein deleted the feature/PP-3488-add-columns-to-inventory-report branch January 23, 2026 21:48
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