-
Notifications
You must be signed in to change notification settings - Fork 4
#89 - Revisit Get Hierarchies Endpoint #128
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
Conversation
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 pull request refactors and improves the handling of term hierarchies and predicates in the API and UI components by splitting predicate and hierarchy logic, enhancing data normalization, and improving the user experience when visualizing term relationships.
- Separated predicate fetching from hierarchy logic with dedicated API endpoints and parsers
- Enhanced graph data normalization to support both single and multi-subject layouts
- Updated UI components for better consistency, loading states, and error handling
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/parsers/predicateParser.tsx | New parser for building predicate groups from JSON-LD data |
src/parsers/hierarchies-parser.tsx | New parser for converting JSON-LD to triples and edges for hierarchy data |
src/main.jsx | Removed mock worker initialization |
src/components/SingleTermView/OverView/ViewDiagramDialog.jsx | Improved predicate selection UI with better state management |
src/components/SingleTermView/OverView/PredicatesAccordion.jsx | Added constants for view types to improve maintainability |
src/components/SingleTermView/OverView/Predicates.jsx | Simplified component by removing complex merging logic |
src/components/SingleTermView/OverView/OverView.jsx | Split API calls and added loading states for better UX |
src/components/SingleTermView/OverView/Hierarchy.jsx | Enhanced hierarchy mapping with better label extraction |
src/components/GraphViewer/GraphStructure.jsx | Improved graph normalization for single/multi-subject layouts |
src/api/endpoints/hiearchies-parser.ts | File deleted and moved to new location |
src/api/endpoints/apiService.ts | Split hierarchy and predicate endpoints with improved error handling |
src/api/endpoints/apiActions.ts | Fixed GET request handling with proper Accept headers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
In general there are a lot of changes not related to the PR, not optimal. Also the dashboard has been broken with this PR, please fix that. Thanks
@ddelpiano I removed the mocked data worker and that's the cause of this https://github.com/MetaCell/interlex/pull/128/files#diff-752aae33033979082689dba3e7f51955013615f0535c21ac94265e067da311edL11 The dashboard was working with mock data and cause the failure, added back |
…nt interference with real endpoint
This pull request refactors and improves the handling of term hierarchies and predicates in the API and UI components. The main changes include splitting predicate and hierarchy API logic, improving the normalization and mapping of graph data, and updating UI components for clarity and consistency. These updates enhance robustness, maintainability, and user experience when visualizing and interacting with term relationships.
API Refactoring and Improvements
getTermPredicates
function is now separate fromgetTermHierarchies
, with each using a more robust fetch-based implementation and improved error handling. Predicate groups are built usingbuildPredicateGroupsForFocus
. [1] [2]jsonldToTriplesAndEdges
and related constants to the correct parser location (src/parsers/hierarchies-parser
). [1] [2]Graph Data Normalization and Mapping
GraphStructure.jsx
to support both single- and multi-subject layouts, ensuring compatibility with legacy and new data shapes. The code now buckets rows by subject and adapts the visualization accordingly.Hierarchy.jsx
, making label extraction and part-of relationship detection more resilient to data variations. [1] [2]UI Component Updates
id
fields and ensure type safety.GET Request Normalization