[PP-883] Implement Lexile DB Metadata Service#3154
Open
dbernstein wants to merge 11 commits intomainfrom
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3154 +/- ##
==========================================
- Coverage 93.26% 93.24% -0.03%
==========================================
Files 493 499 +6
Lines 45616 45857 +241
Branches 6254 6278 +24
==========================================
+ Hits 42546 42758 +212
- Misses 1983 2004 +21
- Partials 1087 1095 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
32f9a18 to
f13d549
Compare
…sed throughout. Also use PalaceValueError rather than generic ValueError.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements a MetaMetrics Lexile DB integration that augments Lexile scores from the Lexile Titles Database API. A nightly Celery task processes ISBNs that lack Lexile data and adds scores from this source. Lexile DB scores are treated as high quality and override scores from other sources (e.g. Overdrive).
Motivation and Context
Motivation and Context
https://ebce-lyrasis.atlassian.net/browse/PP-883
Changes
New Files
src/palace/manager/integration/metadata/lexile/__init__.py– Package init and exportssrc/palace/manager/integration/metadata/lexile/settings.py–LexileDBSettings(username, password, base_url, sample_identifier for self-test)src/palace/manager/integration/metadata/lexile/api.py–LexileDBAPIclient forGET {base_url}/api/fab/v3/book/?format=json&ISBN={isbn}with HTTP Basic Authsrc/palace/manager/integration/metadata/lexile/service.py–LexileDBService(MetadataService) withHasSelfTestsfor connection self-testsrc/palace/manager/celery/tasks/lexile.py–run_lexile_db_update(orchestrator) andlexile_db_update_task(worker)src/palace/manager/scripts/lexile_db.py–LexileDBUpdateScriptfor manual runsbin/lexile_db_update– Script entry pointtests/manager/integration/metadata/lexile/test_api.py– API client teststests/manager/integration/metadata/lexile/test_service.py– Service and self-test teststests/manager/celery/tasks/test_lexile.py– Celery task testsModified Files
src/palace/manager/sqlalchemy/constants.py– AddedLEXILE_DB = "Lexile DB"src/palace/manager/sqlalchemy/model/datasource.py– Added Lexile DB towell_known_sourceswithoffers_metadata_lookup=True,primary_identifier_type=ISBNsrc/palace/manager/sqlalchemy/model/classification.py– Added(LEXILE_DB, Subject.LEXILE_SCORE): 0.95so Lexile DB scores override otherssrc/palace/manager/service/integration_registry/metadata.py– RegisteredLexileDBServiceas "MetaMetrics Lexile DB Service"src/palace/manager/service/celery/celery.py– Imported lexile tasks and added daily beat schedule (3:00 AM)tests/manager/api/admin/controller/test_metadata_services.py– Assert Lexile DB protocol in metadata services and add Lexile DB fixtureFeatures
bin/lexile_db_updatewith--forceto reprocess all ISBNs (including those with existing Lexile DB data)How Has This Been Tested?
test_api.py): Lexile lookup, 10/13-digit ISBNs, hyphen stripping, not found, empty objects, null lexile, HTTP errors, empty ISBN,raise_on_erroron 403test_service.py): Self-test success with/without data, custom sample ISBN, auth failuretest_lexile.py): Orchestrator skip when not configured, worker queuing, classification creation, force mode replacement, Timestamp creationI've tested the CM Admin experience which works. However, since we don't yet have valid credentials, we can't verify that the service works yet.
Checklist
featurelabel to the PRDB migrationlabel if migrations are included (none in this PR)