-
Notifications
You must be signed in to change notification settings - Fork 1
95 return tree like report structure #125
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 implements a hierarchical tree structure for storing and organizing grading results. The new ResultNode class provides a tree-based representation of the grading process, organizing tests into subjects and categories (base, bonus, penalty), enabling better navigation and reporting of test results.
Key Changes
- Introduced
ResultNodeandNodeTypeclasses in a newresult_tree.pymodule to represent hierarchical grading structure - Extended
Resultclass with tree navigation methods (get_subject_node,get_category_tests,print_tree, etc.) - Modified
Grader._run()to build and return the result tree alongside the final score - Updated
AutograderResponseto include theresult_treefield in all responses
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
autograder/core/models/result_tree.py |
New file introducing ResultNode and NodeType classes for hierarchical result representation |
autograder/core/models/result.py |
Added tree navigation and query methods, tree printing utilities, and result_tree field |
autograder/core/grading/grader.py |
Modified grading workflow to build result tree after scoring, added _build_result_node method |
autograder/core/models/autograder_response.py |
Added result_tree field to response model with appropriate configuration |
autograder/autograder_facade.py |
Updated response creation to include result_tree in all code paths |
tests/playroom.py |
Minor whitespace cleanup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return None | ||
| return self.result_tree.find_node(subject_name, NodeType.SUBJECT) | ||
|
|
||
| def get_subject_tests(self, subject_name: str) -> List[TestResult]: |
Copilot
AI
Nov 25, 2025
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.
Extra space before arrow in return type annotation. Should be -> List[TestResult]: instead of -> List[TestResult]: to follow consistent formatting.
| def get_subject_tests(self, subject_name: str) -> List[TestResult]: | |
| def get_subject_tests(self, subject_name: str) -> List[TestResult]: |
| result_node.test_results = subject_tests | ||
| result_node.total_tests = len(subject_tests) | ||
|
|
||
| # Calculate score(tests averages) |
Copilot
AI
Nov 25, 2025
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.
Missing space after opening parenthesis in comment. Should be # Calculate score (tests averages) instead of # Calculate score(tests averages).
| # Calculate score(tests averages) | |
| # Calculate score (tests averages) |
| return self.base_results + self.bonus_results + self.penalty_results | ||
|
|
||
|
|
||
| def get_category_node(self,category: str) -> Optional[ResultNode]: |
Copilot
AI
Nov 25, 2025
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.
Missing space after comma in function parameter list. Should be get_category_node(self, category: str) instead of get_category_node(self,category: str) to follow PEP 8 style guidelines.
| def get_category_node(self,category: str) -> Optional[ResultNode]: | |
| def get_category_node(self, category: str) -> Optional[ResultNode]: |
| author: str | ||
| submission_files: Dict[str,str] = Field(default_factory=dict, alias="submission_files") | ||
|
|
||
| """ The hierarchical result tree structure """ |
Copilot
AI
Nov 25, 2025
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.
Improper placement of docstring comment. The comment """ The hierarchical result tree structure """ should either be a regular inline comment using # or be moved to be part of the class docstring. Multi-line string literals in this position are not standard Python docstrings.
| """ The hierarchical result tree structure """ | |
| # The hierarchical result tree structure |
| feedback = feedback_report, | ||
| test_report = result.get_test_report() | ||
| test_report = result.get_test_report(), | ||
| result_tree= result.result_tree |
Copilot
AI
Nov 25, 2025
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.
Missing space after equals sign in parameter assignment. Should be result_tree=result.result_tree instead of result_tree= result.result_tree to follow PEP 8 style guidelines.
| feedback="", | ||
| test_report=result.get_test_report() | ||
| test_report=result.get_test_report(), | ||
| result_tree= result.result_tree |
Copilot
AI
Nov 25, 2025
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.
Missing space after equals sign in parameter assignment. Should be result_tree=result.result_tree instead of result_tree= result.result_tree to follow PEP 8 style guidelines.
| result_tree= result.result_tree | |
| result_tree=result.result_tree |
| depth + 1 | ||
| ) | ||
|
|
||
| if child_result_node: # Only add a children if it has tests |
Copilot
AI
Nov 25, 2025
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.
Grammatical error in comment: "children" should be singular "child" to match the context. Should be # Only add a child if it has tests instead of # Only add a children if it has tests.
| if child_result_node: # Only add a children if it has tests | |
| if child_result_node: # Only add a child if it has tests |
| from autograder.core.models.test_result import TestResult | ||
|
|
||
| from pydantic import BaseModel, Field | ||
| from pydantic import BaseModel, Field, ConfigDict |
Copilot
AI
Nov 25, 2025
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.
Import of 'ConfigDict' is not used.
| from pydantic import BaseModel, Field, ConfigDict | |
| from pydantic import BaseModel, Field |
| @@ -0,0 +1,97 @@ | |||
| from typing import List, Dict, Optional | |||
Copilot
AI
Nov 25, 2025
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.
Import of 'Dict' is not used.
| from typing import List, Dict, Optional | |
| from typing import List, Optional |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ArthurCRodrigues
left a comment
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.
This looks reeeally good. Can you just update playroom.py and test if it works correctly?
Here are some key parts to look at:
- How does the tree structure get returned via API?
- Does the
Reporteraccess the tree structure? (I guess not) - Is it possible to build the result tree at the same process of grading the criteria tree or these two have two be different processes? (Making the first one possible would save us a lot of resources)
The most important ones are the first and last. If everything is right, then we'll get to the best part of this entire feature: improving the feedback system.
I'll tag you up for a quick call today, are you free at 9?
…tech-network/autograder into 95-return-tree-like-report-structure
|
Yo! Just had time to push my changes right now!. So, about the way the --- BUILDING RESULT TREE ---
Built leaf node: Bootstrap Integration with 1 tests (avg: 100.00)
Built leaf node: Bootstrap Grid Classes with 1 tests (avg: 100.00)
Built branch node: HTML Structure with 2 children, 2 total tests
Built leaf node: Card Components with 1 tests (avg: 100.00)
Built leaf node: Custom Styling with 1 tests (avg: 100.00)
Built branch node: Components with 2 children, 2 total tests
Built branch node: base with 2 children, 4 total tests
Built leaf node: Best Practices with 1 tests (avg: 100.00)
Built branch node: bonus with 1 children, 1 total tests
✓ Added base_node: base (4 tests)
✓ Added bonus_node: bonus (1 tests)This being the result of the finalized result tree: ======================================================================
HIERARCHICAL RESULT TREE
======================================================================
🌳 Assignment Result: 100.00
📁 base: 100.00
📘 HTML Structure (w=50.0): 100.00
📘 Bootstrap Integration (w=40.0): 100.00
📘 Bootstrap Grid Classes (w=60.0): 100.00
📘 Components (w=50.0): 100.00
📘 Card Components (w=50.0): 100.00
📘 Custom Styling (w=50.0): 100.00
📁 bonus: 100.00
📘 Best Practices (w=100.0): 100.00And about the other questions:
Please, let me know about any other suggestions or improvements that could be made! |
|
I'm really impressed with your implementation, we'll be able to come up with some really good features with this result tree now. |
|
Yo! I'm just starting putting my hands on the tasks this week! However, I just wanted to know how I should approach the |
|
@joaovitoralvarenga it's easier to apply these changes in this branch. Notice that you'll have to refactor obs: I'll be kinda distant this week for college motives |
|
Indeed! I meant to say that I would refactor the |
|
Okay! If you need anything, just tag me up. |
Sorry for the long wait to open this pull request, this last week was kinda busy and I wanted to make sure the choices that I made in the implementation were the right ones, since this issue covers a lot of methods of the grading process. First of all, as I have written in the comment section, for the main purpose of storing the subjects and or categories as individual tests I developed a new class inside
../core/modelscalledresult_tree. The class contains the representation of a tree structure that stores each part of the grading process:After that, to make sure all the other parts of the system properly accessed the new method of storing results I made some changes and implementations in other files, for example the
result.py, that now contains more methods that serve the purpose of processing the tree structure and navigate through it:I made, as well, changes in the
grader.pyto implement the tree building and in theautograder_response.pyto adapt the way the main method returned the response, now including theresult_tree. Now in the grading and simulation process, the output includes the building of the result_tree and returns a tree structure. However, I did not change theplayroom.pyto print the returned tree, because I wasn't sure if that was needed, but if you need me to do it, and show the structure in the simulations logs, please tell me, as well as any other change that you think it's needed!