-
Notifications
You must be signed in to change notification settings - Fork 0
Add dataset keywords model #219
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
base: master
Are you sure you want to change the base?
Conversation
2b17bdf to
35c9ef5
Compare
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.
Pull request overview
This PR adds a new Keyword model to enable searchable, reusable keywords for datasets, replacing the previous TextField-based approach with a proper many-to-many relationship. The implementation includes autocomplete functionality for better user experience and proper query optimization.
Key changes:
- Introduces a new
Keywordmodel with ManyToMany relationship toDataset, using a customKeywordNameFieldthat auto-slugifies keyword names - Adds keyword autocomplete API endpoint with frontend JavaScript implementation for real-time suggestions
- Migrates logging from standard
loggingmodule tologuruthroughout the views
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| gateway/sds_gateway/api_methods/models.py | Added Keyword model with custom KeywordNameField for auto-slugification; removed keywords TextField from Dataset model |
| gateway/sds_gateway/api_methods/tests/factories.py | Added post-generation hook for creating Keyword instances in DatasetFactory |
| gateway/sds_gateway/api_methods/serializers/dataset_serializers.py | Added keywords field to DatasetGetSerializer to return keyword names |
| gateway/sds_gateway/api_methods/admin.py | Registered Keyword model in admin and added keyword display to DatasetAdmin |
| gateway/sds_gateway/users/views.py | Added KeywordAutocompleteAPIView; updated dataset create/update logic to handle keyword associations; migrated from logging to loguru |
| gateway/sds_gateway/users/urls.py | Added URL route for keyword autocomplete API endpoint |
| gateway/sds_gateway/users/forms.py | Added keywords field to DatasetInfoForm with cleaning/normalization logic |
| gateway/sds_gateway/templates/users/partials/step_1.html | Added keywords input field to dataset creation form |
| gateway/sds_gateway/templates/users/partials/review_create_dataset.html | Added keywords display section to review step |
| gateway/sds_gateway/templates/users/partials/dataset_details_modal.html | Added keywords section to dataset details modal |
| gateway/sds_gateway/templates/users/group_captures.html | Implemented KeywordAutocomplete JavaScript class for autocomplete functionality |
| gateway/sds_gateway/static/js/deprecated/datasetDetailsModal.js | Added keyword rendering with badge styling to populate dataset modal |
| gateway/sds_gateway/static/js/captureGroupingComponents.js | Added keyword display handling in form handler and dataset review step |
| gateway/sds_gateway/static/js/deprecated/captureGroupingComponents.js | Added keyword display and X-Requested-With header |
| gateway/sds_gateway/static/js/actions/DetailsActionManager.js | Added updateKeywords method to render keywords with badges in dataset details modal |
| gateway/sds_gateway/api_methods/migrations/max_migration.txt | Updated migration marker to reflect new Keyword model migration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gateway/sds_gateway/static/js/deprecated/datasetDetailsModal.js
Outdated
Show resolved
Hide resolved
modified: gateway/sds_gateway/api_methods/admin.py modified: gateway/sds_gateway/api_methods/migrations/max_migration.txt modified: gateway/sds_gateway/api_methods/models.py modified: gateway/sds_gateway/api_methods/serializers/dataset_serializers.py new file: gateway/sds_gateway/static/js/captureGroupingComponents.js modified: gateway/sds_gateway/static/js/deprecated/captureGroupingComponents.js modified: gateway/sds_gateway/static/js/deprecated/datasetDetailsModal.js modified: gateway/sds_gateway/templates/users/group_captures.html modified: gateway/sds_gateway/templates/users/partials/dataset_details_modal.html modified: gateway/sds_gateway/templates/users/partials/review_create_dataset.html modified: gateway/sds_gateway/users/forms.py modified: gateway/sds_gateway/users/urls.py modified: gateway/sds_gateway/users/views.py
35c9ef5 to
350d49d
Compare
SFDS-224