moderne-visualizations-misc 0.59.0__py3-none-any.whl → 0.60.0__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.
@@ -1,154 +1,167 @@
1
1
  {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {
7
- "tags": [
8
- "parameters"
9
- ]
10
- },
11
- "outputs": [],
12
- "source": [
13
- "repository_filter: list[str] = []\n",
14
- "count_threshold = \"0\""
15
- ]
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "tags": [
8
+ "parameters"
9
+ ]
10
+ },
11
+ "outputs": [],
12
+ "source": [
13
+ "repository_filter: list[str] = []\n",
14
+ "count_threshold = \"0\""
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": null,
20
+ "metadata": {},
21
+ "outputs": [],
22
+ "source": [
23
+ "from code_data_science import data_table as dt\n",
24
+ "import warnings\n",
25
+ "\n",
26
+ "warnings.simplefilter(\"ignore\")\n",
27
+ "\n",
28
+ "df = dt.read_csv(\"../samples/composite_recipe_results_sankey.csv\")\n",
29
+ "\n",
30
+ "df[\"repositoryWithBranch\"] = df[\"repositoryPath\"] + \"/\" + df[\"repositoryBranch\"]\n",
31
+ "# Filter the data frame to only include rows where repositoryWithBranch contain\n",
32
+ "# a term in the repository_filter (case insensitive)\n",
33
+ "if len(repository_filter) > 0:\n",
34
+ " df = df[\n",
35
+ " df[\"repositoryWithBranch\"].str.contains(\"|\".join(repository_filter), case=False)\n",
36
+ " ]"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": null,
42
+ "metadata": {},
43
+ "outputs": [],
44
+ "source": [
45
+ "df = df[[\"parentRecipe\", \"recipe\"]].assign(count=lambda r: 1)\n",
46
+ "recipe_counts = (\n",
47
+ " df[[\"parentRecipe\", \"recipe\", \"count\"]]\n",
48
+ " .groupby(by=[\"parentRecipe\", \"recipe\"])[\"count\"]\n",
49
+ " .count()\n",
50
+ " .sort_values(ascending=False)\n",
51
+ " .reset_index(name=\"count\")\n",
52
+ ")\n",
53
+ "recipe_counts[\"parentRecipe\"] = recipe_counts[\"parentRecipe\"].transform(\n",
54
+ " lambda s: s.split(\".\")[-1]\n",
55
+ ")\n",
56
+ "recipe_counts[\"recipe\"] = recipe_counts[\"recipe\"].transform(lambda s: s.split(\".\")[-1])\n",
57
+ "\n",
58
+ "# sort recipe_counts by count\n",
59
+ "recipe_counts = recipe_counts.sort_values(by=[\"count\"], ascending=False)\n",
60
+ "\n",
61
+ "count_threshold_int = int(count_threshold)\n",
62
+ "\n",
63
+ "if count_threshold_int > 0:\n",
64
+ " recipe_counts = recipe_counts[recipe_counts[\"count\"] > count_threshold_int]"
65
+ ]
66
+ },
67
+ {
68
+ "cell_type": "code",
69
+ "execution_count": null,
70
+ "metadata": {},
71
+ "outputs": [],
72
+ "source": [
73
+ "import plotly.graph_objects as go\n",
74
+ "\n",
75
+ "# Extract all unique nodes (parent and child recipes)\n",
76
+ "all_nodes = list(set(recipe_counts[\"parentRecipe\"]).union(set(recipe_counts[\"recipe\"])))\n",
77
+ "\n",
78
+ "# Create node indices mapping for preparing for plotly\n",
79
+ "node_indices = {node: i for i, node in enumerate(all_nodes)}\n",
80
+ "\n",
81
+ "# iterates over each row in recipe_counts and find the index of the 'parentRecipe' in node_indices and adds it to the source list.\n",
82
+ "source = [node_indices[row[\"parentRecipe\"]] for _, row in recipe_counts.iterrows()]\n",
83
+ "\n",
84
+ "# iterates over each row in recipe_counts and find the index of the 'recipe' in node_indices and adds it to the target list.\n",
85
+ "target = [node_indices[row[\"recipe\"]] for _, row in recipe_counts.iterrows()]\n",
86
+ "\n",
87
+ "# convert the 'count' column to a list\n",
88
+ "value = list(recipe_counts[\"count\"])\n",
89
+ "\n",
90
+ "# Format labels with node names and counts\n",
91
+ "\n",
92
+ "\n",
93
+ "def getCount(node):\n",
94
+ " left = recipe_counts[recipe_counts[\"recipe\"] == node][\"count\"].sum()\n",
95
+ " if left == 0:\n",
96
+ " return recipe_counts[recipe_counts[\"parentRecipe\"] == node][\"count\"].sum()\n",
97
+ " else:\n",
98
+ " return left\n",
99
+ "\n",
100
+ "\n",
101
+ "formatted_labels = [f\"{node} - {getCount(node)}\" for node in all_nodes]\n",
102
+ "base_colors= [\"#2f42ff\", \"#7e9bd2\", \"#27aa88\", \"#dcefde\", \"#84C9AA\", \"#ECB81F\", \"#F9A91B\", \"#DB4197\", \"#992FB9\", \"#D9D8E8\", \"#FF3232\"]\n",
103
+ "\n",
104
+ "# create a color palette for the nodes\n",
105
+ "# important that the number of colors is equal to the number of nodes\n",
106
+ "\n",
107
+ "colors = []\n",
108
+ "for i in range(len(all_nodes)):\n",
109
+ " if i < len(base_colors):\n",
110
+ " colors.append(base_colors[i])\n",
111
+ " else:\n",
112
+ " colors.append(base_colors[i % len(base_colors)])\n",
113
+ "\n",
114
+ "\n",
115
+ "# Create the Sankey diagram\n",
116
+ "fig = go.Figure(\n",
117
+ " data=[\n",
118
+ " go.Sankey(\n",
119
+ " node=dict(\n",
120
+ " pad=15,\n",
121
+ " thickness=15,\n",
122
+ " line=dict(color=\"black\", width=0.5),\n",
123
+ " label=formatted_labels,\n",
124
+ " color=colors\n",
125
+ " ),\n",
126
+ " link=dict(\n",
127
+ " source=source,\n",
128
+ " target=target,\n",
129
+ " value=value,\n",
130
+ " ),\n",
131
+ " )\n",
132
+ " ]\n",
133
+ ")\n",
134
+ "\n",
135
+ "# Update layout\n",
136
+ "fig.update_layout(\n",
137
+ " title_text=\"Recipes that made changes\",\n",
138
+ " font_size=10,\n",
139
+ " height=max(len(all_nodes) * 15, 400),\n",
140
+ ")\n",
141
+ "\n",
142
+ "fig.show()"
143
+ ]
144
+ }
145
+ ],
146
+ "metadata": {
147
+ "kernelspec": {
148
+ "display_name": "Python 3",
149
+ "language": "python",
150
+ "name": "python3"
151
+ },
152
+ "language_info": {
153
+ "codemirror_mode": {
154
+ "name": "ipython",
155
+ "version": 3
156
+ },
157
+ "file_extension": ".py",
158
+ "mimetype": "text/x-python",
159
+ "name": "python",
160
+ "nbconvert_exporter": "python",
161
+ "pygments_lexer": "ipython3",
162
+ "version": "3.11.4"
163
+ }
16
164
  },
