Replies: 6 comments 5 replies
|
Some cool functionality clear distinctions between editions (with different formats) could unlock:
I also believe that, if in the future we were interested in deprecating rich metadata import/export, and native readers for certain file formats, this abstraction would make it easier to do so while still enabling Grimmory to be the "home" for that media (regardless of the formats supported by the official reader). This could allow us to better justify allowing formats to be uploaded that are read only via custom apps/readers. And much more :) |
nitpicking: "zero or more" if we want to keep supporting physical books with no digital version attached |
|
A couple of observations that might apply to either Part 1 https://github.com/orgs/grimmory-tools/discussions/1331 or Part 2 here. If I remember correctly, with the current implementation of book_files, we only support a max of one file per format per book. Similar policies include file renaming, moving books (and files) across libraries, etc. Furthermore, in the move from Part 1 to Part 2, will the items in the TBD table containing file metadata be linked to the corresponding book entry or to the corresponding edition entry? It might be the latter, which will automatically allow the possibility of having-say-2 PDF versions of the same book because they correspond to two different editions, etc. Finally: I'll repeat myself by suggesting adding ER diagrams to this RFC too, showing in particular how the data model will evolphe from Part 1 to Part 2. |
I personally find the Work name confusing, as it's too generic and suggests something that has to do with someone's profession. That said, if we'd err on the side of a generic term, I'd be tempted to use something like "Publication", which is at least a bit more specific than Work (i.e. it's not a sculpture, or a song :)), and still generic enough in the realm of printing/writing/publishing. |
|
In my PKM, I use the term "Text". |
|
I think this is alright for normal books. The Book > Edition nomenclature makes sense. However, this is still confusing for anthologies, collections, magazines and scientific papers. All of which have usecases in Grimmory. Maybe, there should first be a selection dropdown for different categories (including comics, right now the extra functionality seems to only appear for CBX files) first and then the necessary branch specific metadata. Also, this shouldn't make metadata management more confusing than it is right now. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
RFC: Work / Book -> Edition Abstraction
Problem statement
Grimmory currently treats a "book" as one object that has one source of truth for metadata between available formats, that have different reader states and files. That model is simple, but it makes it hard to represent the real shape of a library if a user owns multiple versions of the same underlying creative work.
For example, Harry Potter and the Philosopher's Stone can have stable work-level facts that are true across versions: title, author, series, original publication context, genres, a general description, etc. A user may then own several editions of that work: an initial physical publication, a Pottermore EPUB, a Stephen Fry audiobook, a 2025 full cast audiobook, or another translated/localized release. Those editions share the same underlying intellectual work, but they are not interchangeable copies. They may have different narrators, publishers, release dates, covers, identifiers, durations, page counts, languages, abridgement statuses, and more.
The exact name of the top-level concept can be decided during implementation. It could be called Work to emphasize the abstract intellectual title, or kept as the high-level Book to better match user-facing language and metadata sources that model
book -> edition. The important shape is the same either way: a top-level group with one ore more Editions, and each Edition representing a specific publication/release/version.This RFC should be done after the file/format abstraction. It assumes Grimmory can already represent one edition/format as one or more durable files. The goal here is not to unblock M4B creation or audiobook chapter editing; that should be done by the edition RFC work. The goal here is to make Grimmory's top-level library model match how books, audiobooks, digital publications, and physical copies relate to each other.
Goals
Non-goals
Proposed solution
Introduce a two-level library model that can be named either
Work -> EditionorBook -> Edition:A Work/Book is the abstract title that users expect to see grouped together in the library. An Edition is a specific version or release of that title. The existing post-refactor format/issue/file model remains below the Edition and describes what the user actually owns and can read, play, download, or mutate.
This shape intentionally matches common metadata-provider models.
print,audio, orebook.Paperback,Hardcover,Kindle Edition,ebook,Audiobook,Audible Audio,Audio CD,MP3 CD, and other physical or audio formats.Grimmory should be able to consume those richer provider shapes when available without forcing every metadata source to expose the same structure.
The first implementation should stay pragmatic. Existing
bookrows can be migrated into one Work/Book with one Edition each. Later, users and metadata matching flows can merge duplicate Works/Books or attach newly discovered editions to an existing Work/Book.Examples:
What are the high level architectural changes?
BookEntityconcepts into Work/Book and Edition responsibilitiesbookId-style requests to the appropriate Work/Book and Edition during the transitionWhat are the high level data model changes?
Add a Work/Book table/model with fields that are generally true across editions- including but not limited to:
idAdd an Edition table/model with fields that describe one version of the Work/Book:
idwork_idHardcover,Kindle Edition,Audiobook, orAudible AudioThe exact field split should be validated during implementation, but the rule of thumb should be:
Edition metadata should be able to inherit from Work/Book metadata. If an Edition does not override title, description, series, genre, or creator display fields, Grimmory can display the Work/Book value. If it does override a field, the Edition value should win for that Edition's detail pages, readers, matching, and exports.
Metadata providers should be normalized through a small source-format mapping layer. The mapping should preserve the original provider label for display/debugging, but also normalize it into Grimmory's edition model.
Example mappings:
Paperback,Hardcover,Mass Market Paperback,Library Binding,Board book,Leather Bound,Unbound,Spiral-bound,Unknown BindingKindle Edition,Nook,ebook,CD-ROMAudiobook,Audible Audio,Audio CD,Audio Cassette,MP3 CDFor compatible providers, metadata matching should become edition-aware: users should be able to choose the right provider edition before applying metadata, and Grimmory should know whether fetched fields should update the Work/Book or the Edition. For simpler providers, Grimmory can keep the current behavior by treating the result as a combined Work/Book + Edition candidate and creating or updating a default Edition. At that point, it’s more a UI/UX question.
What are the main changes to the UI?
Risks
Are there any backwards-incompatible changes?
Yes. This is a large conceptual migration than the file/format RFC’s changes. Existing code and clients often assume that one book row is the canonical library item. The rollout should preserve compatibility by keeping current routes and payloads working while introducing explicit Work/Book and Edition APIs.
High-risk areas include:
Does this project have special implications for security and data privacy?
Moderate. The model itself does not introduce new file mutation or download permissions, but merge/split operations can change which editions appear grouped together and which metadata appears in user-facing APIs. Permission checks must remain anchored to the user's library access, not only to shared Work/Book records.
Could this change significantly increase load on any of our backend systems?
Yes. Work/Book/Edition resolution can add joins and metadata fallback logic to common library queries. Search indexing may also need to index both Work/Book and Edition fields. The implementation should avoid N+1 metadata resolution and should cache or precompute effective metadata where needed for list views.
Does this project have any dependencies?
Yes. This RFC should come after:
Alternative solutions
One alternative is to keep a single
bookmodel and add a "related editions" relationship. That is less disruptive, but it keeps shared and edition-specific metadata mixed together and makes inheritance/override rules unclear.Another alternative is to jump to a fuller Work / Edition / Manifestation model immediately. That may be cleaner from a bibliographic perspective, but the prior file/format RFC already creates a practical lower layer for manifestations/media objects. This RFC should avoid redoing that work and focus on the missing Work/Book -> Edition split.
Another alternative is to keep relying on folders, filenames, and provider metadata to imply relationships between versions. That avoids a migration, but it leaves users with duplicate library entries and no durable way to say "these are editions of the same work."
Implementation and rollout plan
Does this project require a migration?
Yes. The initial migration is very mechanical:
bookIdreferences can resolve.Follow-up cleanup can merge duplicate Works/Books, improve edition grouping, and move provider-specific metadata into the correct layer. The first migration should not attempt to perfectly deduplicate every library.
Is this project in an experiment or feature flagged?
The schema migration itself should not be user-toggleable, but Work/Book grouping and Edition-specific UI can roll out behind feature flags or staged routes. Existing book screens should remain available until the Work/Book -> Edition UI reaches parity.
Success Criteria
How will you validate the solution is working correctly?
What monitoring and alerting will you do to ensure this project doesn't decrease performance and reliability?
bookIdlookups after migrationAll reactions