Spaces:
Running
Running
Update network_graph_generator.py
Browse files- network_graph_generator.py +34 -38
network_graph_generator.py
CHANGED
|
@@ -14,46 +14,42 @@ def generate_network_graph(json_input: str, output_format: str) -> str:
|
|
| 14 |
Expected JSON Format Example:
|
| 15 |
{
|
| 16 |
"nodes": [
|
| 17 |
-
{
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
},
|
| 22 |
-
{
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
},
|
| 27 |
-
{
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
},
|
| 32 |
-
{
|
| 33 |
-
|
| 34 |
-
"label": "API Service",
|
| 35 |
-
"type": "service"
|
| 36 |
-
}
|
| 37 |
],
|
| 38 |
"connections": [
|
| 39 |
-
{
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
},
|
| 45 |
-
{
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
},
|
| 51 |
-
{
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
}
|
| 57 |
]
|
| 58 |
}
|
| 59 |
|
|
|
|
| 14 |
Expected JSON Format Example:
|
| 15 |
{
|
| 16 |
"nodes": [
|
| 17 |
+
{"id": "customers", "label": "Customers", "type": "user"},
|
| 18 |
+
{"id": "sellers", "label": "Sellers", "type": "user"},
|
| 19 |
+
{"id": "admin", "label": "Admin", "type": "user"},
|
| 20 |
+
{"id": "web_frontend", "label": "Web Frontend", "type": "server"},
|
| 21 |
+
{"id": "product_service", "label": "Product Service", "type": "service"},
|
| 22 |
+
{"id": "cart_service", "label": "Cart Service", "type": "service"},
|
| 23 |
+
{"id": "order_service", "label": "Order Service", "type": "service"},
|
| 24 |
+
{"id": "payment_service", "label": "Payment Service", "type": "service"},
|
| 25 |
+
{"id": "inventory_tracker", "label": "Inventory Tracker", "type": "service"},
|
| 26 |
+
{"id": "review_system", "label": "Review System", "type": "service"},
|
| 27 |
+
{"id": "email_sender", "label": "Email Sender", "type": "service"},
|
| 28 |
+
{"id": "image_uploader", "label": "Image Uploader", "type": "service"},
|
| 29 |
+
{"id": "product_db", "label": "Product Database", "type": "database"},
|
| 30 |
+
{"id": "user_db", "label": "User Database", "type": "database"},
|
| 31 |
+
{"id": "order_db", "label": "Order Database", "type": "database"},
|
| 32 |
+
{"id": "image_storage", "label": "Image Storage", "type": "database"},
|
| 33 |
+
{"id": "stripe_api", "label": "Stripe API", "type": "service"}
|
|
|
|
|
|
|
|
|
|
| 34 |
],
|
| 35 |
"connections": [
|
| 36 |
+
{"from": "customers", "to": "web_frontend", "label": "Browse", "weight": 5},
|
| 37 |
+
{"from": "sellers", "to": "web_frontend", "label": "Manage Store", "weight": 3},
|
| 38 |
+
{"from": "admin", "to": "web_frontend", "label": "Admin Panel", "weight": 2},
|
| 39 |
+
{"from": "web_frontend", "to": "product_service", "label": "Get Products", "weight": 4},
|
| 40 |
+
{"from": "web_frontend", "to": "cart_service", "label": "Cart Actions", "weight": 4},
|
| 41 |
+
{"from": "web_frontend", "to": "order_service", "label": "Place Order", "weight": 3},
|
| 42 |
+
{"from": "product_service", "to": "product_db", "label": "Product Data", "weight": 4},
|
| 43 |
+
{"from": "product_service", "to": "review_system", "label": "Product Reviews", "weight": 2},
|
| 44 |
+
{"from": "cart_service", "to": "inventory_tracker", "label": "Check Stock", "weight": 3},
|
| 45 |
+
{"from": "order_service", "to": "order_db", "label": "Store Order", "weight": 4},
|
| 46 |
+
{"from": "order_service", "to": "payment_service", "label": "Process Payment", "weight": 4},
|
| 47 |
+
{"from": "order_service", "to": "email_sender", "label": "Order Confirmation", "weight": 2},
|
| 48 |
+
{"from": "payment_service", "to": "stripe_api", "label": "Charge Card", "weight": 4},
|
| 49 |
+
{"from": "inventory_tracker", "to": "product_db", "label": "Update Stock", "weight": 3},
|
| 50 |
+
{"from": "review_system", "to": "user_db", "label": "User Reviews", "weight": 2},
|
| 51 |
+
{"from": "sellers", "to": "image_uploader", "label": "Upload Images", "weight": 2},
|
| 52 |
+
{"from": "image_uploader", "to": "image_storage", "label": "Store Images", "weight": 3}
|
|
|
|
| 53 |
]
|
| 54 |
}
|
| 55 |
|