17
- {
18
- "cell_type": "code",
19
- "execution_count": null,
20
- "metadata": {},
21
- "outputs": [],
22
- "source": [
23
- "from code_data_science import data_table as dt\n",
24
- "import warnings\n",
25
- "\n",
26
- "warnings.simplefilter(\"ignore\")\n",
27
- "\n",
28
- "df = dt.read_csv(\"../samples/composite_recipe_results_sankey.csv\")\n",
29
- "\n",
30
- "df[\"repositoryWithBranch\"] = df[\"repositoryPath\"] + \"/\" + df[\"repositoryBranch\"]\n",
31
- "# Filter the data frame to only include rows where repositoryWithBranch contain\n",
32
- "# a term in the repository_filter (case insensitive)\n",
33
- "if len(repository_filter) > 0:\n",
34
- " df = df[\n",
35
- " df[\"repositoryWithBranch\"].str.contains(\"|\".join(repository_filter), case=False)\n",
36
- " ]"
37
- ]
38
- },
39
- {
40
- "cell_type": "code",
41
- "execution_count": null,
42
- "metadata": {},
43
- "outputs": [],
44
- "source": [
45
- "df = df[[\"parentRecipe\", \"recipe\"]].assign(count=lambda r: 1)\n",
46
- "recipe_counts = (\n",
47
- " df[[\"parentRecipe\", \"recipe\", \"count\"]]\n",
48
- " .groupby(by=[\"parentRecipe\", \"recipe\"])[\"count\"]\n",
49
- " .count()\n",
50
- " .sort_values(ascending=False)\n",
51
- " .reset_index(name=\"count\")\n",
52
- ")\n",
53
- "recipe_counts[\"parentRecipe\"] = recipe_counts[\"parentRecipe\"].transform(\n",
54
- " lambda s: s.split(\".\")[-1]\n",
55
- ")\n",
56
- "recipe_counts[\"recipe\"] = recipe_counts[\"recipe\"].transform(lambda s: s.split(\".\")[-1])\n",
57
- "\n",
58
- "# sort recipe_counts by count\n",
59
- "recipe_counts = recipe_counts.sort_values(by=[\"count\"], ascending=False)\n",
60
- "\n",
61
- "count_threshold_int = int(count_threshold)\n",
62
- "\n",
63
- "if count_threshold_int > 0:\n",
64
- " recipe_counts = recipe_counts[recipe_counts[\"count\"] > count_threshold_int]"
65
- ]
66
- },
67
- {
68
- "cell_type": "code",
69
- "execution_count": null,
70
- "metadata": {},
71
- "outputs": [],
72
- "source": [
73
- "import plotly.graph_objects as go\n",
74
- "\n",
75
- "# Extract all unique nodes (parent and child recipes)\n",
76
- "all_nodes = list(set(recipe_counts[\"parentRecipe\"]).union(set(recipe_counts[\"recipe\"])))\n",
77
- "\n",
78
- "# Create node indices mapping for preparing for plotly\n",
79
- "node_indices = {node: i for i, node in enumerate(all_nodes)}\n",
80
- "\n",
81
- "# iterates over each row in recipe_counts and find the index of the 'parentRecipe' in node_indices and adds it to the source list.\n",
82
- "source = [node_indices[row[\"parentRecipe\"]] for _, row in recipe_counts.iterrows()]\n",
83
- "\n",
84
- "# iterates over each row in recipe_counts and find the index of the 'recipe' in node_indices and adds it to the target list.\n",
85
- "target = [node_indices[row[\"recipe\"]] for _, row in recipe_counts.iterrows()]\n",
86
- "\n",
87
- "# convert the 'count' column to a list\n",
88
- "value = list(recipe_counts[\"count\"])\n",
89
- "\n",
90
- "# Format labels with node names and counts\n",
91
- "\n",
92
- "\n",
93
- "def getCount(node):\n",
94
- " left = recipe_counts[recipe_counts[\"recipe\"] == node][\"count\"].sum()\n",
95
- " if left == 0:\n",
96
- " return recipe_counts[recipe_counts[\"parentRecipe\"] == node][\"count\"].sum()\n",
97
- " else:\n",
98
- " return left\n",
99
- "\n",
100
- "\n",
101
- "formatted_labels = [f\"{node} - {getCount(node)}\" for node in all_nodes]\n",
102
- "\n",
103
- "# Create the Sankey diagram\n",
104
- "fig = go.Figure(\n",
105
- " data=[\n",
106
- " go.Sankey(\n",
107
- " node=dict(\n",
108
- " pad=15,\n",
109
- " thickness=15,\n",
110
- " line=dict(color=\"black\", width=0.5),\n",
111
- " label=formatted_labels,\n",
112
- " ),\n",
113
- " link=dict(\n",
114
- " source=source,\n",
115
- " target=target,\n",
116
- " value=value,\n",
117
- " ),\n",
118
- " )\n",
119
- " ]\n",
120
- ")\n",
121
- "\n",
122
- "# Update layout\n",
123
- "fig.update_layout(\n",
124
- " title_text=\"Recipes that made changes\",\n",
125
- " font_size=10,\n",
126
- " height=max(len(all_nodes) * 15, 400),\n",
127
- ")\n",
128
- "\n",
129
- "fig.show()"
130
- ]
131
- }
132
- ],
133
- "metadata": {
134
- "kernelspec": {
135
- "display_name": "Python 3",
136
- "language": "python",
137
- "name": "python3"
138
- },
139
- "language_info": {
140
- "codemirror_mode": {
141
- "name": "ipython",
142
- "version": 3
143
- },
144
- "file_extension": ".py",
145
- "mimetype": "text/x-python",
146
- "name": "python",
147
- "nbconvert_exporter": "python",
148
- "pygments_lexer": "ipython3",
149
- "version": "3.11.4"
150
- }
151
- },
152
- "nbformat": 4,
153
- "nbformat_minor": 2
165
+ "nbformat": 4,
166
+ "nbformat_minor": 2
154
167
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moderne_visualizations_misc
3
- Version: 0.59.0
3
+ Version: 0.60.0
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=Lz_7EiJa2wN5Vriu7uNS3omHp85-uvay1C_YyIc482A,2003
7
7
  moderne_visualizations_misc/comment_language_distribution.ipynb,sha256=39NdfUH5NIX36918ogQnr9mn0ZYgrfpMMARNJTXFMWc,3189
8
- moderne_visualizations_misc/composite_recipe_results_sankey.ipynb,sha256=2EmrQI9Rkzj2i1JEN3Ru7OJb8_wAcbV-hzw5XpeEc2c,4837
8
+ moderne_visualizations_misc/composite_recipe_results_sankey.ipynb,sha256=az_oHI4G5x8BDlSp7Z9-NcXBmuwCWJdYODhXXa8u6so,6013
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
@@ -102,6 +102,9 @@ moderne_visualizations_misc/images/dependency_vulnerabilities.300.png,sha256=X-R
102
102
  moderne_visualizations_misc/images/dependency_vulnerabilities_npm.300.png,sha256=X-RA8xCuZsugGa_jRZ5CtqnYGOXHoUiVUZ9mdSi8WZ0,9057
103
103
  moderne_visualizations_misc/images/eslint_problems.300.png,sha256=nvNP7Ve_BYQHKuN-C5AhHfyI7w2nyH5zI9ntC65VLYo,44585
104
104
  moderne_visualizations_misc/images/eslint_problems_by_repo.300.png,sha256=ak6Lz8N5mfogtogvIujHzPTcx16A7WXbmWDUYHkLCBQ,41184
105
+ moderne_visualizations_misc/images/find_methods.300.png,sha256=ElPAwEsCZFCaq3SyE6xyN5BfEihwyxx_AQ4VyVzEjRg,58340
106
+ moderne_visualizations_misc/images/find_methods_ai.300.png,sha256=ElPAwEsCZFCaq3SyE6xyN5BfEihwyxx_AQ4VyVzEjRg,58340
107
+ moderne_visualizations_misc/images/find_methods_ai_generate_yaml.300.png,sha256=LMwCeltTKmWfINvZCR-CmAvx2_9Eb6Zc7DP8fRzhEKA,96224
105
108
  moderne_visualizations_misc/images/github_secrets_in_use.300.png,sha256=gjv-BC8srD6kIE0lUb5i_L09aZ012A1yk-g41fOxNp0,32570
106
109
  moderne_visualizations_misc/images/gradle_wrappers.300.png,sha256=sp9oqHnrYuz8-ncI2172tJSwPO6kJ39sHa7VW8tV_Vw,9452
107
110
  moderne_visualizations_misc/images/language_composition.300.png,sha256=rg-5g2TgR2hDYtJS_tn-MKCl3g3NRBQVkusWVmJS0Rc,9855
@@ -181,7 +184,7 @@ moderne_visualizations_misc/specs/spring_component_relationships_data_grid.yml,s
181
184
  moderne_visualizations_misc/specs/spring_components_data_grid.yml,sha256=nRLXX3t2sw4gFIVdt7wEE1O8vVcr0qWx1aqIZpoFghc,323
182
185
  moderne_visualizations_misc/specs/sql_crud.yml,sha256=BaUV1bb3oJNrNARU-0YAez2S2yW8djqNUvRSY6rfmTk,533
183
186
  moderne_visualizations_misc/specs/text_matches_tree_grid.yml,sha256=U2-j_kFaHNex5avmPtzw_6AWUs9JKk_ouCyqdJBThp4,903
184
- moderne_visualizations_misc-0.59.0.dist-info/METADATA,sha256=D7NHsMaqvbY2yrjcwiaL9RH_Uc5wAPQh4RZJ1yx3Ols,1010
185
- moderne_visualizations_misc-0.59.0.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
186
- moderne_visualizations_misc-0.59.0.dist-info/top_level.txt,sha256=V_gviHcBSH6w_h-g98-9ecQRoN8d82cxPdV-DA3Leeo,28
187
- moderne_visualizations_misc-0.59.0.dist-info/RECORD,,
187
+ moderne_visualizations_misc-0.60.0.dist-info/METADATA,sha256=AAhAGDr5_fI2gD3-fnEHlmLR7nMH-KQhP68fgWkrWfE,1010
188
+ moderne_visualizations_misc-0.60.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
189
+ moderne_visualizations_misc-0.60.0.dist-info/top_level.txt,sha256=V_gviHcBSH6w_h-g98-9ecQRoN8d82cxPdV-DA3Leeo,28
190
+ moderne_visualizations_misc-0.60.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.2.0)
2
+ Generator: setuptools (73.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5