diff --git a/moderne_visualizations_misc/cobol_relationships.ipynb b/moderne_visualizations_misc/cobol_relationships.ipynb
index 28fd2d0..83e64c4 100644
--- a/moderne_visualizations_misc/cobol_relationships.ipynb
+++ b/moderne_visualizations_misc/cobol_relationships.ipynb
@@ -8,7 +8,9 @@
"outputs": [],
"source": [
"import graphviz\n",
+ "import re\n",
"from code_data_science import data_table as dt\n",
+ "import code_data_science.palette as palette\n",
"\n",
"df = dt.read_csv('../samples/cobol_relationships.csv')"
]
@@ -29,14 +31,31 @@
"graphviz.set_default_engine('sfdp')\n",
"dot = graphviz.Digraph('cobol-relationships', comment='COBOL relationships')\n",
"\n",
- "def style_node(value):\n",
- " if value == 'true': \n",
- " return 'red'\n",
+ "# clean dependent field remove all content up to first slash\n",
+ "df['dependent'] = df['dependent'].apply(lambda x: re.sub(r'^.*\\/', \"\", x))\n",
+ "\n",
+ "\n",
+ "def style_node(isMissing, dependencyType):\n",
+ " if isMissing == 'true': \n",
+ " return palette.__moderneColorMap['red'][200]\n",
+ " if dependencyType == 'COBOL':\n",
+ " return palette.__moderneColorMap['blue'][400]\n",
+ " if dependencyType == 'COPYBOOK':\n",
+ " return palette.__moderneColorMap['blue'][200]\n",
+ " if dependencyType == 'LINKEDIT':\n",
+ " return palette.__moderneColorMap['yellow'][200]\n",
+ " if dependencyType == 'BINDPACKAGE':\n",
+ " return palette.__moderneColorMap['green'][200]\n",
+ " if dependencyType == 'BINDPLAN':\n",
+ " return palette.__moderneColorMap['green'][400]\n",
" return 'white'\n",
"\n",
+ "def addAnnotation(value, docType):\n",
+ " return f'<{value}
({docType})>'\n",
+ "\n",
"def map_relationship(row):\n",
- " dot.node(row['dependent'])\n",
- " dot.node(row['dependency'], style='filled', fillcolor=style_node(row['dependencyMissing']))\n",
+ " dot.node(row['dependent'], label=addAnnotation(row['dependent'], row['dependentType']), style='filled', fillcolor=style_node(row['dependencyMissing'], row['dependentType']))\n",
+ " dot.node(row['dependency'], label=addAnnotation(row['dependency'], row['dependencyType']), style='filled', fillcolor=style_node(row['dependencyMissing'], row['dependencyType']))\n",
" dot.edge(row['dependent'], row['dependency'], row['action'])\n",
"\n",
"df.apply(map_relationship, axis=1)\n",
@@ -61,7 +80,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.17"
+ "version": "3.11.4"
}
},
"nbformat": 4,