-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Engaging Crowds: switch to Datasette for subject browse & search #2132
Conversation
1b1cf27
to
bea0f18
Compare
bea0f18
to
b84c247
Compare
packages/app-project/src/shared/components/SubjectPicker/helpers/searchParams.js
Outdated
Show resolved
Hide resolved
packages/app-project/src/shared/components/SubjectPicker/helpers/searchParams.js
Outdated
Show resolved
Hide resolved
Awright, code read looks good. I only have two comments (see above), so I'll start with the functionality tests now. Or after dinner. We'll see! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review
This PR connects the "Subject Set selection" logic to an external Datasette service. This external service essentially acts as a query-able index for information on subject sets, e.g. "yo pls list all Subjects in this set in its published page order"
- New external dependency: https://subject-set-search-api.zooniverse.org/subjects (Datasette service which lists subjects/subject sets)
- Hardcoded values (e.g. "WF 16106 has been indexed") have been removed so logic is more correct. (i.e. pls check with the external Datasette service to see if the subject set has been indexed there)
⚠️ Important note: code assumes production environment only, simply because there's no 'staging alternative' to subject-set-search-api.zooniverse.org- Note: the ping to the external service is done on Next.js, not client-side.
Testing
Tested on localhost, using Chrome + macOS.
URLs:
- Main project: Scarlets and Blues, "Minutes" workflow
- Baseline: Engaging the Crowds, any workflow.
Testing:
- Go to the /classify page
- Choose the workflow, choose any Subject Set.
- For the main project, this should load a list of all Subjects for the Subject Set. ("Select Subject" functionality)
- NOTE: actually clicking on the specific Subject won't actually load it. This is a separate PR.
- For the baseline, no differences in the functionality should be noted.
Testing looks good 👍 After adding some debug commands into the code, I can confirm that the external Datasette service is being pinged correctly by Next.js.
❓ Advanced testing:
- I tried to figure out what'd happen if
hasIndexedSubjects()
couldn't reach the external service (e.g. the service is 500-ing). - In theory, this should bork the main project (no indexing service = this feature shouldn't be able to work, so a functionality crash should be expected) but have no effect on the baseline project (the hasIndexedSubjects just times out and all it costs is a bit of waiting time).
- Unfortunately, I haven't been able to devise a way to test this properly. (Substituting the URL with a fake one didn't quite pan out the way I expected.)
Main goal of this advanced test is to ensure a failure in the external dependency should not negatively affect projects that don't depend on it.
Probably nothing to worry about right now, but worth noting in case it crops up in the future.
Status
LGTM, giving this a 👍
b84c247
to
ff8e1b0
Compare
If the promises in On the other hand, if |
Encode URL query params and add a test case with reserved characters.
Switch the subject indexing tool over to Datasette.
This PR lets you select a subject set and subject to classify. #2148 is needed in order to load the indexed subjects into the classifier.
Test URL:
http://local.zooniverse.org:3000/projects/bogden/scarlets-and-blues?env=production&demo=true
The Minutes workflow for Scarlets & Blues has subject sets which are indexed in Datasette.
Package:
app-project
Review Checklist
General
Components
Apps
yarn panic && yarn bootstrap
ordocker-compose up --build
and app works as expected?Publishing
Post-merging