moderne-visualizations-misc 0.71.1__py3-none-any.whl → 0.71.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,9 +31,8 @@
31
31
  "# Filter the data frame to only include rows where repositoryWithBranch contain\n",
32
32
  "# a term in the repository_filter (case insensitive)\n",
33
33
  "if len(repository_filter) > 0:\n",
34
- " df = df[\n",
35
- " df[\"repositoryWithBranch\"].str.contains(\"|\".join(repository_filter), case=False)\n",
36
- " ]"
34
+ " df = df[df[\"repositoryWithBranch\"].str.contains(\n",
35
+ " \"|\".join(repository_filter), case=False)]"
37
36
  ]
38
37
  },
39
38
  {
@@ -54,31 +53,6 @@
54
53
  " .reset_index(name=\"count\")\n",
55
54
  ")\n",
56
55
  "\n",
57
- "\n",
58
- "def shorten_ids(df, cols):\n",
59
- " \"\"\"\n",
60
- " Shorten IDs in cols by using the artifact names if there are name collisions\n",
61
- " \"\"\"\n",
62
- " sep = \".\"\n",
63
- " df = df.copy()\n",
64
- " for col in cols:\n",
65
- " # count how many distinct IDs share each suffix\n",
66
- " unique_ids = df[col].unique()\n",
67
- " suffixes = pd.Series(unique_ids).str.rsplit(pat=sep, n=1).str[-1]\n",
68
- " suffix_counts = suffixes.value_counts()\n",
69
- "\n",
70
- " # pick either full ID or suffix per row\n",
71
- " row_suffix = df[col].str.rsplit(pat=sep, n=1).str[-1]\n",
72
- " df[col] = np.where(\n",
73
- " row_suffix.map(suffix_counts) > 1,\n",
74
- " df[col], # conflict → full ID\n",
75
- " row_suffix, # unique → artifact name\n",
76
- " )\n",
77
- " return df\n",
78
- "\n",
79
- "\n",
80
- "recipe_counts = shorten_ids(recipe_counts, [\"parentRecipe\", \"recipe\"])\n",
81
- "\n",
82
56
  "# sort recipe_counts by count\n",
83
57
  "recipe_counts = recipe_counts.sort_values(by=[\"count\"], ascending=False)\n",
84
58
  "\n",
@@ -111,9 +85,8 @@
111
85
  "# convert the 'count' column to a list\n",
112
86
  "value = list(recipe_counts[\"count\"])\n",
113
87
  "\n",
114
- "# Format labels with node names and counts\n",
115
- "\n",
116
88
  "\n",
89
+ "# Format labels with node names and counts\n",
117
90
  "def getCount(node):\n",
118
91
  " left = recipe_counts[recipe_counts[\"recipe\"] == node][\"count\"].sum()\n",
119
92
  " if left == 0:\n",
@@ -122,7 +95,12 @@
122
95
  " return left\n",
123
96
  "\n",
124
97
  "\n",
125
- "formatted_labels = [f\"{node} - {getCount(node)}\" for node in all_nodes]\n",
98
+ "def short_name(node):\n",
99
+ " return node.split(\".\")[-1]\n",
100
+ "\n",
101
+ "\n",
102
+ "formatted_labels = [f\"{short_name(node)} - {getCount(node)}\" for node in all_nodes]\n",
103
+ "\n",
126
104
  "base_colors = [\n",
127
105
  " \"#2f42ff\",\n",
128
106
  " \"#7e9bd2\",\n",
@@ -148,6 +126,13 @@
148
126
  " colors.append(base_colors[i % len(base_colors)])\n",
149
127
  "\n",
150
128
  "\n",
129
+ "# Create custom data for links to show full node names\n",
130
+ "link_customdata = []\n",
131
+ "for i in range(len(source)):\n",
132
+ " source_name = all_nodes[source[i]]\n",
133
+ " target_name = all_nodes[target[i]]\n",
134
+ " link_customdata.append([source_name, target_name])\n",
135
+ "\n",
151
136
  "# Create the Sankey diagram\n",
152
137
  "fig = go.Figure(\n",
153
138
  " data=[\n",
@@ -158,11 +143,16 @@
158
143
  " line=dict(color=\"black\", width=0.5),\n",
159
144
  " label=formatted_labels,\n",
160
145
  " color=colors,\n",
146
+ " customdata=all_nodes,\n",
147
+ " hovertemplate=\"<b>%{customdata}</b><extra></extra>\",\n",
148
+ "\n",
161
149
  " ),\n",
162
150
  " link=dict(\n",
163
151
  " source=source,\n",
164
152
  " target=target,\n",
165
153
  " value=value,\n",
154
+ " customdata=link_customdata,\n",
155
+ " hovertemplate=\"<b>Source:</b> %{customdata[0]}<br><b>Target:</b> %{customdata[1]}<br><b>Count:</b> %{value}<extra></extra>\",\n",
166
156
  " ),\n",
167
157
  " )\n",
168
158
  " ]\n",
@@ -172,16 +162,16 @@
172
162
  "fig.update_layout(\n",
173
163
  " title_text=\"Recipes that made changes\",\n",
174
164
  " font_size=10,\n",
175
- " height=max(len(all_nodes) * 15, 400),\n",
165
+ " height=max(len(all_nodes) * 10, 500),\n",
176
166
  ")\n",
177
167
  "\n",
178
- "fig.show()"
168
+ "fig.show()\n"
179
169
  ]
