Skip to content

#89 - Implement getHierarchies#121

Merged
ddelpiano merged 15 commits intodevelfrom
feature/ILEX-89
Aug 20, 2025
Merged

#89 - Implement getHierarchies#121
ddelpiano merged 15 commits intodevelfrom
feature/ILEX-89

Conversation

@jrmartin
Copy link

@jrmartin jrmartin commented Aug 12, 2025

This pull request takes care of issue 89, implementing getHierarchies endpoint. It also updates the frontend libraries using this endpoint and removes any mock data used for Hierarchies

Copilot Summary
Graph Visualization Improvements:

  • Refactored Graph component (Graph.jsx) to improve tooltip handling, event listeners, and rendering logic. The component now uses useCallback for mouse events, ensures proper cleanup, and gracefully handles cases with no data by displaying a fallback message. The expected predicate prop is now an object rather than a string, supporting richer data structures. [1] [2] [3]

  • Enhanced the graph structure builder (GraphStructure.jsx) by introducing robust normalization functions to handle various data shapes (rows, values, tableData, edges). The root node selection is now more intelligent, and the structure adapts to both legacy and new data formats.

API and Data Handling Enhancements:

  • Added a new API function getTermHierarchies in apiService.ts to fetch and parse term hierarchy data, supporting both JSON-LD and HTML fallback parsing. This enables the frontend to visualize hierarchical relationships even when the API returns HTML tables.

Table Data Normalization:

  • Refactored CustomizedTable.jsx to use a new normalization helper that supports tableData, rows, values, and edges formats. This ensures consistent rendering of tables regardless of the incoming data shape and improves ID generation for table rows.

Minor and Style Refactors:

  • Cleaned up and condensed style definitions in CustomizedTable.jsx for better readability and maintainability. [1] [2]

  • Improved imports and React hook usage in CustomizedTable.jsx for clarity and consistency.

These changes collectively make the application more robust in handling various data sources and formats, improve user interaction with graphs, and simplify future maintenance.

@jrmartin jrmartin requested a review from Copilot August 12, 2025 03:42
Copy link

Copilot AI left a 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 implements the getHierarchies functionality (#89) by enhancing graph visualization and term hierarchy features. The changes introduce robust data normalization to handle multiple data formats and significantly improve the flexibility and user experience of the graph viewer and related components.

  • Adds new API endpoint getTermHierarchies with JSON-LD and HTML fallback parsing capabilities
  • Refactors graph and table components to support multiple data shapes (rows, values, tableData, edges)
  • Implements dynamic hierarchy visualization with children/superclass relationships

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vite.config.js Adds proxy configuration for transitive query endpoints
test/*.json Adds test data files for ontologies and task configurations
src/components/common/CustomizedTreeView.jsx Refactors to accept dynamic tree data with loading states and current item highlighting
src/components/SingleTermView/OverView/PredicatesAccordion.jsx Updates to handle new predicate data format and improves toggle button logic
src/components/SingleTermView/OverView/Predicates.jsx Major refactor to merge triple data from multiple sources into predicate groups
src/components/SingleTermView/OverView/OverView.jsx Adds hierarchy fetching logic and integrates new data flow
src/components/SingleTermView/OverView/Hierarchy.jsx Implements tree building from triple data with children/superclass views
src/components/SingleTermView/OverView/CustomizedTable.jsx Adds robust data normalization helper and improves table rendering
src/components/GraphViewer/GraphStructure.jsx Refactors graph structure building with better data normalization
src/components/GraphViewer/Graph.jsx Improves event handling, tooltip management, and fallback rendering
src/api/endpoints/apiService.ts Implements new getTermHierarchies API function with HTML parsing fallback

jrmartin and others added 8 commits August 11, 2025 21:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jrmartin jrmartin marked this pull request as ready for review August 12, 2025 17:42
@jrmartin jrmartin requested a review from ddelpiano August 12, 2025 17:42
Copy link
Member

@ddelpiano ddelpiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrmartin just a question about the html, the rest looks good to me 👍🏽

import { getMatchTerms, getRawData, getTermHierarchies } from "../../../api/endpoints/apiService";

// ---- HTML table -> triples (subject, predicate, object) ----
function parseTransitiveHtml(html) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrmartin why are we using html here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we factor out this (if needed) in a util to make the component more readable please?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot glitch, i'll fix

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed on last iteration, was unused and unneeded. @ddelpiano

@ddelpiano ddelpiano merged commit c592578 into devel Aug 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants