Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/assets/metadata_characterization_hierarchy.html

Large diffs are not rendered by default.

800 changes: 0 additions & 800 deletions docs/assets/metadata_collapsed_charts_all_sheets.html

This file was deleted.

25 changes: 25 additions & 0 deletions docs/assets/metadata_coremeta4cat_overview.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/metadata_reaction_hierarchy.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/metadata_simulation_hierarchy.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/metadata_synthesis_hierarchy.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The Simulation metadata group specifies the essential information for reporting
## Interactive diagram

<iframe
src="assets/metadata_collapsed_charts_all_sheets.html"
src="assets/metadata_coremeta4cat_overview.html"
width="100%"
height= "800vh"
style="border: 2px solid #5C88DA; background-color: #F0F8FF;
Expand Down
89 changes: 88 additions & 1 deletion scripts/generate_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,88 @@ def build_sunburst_chart(schema: dict, class_name: str) -> str:
"""


# ─────────────────────────────────────────────────────────────────────────────
# Overview chart (all four data classes under a single CoreMeta4Cat root)
# ─────────────────────────────────────────────────────────────────────────────

def build_overview_chart(schema: dict) -> str:
"""
Return standalone HTML for a combined sunburst that shows all four
CoreMeta4Cat data classes (Synthesis, Characterization, Reaction,
Simulation) as branches under a single 'CoreMeta4Cat' root node.
Each branch uses the colour palette of its respective data class.
"""
main_classes = ["Synthesis", "Characterization", "Reaction", "Simulation"]

ids: list[str] = []
names: list[str] = []
parents: list[str] = []
colors: list[str] = []
hover: list[str] = []

root_id = "CoreMeta4Cat"
_add_node(ids, names, parents, colors, hover,
root_id, "CoreMeta4Cat", "", "#555555",
"CoreMeta4Cat — catalysis metadata schema")

for cls in main_classes:
key = cls.lower()
color_map = BASE_COLORS.get(key, BASE_COLORS["coremeta4cat"])
cls_id = f"{root_id}|{cls}"

_add_node(ids, names, parents, colors, hover,
cls_id, cls, root_id, color_map["M"],
f"Data class: {cls}")

_build_tree_for_class(
schema, cls, cls_id,
ids, names, parents, colors, hover,
color_map, cls,
)

fig = px.sunburst(ids=ids, names=names, parents=parents, hover_name=hover)
fig.update_traces(marker=dict(colors=colors))
fig.update_layout(
title=dict(text="CoreMeta4Cat — Schema Overview", x=0.5),
margin=dict(t=40, l=10, r=10, b=10),
autosize=True,
)

chart_html = to_html(
fig,
full_html=False,
include_plotlyjs=False,
config={"responsive": True},
)

return f"""<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>CoreMeta4Cat Schema Overview</title>
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
<style>
html, body {{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}}
.chart-container {{
width: 100%;
height: 100vh;
}}
</style>
</head>
<body>
<div class="chart-container">
{chart_html}
</div>
</body>
</html>
"""


# ─────────────────────────────────────────────────────────────────────────────
# Entry point
# ─────────────────────────────────────────────────────────────────────────────
Expand All @@ -263,7 +345,12 @@ def main(schema_dir: str, output_dir: str) -> None:
dest.write_text(html, encoding="utf-8")
print(f" OK {dest}")

print(f"\nDone -- {len(main_classes)} charts written to '{output_dir}'.")
overview_html = build_overview_chart(schema)
overview_dest = out / "metadata_coremeta4cat_overview.html"
overview_dest.write_text(overview_html, encoding="utf-8")
print(f" OK {overview_dest}")

print(f"\nDone -- {len(main_classes) + 1} charts written to '{output_dir}'.")


if __name__ == "__main__":
Expand Down
Loading