180
170
  }
181
171
  ],
182
172
  "metadata": {
183
173
  "kernelspec": {
184
- "display_name": ".venv",
174
+ "display_name": "moderne-visualizations-misc",
185
175
  "language": "python",
186
176
  "name": "python3"
187
177
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moderne_visualizations_misc
3
- Version: 0.71.1
3
+ Version: 0.71.2
4
4
  Summary: Miscellaneous visualizations for the Moderne platform
5
5
  Author-email: Jonathan Schneider <jonathan@moderne.io>, Kyle Scully <kyle@moderne.io>
6
6
  License: Apache-2.0
@@ -5,7 +5,7 @@ moderne_visualizations_misc/cobol_find_copybook.ipynb,sha256=buo5GKENebMYD3OSB2L
5
5
  moderne_visualizations_misc/cobol_relationships.ipynb,sha256=eYSMUDcK5x7MlAFxpGJXPuRNjD1VU4AEFbk710bPPM0,8530
6
6
  moderne_visualizations_misc/cobol_relationships_data_grid.ipynb,sha256=QVvc-gZEQa1qgYaWc5lODA9bWEhQ-NqX51a38EMN8XI,1950
7
7
  moderne_visualizations_misc/comment_language_distribution.ipynb,sha256=8SqQPSOxMpS-oJzUQbDSnmz7tIUky-M_zFYqsxdsxLo,3157
8
- moderne_visualizations_misc/composite_recipe_results_sankey.ipynb,sha256=KOIcw2GoEZC9WxDPvF-pEf_ZhB7GI_iVgIvi1BQffpE,6422
8
+ moderne_visualizations_misc/composite_recipe_results_sankey.ipynb,sha256=PmEZ10HnmNns-1QHqrJSrfXL-q6u0ZtBAEKRsE3kRxE,6167
9
9
  moderne_visualizations_misc/dependency_tree_view.ipynb,sha256=rcW9LQzn_zNM7wnjOq1YA0B9ybzZPdrTRcc2VqzLOfs,2983
10
10
  moderne_visualizations_misc/dependency_tree_view_nodejs.ipynb,sha256=YQRFdXkRwedWxEqe6G5ugqiU_aHPiRVFwPHQRyo0r5w,674
11
11
  moderne_visualizations_misc/dependency_tree_view_nodejs_build_tools.ipynb,sha256=YQRFdXkRwedWxEqe6G5ugqiU_aHPiRVFwPHQRyo0r5w,674
@@ -198,7 +198,7 @@ moderne_visualizations_misc/specs/sql_crud.yml,sha256=BaUV1bb3oJNrNARU-0YAez2S2y
198
198
  moderne_visualizations_misc/specs/text_matches_tree_grid.yml,sha256=U2-j_kFaHNex5avmPtzw_6AWUs9JKk_ouCyqdJBThp4,903
199
199
  moderne_visualizations_misc/specs/ui5lint_rule_treemap.yml,sha256=6g01v1eD93cvtS7GnRfzScunx_X5u9fjn2ax5SHCVsE,258
200
200
  moderne_visualizations_misc/specs/ui5lint_violations_heatmap.yml,sha256=Ep97JEK5xjQkAjmHJNKPAoiIiDeuvksjnx_UREZTAbI,275
201
- moderne_visualizations_misc-0.71.1.dist-info/METADATA,sha256=Y2berLT7WxHS3Hv5ssLPJQp9fW8x6rCil7WD6Nef00I,687
202
- moderne_visualizations_misc-0.71.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
203
- moderne_visualizations_misc-0.71.1.dist-info/top_level.txt,sha256=V_gviHcBSH6w_h-g98-9ecQRoN8d82cxPdV-DA3Leeo,28
204
- moderne_visualizations_misc-0.71.1.dist-info/RECORD,,
201
+ moderne_visualizations_misc-0.71.2.dist-info/METADATA,sha256=JN1mTwlz5vp-cHdYp_EMMTaF9TfWplWPCpukVl4kdPc,687
202
+ moderne_visualizations_misc-0.71.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
203
+ moderne_visualizations_misc-0.71.2.dist-info/top_level.txt,sha256=V_gviHcBSH6w_h-g98-9ecQRoN8d82cxPdV-DA3Leeo,28
204
+ moderne_visualizations_misc-0.71.2.dist-info/RECORD,,