Add a decision tree solution kit#84
Draft
akasper wants to merge 11 commits into
Draft
Conversation
Dev to be merged with main [2026-03-04]
There was a problem hiding this comment.
Pull request overview
This PR introduces a new TigerGraph solution kit (agile_operations/decision_tree_maintenance) that models and demonstrates a deterministic, graph-native decision-tree policy for manufacturing maintenance triage, including versioning, scoping, lookup/reference data, and explainability/validation queries.
Changes:
- Adds the
Decision_Engine_Manufacturinggraph schema (vertices/edges) for policy versions, nodes/branches, conditions, lookups, outcomes, and audits. - Adds an S3-backed loading job plus sample CSV policy data (model/version, tree structure, conditions, lookups, outcomes).
- Adds queries and scripts to install/trace/validate/evaluate the sample policy, plus README/docs and reset/setup helpers.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| agile_operations/decision_tree_maintenance/setup.sh | Runs schema creation, loads sample data, and installs queries. |
| agile_operations/decision_tree_maintenance/schema/schema.gsql | Defines the Decision_Engine_Manufacturing graph schema (policy/version/tree/condition/lookups/outcomes/audits). |
| agile_operations/decision_tree_maintenance/reset/reset.gsql | Resets the kit by dropping jobs/data source/queries/graph. |
| agile_operations/decision_tree_maintenance/README.md | Kit overview, setup steps, and example RUN QUERY commands with expected outcomes. |
| agile_operations/decision_tree_maintenance/queries/install_queries.sh | Installs the kit queries into Decision_Engine_Manufacturing. |
| agile_operations/decision_tree_maintenance/queries/list_available_models.gsql | Lists ACTIVE models/versions/scopes. |
| agile_operations/decision_tree_maintenance/queries/trace_policy_graph.gsql | Prints a traced view of the policy graph (nodes/branches/conditions/lookups/outcomes). |
| agile_operations/decision_tree_maintenance/queries/validate_policy_structure.gsql | Performs structural validation checks on the loaded policy. |
| agile_operations/decision_tree_maintenance/queries/evaluate_maintenance_policy.gsql | Executes the sample maintenance triage decision and prints decision + trace. |
| agile_operations/decision_tree_maintenance/loading_job/load_jobs.gsql | Loads sample kit data from S3 into vertices/edges, then cleans up the loading job/data source. |
| agile_operations/decision_tree_maintenance/docs/IMPLEMENTATION_NOTES.md | Documents evaluator/validator design constraints and intended conservatism. |
| agile_operations/decision_tree_maintenance/meta/meta.yml | Declares kit metadata and query ordering for kit packaging/UX. |
| agile_operations/decision_tree_maintenance/meta/schema.json | Captures the schema inventory metadata (vertex/edge type names). |
| agile_operations/decision_tree_maintenance/meta/style.json | Provides GraphStudio styling for vertex/edge types. |
| agile_operations/decision_tree_maintenance/data/decision_models.csv | Sample DecisionModel vertex data. |
| agile_operations/decision_tree_maintenance/data/decision_model_versions.csv | Sample DecisionModelVersion vertex data. |
| agile_operations/decision_tree_maintenance/data/decision_nodes.csv | Sample decision tree nodes (root/decision/terminal). |
| agile_operations/decision_tree_maintenance/data/condition_groups.csv | Sample ConditionGroup vertices for branch guarding. |
| agile_operations/decision_tree_maintenance/data/conditions.csv | Sample Condition vertices (DEFAULT/BOOL_EQ/RANGE_INT/LOOKUP_*). |
| agile_operations/decision_tree_maintenance/data/attribute_defs.csv | Sample governed attribute definitions used by conditions. |
| agile_operations/decision_tree_maintenance/data/lookup_tables.csv | Sample lookup table definitions for evaluation reference data. |
| agile_operations/decision_tree_maintenance/data/lookup_rows.csv | Sample lookup table rows (allow/deny/score) for evaluation. |
| agile_operations/decision_tree_maintenance/data/policy_scopes.csv | Sample PolicyScope vertices (asset_model/region/criticality/priority). |
| agile_operations/decision_tree_maintenance/data/outcomes.csv | Sample terminal outcomes (decision_code/severity/message/next_action). |
| agile_operations/decision_tree_maintenance/data/execution_audits.csv | Sample audit vertex data with a pre-populated trace. |
| agile_operations/decision_tree_maintenance/data/has_versions.csv | Edges linking model -> version. |
| agile_operations/decision_tree_maintenance/data/has_roots.csv | Edges linking version -> root node. |
| agile_operations/decision_tree_maintenance/data/has_branches.csv | Edges linking node -> node with branch metadata (priority/default). |
| agile_operations/decision_tree_maintenance/data/guarded_by.csv | Edges linking node -> condition group. |
| agile_operations/decision_tree_maintenance/data/group_contains.csv | Edges linking condition group -> condition. |
| agile_operations/decision_tree_maintenance/data/uses_attributes.csv | Edges linking condition -> attribute definition. |
| agile_operations/decision_tree_maintenance/data/uses_lookups.csv | Edges linking condition -> lookup table. |
| agile_operations/decision_tree_maintenance/data/has_rows.csv | Edges linking lookup table -> lookup row. |
| agile_operations/decision_tree_maintenance/data/applies_to_scopes.csv | Edges linking version -> policy scopes. |
| agile_operations/decision_tree_maintenance/data/yields.csv | Edges linking terminal node -> outcome. |
| agile_operations/decision_tree_maintenance/data/audited_by.csv | Edges linking version -> audit record. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+131
to
+133
| ListAccum<STRING> @@rids; | ||
| _ = SELECT n FROM root_nodes:n ACCUM @@rids += n.node_id; | ||
| current_node_id = @@rids.get(0); |
Comment on lines
+7
to
+9
| ListAccum<STRING> @@trace; | ||
| ListAccum<STRING> @@rejected_conditions; | ||
|
|
Comment on lines
+74
to
+78
| active_scopes = SELECT s | ||
| FROM versions:v -(APPLIES_TO_SCOPE)-> PolicyScope:s | ||
| WHERE (s.applies_to == applies_to_val OR s.applies_to == "robotic_palletizing_cell" OR s.applies_to == "ANY" OR s.applies_to == "*" OR s.applies_to == "GLOBAL") | ||
| AND (s.region == region_val OR s.region == "GLOBAL" OR region_val == "ANY" OR region_val == "*") | ||
| AND (s.criticality == criticality_val OR s.criticality == "ANY" OR s.criticality == "*"); |
Comment on lines
+142
to
+145
| - `list_available_models()` — active models, versions, scopes. | ||
| - `trace_policy_graph(version_id)` — full traversable structure for explainability (now walks arbitrary depth). | ||
| - `validate_policy_structure(version_id)` — structural governance checks (missing outcomes/branches/defaults, empty non-default groups, orphan lookup refs). Now walks full reachable tree. | ||
| - `evaluate_decision(request_id, model_id, context_json, event_time)` — the generic engine. Returns decision + rich trace + outcome. |
Comment on lines
+74
to
+76
| 1. Select the highest-priority ACTIVE `DecisionModelVersion` whose effective window contains event_time (fallback to latest ACTIVE if no time match). | ||
| 2. Resolve matching `PolicyScope`s using the context (applies_to / region / criticality) with wildcard support (ANY / GLOBAL / * plus fallback matching for legacy keys). | ||
| 3. Start at the HAS_ROOT node and walk: |
Comment on lines
+83
to
+87
| - DEFAULT → true | ||
| - BOOL_EQ → context bool == expected_bool | ||
| - RANGE_INT → min <= context int <= max | ||
| - LOOKUP_DENY / LOOKUP_ALLOW → row exists in the linked LookupTable for the lookup_key value from context, with matching allowed flag | ||
| - STRING_EQ / INT_EQ (extensible) |
|
|
||
| After setup you can explore in GraphStudio or via GSQL shell / REST. | ||
|
|
||
| > **Graph name:** `Decision_Engine` |
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.
Summary
This PR adds a first-draft TigerGraph solution kit for graph-native decision trees in manufacturing maintenance triage. The kit models deterministic policy versions, decision nodes, condition groups, lookup/reference data, policy scopes, outcomes, and execution audit traces in the
Decision_Engine_Manufacturinggraph.Validation
Decision_Engine_Manufacturing.Known Limitations
Follow-ups