Phase 1: Reorganize code with concerns, services, and docs#255
Open
lmrodriguezr wants to merge 8 commits into
Open
Phase 1: Reorganize code with concerns, services, and docs#255lmrodriguezr wants to merge 8 commits into
lmrodriguezr wants to merge 8 commits into
Conversation
This reverts the file to its original content as the reorganization will be done in separate, more focused commits.
This concern encapsulates pagination logic to avoid repetition in controllers. It provides a default_per_page method and a paginate helper method.
This concern encapsulates filtering and sorting logic to avoid repetition in controllers. It provides apply_filters and apply_sort helper methods.
This concern encapsulates Name-specific logic for filtering and sorting, including status mapping and special sorting cases like 'citations' and 'date'.
This migration adds indexes to frequently queried columns in the names table to improve query performance. Includes single-column indexes for name, rank, status, and foreign keys, as well as composite indexes for common query patterns.
This service object encapsulates the logic for resolving the nomenclatural type class for a given object. It handles edge cases where the object is nil or does not respond to type_of_type, returning 'unknown' as a fallback.
This service object encapsulates the logic for performing fuzzy searches on names using PostgreSQL's similarity functions. It supports both similarity and Levenshtein distance methods.
This file provides a comprehensive OpenAPI 3.0 specification for the API, including all endpoints, schemas, and enums. It can be used with Swagger UI or Redoc to generate interactive API documentation.
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.
This PR implements Phase 1 of the code reorganization plan for the SeqCode Registry. It includes the following improvements:
📌 Changes Made
1. Code Improvements
_nomenclatural_type.json.jbuilder: Safely handles cases where the object isnilor does not respond totype_of_type, returning'unknown'as a fallback. This aligns with the API documentation and improves robustness.2. New Concerns (Reusable Logic)
Paginatable: Encapsulates pagination logic to avoid repetition in controllers. Provides apaginatehelper method.Filterable: Encapsulates filtering and sorting logic. Providesapply_filtersandapply_sorthelper methods.NameFilterable: Encapsulates Name-specific filtering and sorting logic, including status mapping and special sorting cases (e.g.,citations,date).3. New Service Objects
Name::TypeResolver: Encapsulates the logic for resolving the nomenclatural type class for a given object. Handles edge cases where the object isnilor does not respond totype_of_type.Name::FuzzySearch: Encapsulates the logic for performing fuzzy searches on names using PostgreSQL's similarity functions. Supports bothsimilarityandLevenshteindistance methods.4. Database Optimizations
20260511100000_add_indexes_to_names.rbadds indexes to frequently queried columns in thenamestable (e.g.,name,rank,status,nomenclatural_type_type). Includes composite indexes for common query patterns.5. Documentation Improvements
docs/api_glossary.md: A comprehensive glossary documenting all enums (status_name,kind,rank) and special fields likenomenclatural_type. Clarifies the structure ofnomenclatural_typeand its possible values (Name,Genome,Strain,Other,unknown).docs/openapi.yaml: A complete OpenAPI 3.0 specification for the API, including all endpoints, schemas, and enums. This can be used with Swagger UI or Redoc to generate interactive API documentation.🎯 Goals Achieved
nomenclatural_type).🔜 Next Steps
names_controller.rb) into smaller, focused controllers.FastJSONAPI) for consistency./v1/names) and add request specs for all endpoints.📚 Related Issues/PRs
nomenclatural_typeand other enums.Reviewers: Please focus on the new concerns, service objects, and documentation. The changes are backward-compatible and do not break existing functionality.