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.
start at closing #149
#1438 (comment)
added a basic graph template at threads/templates/graph.html
graph visual is still kinda wonky, need to fix it but the basic foundation is there
Description:
This PR introduces a graph-based API and utilities for the application, including:
Graph Data API:
Endpoints for analyzing relationships between entities using networkx.
Get the most caused problem (/api/graph/most-caused-problem).
Get the most effective solution (/api/graph/most-effective-solution).
Retrieve the shortest path between a problem and a solution (/api/graph/shortest-path/<problem_id>/<solution_id>).
Export graph data in a Cytoscape-compatible format (/api/graph/data).
Management Command for Dummy Data:
A new Django management command, load_graph_dummy_data, creates dummy Civi and CiviLink objects for testing graph functionalities.
Includes predefined dummy data with relationships like response, rebuttal, and support.
Graph Utilities:
Added graphs.py with utility functions to:
Load graph data from the database.
Analyze graph metrics like the most caused problems, most effective solutions, and shortest paths.
Model Enhancements:
Extended the Civi and CiviLink models to support graph-related functionality.
Civi model now includes methods for exporting graph-compatible data (node, weight, etc.).
CiviLink model supports edge representation in graphs with a relation_type field.
URL Configuration:
Updated URL patterns to include the new graph_api endpoints.
Highlights:
Added CiviLink model to represent directed relationships between Civi objects.
New API endpoints powered by networkx enable advanced graph-based analysis and insights.
Dummy data loader ensures quick setup for development and testing.