sul-dlss / sul_pub

SUL system for harvest and managing publications for Stanford CAP, with controlled API access.
http://cap.stanford.edu
Other
8 stars 3 forks source link

PubHash class has the wrong responsibilities #409

Closed dazza-codes closed 1 year ago

dazza-codes commented 6 years ago

PubHash is basically doing mapping of pub_hash data into CSL citation. It's one big mapping class. It does nothing about managing the content in the publication.pub_hash. Those responsibilities are scattered throughout the entire app - in controllers, in models, rake tasks etc. All of those disparate pub_hash modifications should be consolidated in the PubHash class. Also, the CSL mapping in the PubHash should be split out into a series of CSL mappers that are subclassed to handle different publication provenance (cap, pubmed, sciencewire, etc.) and different document types.

dazza-codes commented 6 years ago

The old PubHash class has been refactored into the lib/csl module. This affords an opportunity to create a new PubHash class to own responsibility for the Publication.pub_hash content, as a first class citizen (class) to wrap the Hash content currently in that field. Creating this class to wrap that content will afford additional specs for managing that content. It may also simplify some functionality for the sync of db-model-content into that data structure, by adding utility methods on that class for various sync operations.