-
Notifications
You must be signed in to change notification settings - Fork 74
Fixes to json exporter #473
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,8 +81,13 @@ def process_piechart_stats(data_metadata: pd.DataFrame, output: Path, old_chart: | |
| def process_radial_stats(signals_data: dict[str, Any], output: Path) -> None: | ||
| """Process data for radial tree statistics.""" | ||
|
|
||
| root_key: str | None | ||
| root_key = next(iter(signals_data)) | ||
| if root_key is None: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So here we take first name found right? Do we need to check that there are not more names/roots or is that already covered by some other checks?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Signals data will look like that: signals_data = {tree.name: get_data(tree, extend_all_attributes, extended_attributes)}But yeah, we probably should check for the size and throw an error when its > 1 to notice that something is going wrong |
||
| raise KeyError("No root node with children found in signals data") | ||
|
|
||
| children = [] | ||
| stack = [{"key": key, "value": value, "parent": None} for key, value in signals_data["Vehicle"]["children"].items()] | ||
| stack = [{"key": key, "value": value, "parent": None} for key, value in signals_data[root_key]["children"].items()] | ||
|
|
||
| while stack: | ||
| current = stack.pop() | ||
|
|
@@ -91,6 +96,11 @@ def process_radial_stats(signals_data: dict[str, Any], output: Path) -> None: | |
| item = {"name": key} | ||
| if "children" in value: | ||
| item["children"] = [] | ||
| # Copy type and description for branches too | ||
| if "type" in value: | ||
| item["type"] = value["type"] | ||
| if "description" in value: | ||
| item["description"] = value["description"] | ||
| stack.extend( | ||
| {"key": child_key, "value": child_value, "parent": item["children"]} | ||
| for child_key, child_value in value["children"].items() | ||
|
|
@@ -113,8 +123,8 @@ def process_radial_stats(signals_data: dict[str, Any], output: Path) -> None: | |
| stack.extend(child for child in current["children"] if "children" in child) | ||
|
|
||
| radial_tree_data = { | ||
| "name": "Vehicle", | ||
| "type": "Vehicle", | ||
| "name": root_key, | ||
| "type": root_key, | ||
| "children": children, | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.