Graphify / sample_data.py
ZahirJS's picture
Update sample_data.py
1120e3c verified
CONCEPT_MAP_JSON = """
{
"central_node": "Artificial Intelligence (AI)",
"nodes": [
{
"id": "ml_fundamental",
"label": "Machine Learning",
"relationship": "is essential for",
"subnodes": [
{
"id": "dl_branch",
"label": "Deep Learning",
"relationship": "for example",
"subnodes": [
{
"id": "cnn_example",
"label": "CNNs",
"relationship": "for example"
},
{
"id": "rnn_example",
"label": "RNNs",
"relationship": "for example"
}
]
},
{
"id": "rl_branch",
"label": "Reinforcement Learning",
"relationship": "for example",
"subnodes": [
{
"id": "qlearning_example",
"label": "Q-Learning",
"relationship": "example"
},
{
"id": "pg_example",
"label": "Policy Gradients",
"relationship": "example"
}
]
}
]
},
{
"id": "ai_types",
"label": "Types",
"relationship": "formed by",
"subnodes": [
{
"id": "agi_type",
"label": "AGI",
"relationship": "this is",
"subnodes": [
{
"id": "strong_ai",
"label": "Strong AI",
"relationship": "provoked by",
"subnodes": [
{
"id": "human_intel",
"label": "Human-level Intel.",
"relationship": "of"
}
]
}
]
},
{
"id": "ani_type",
"label": "ANI",
"relationship": "this is",
"subnodes": [
{
"id": "weak_ai",
"label": "Weak AI",
"relationship": "provoked by",
"subnodes": [
{
"id": "narrow_tasks",
"label": "Narrow Tasks",
"relationship": "of"
}
]
}
]
}
]
},
{
"id": "ai_capabilities",
"label": "Capabilities",
"relationship": "change",
"subnodes": [
{
"id": "data_proc",
"label": "Data Processing",
"relationship": "can",
"subnodes": [
{
"id": "big_data",
"label": "Big Data",
"relationship": "as",
"subnodes": [
{
"id": "analysis_example",
"label": "Data Analysis",
"relationship": "example"
},
{
"id": "prediction_example",
"label": "Prediction",
"relationship": "example"
}
]
}
]
},
{
"id": "decision_making",
"label": "Decision Making",
"relationship": "can be",
"subnodes": [
{
"id": "automation",
"label": "Automation",
"relationship": "as",
"subnodes": [
{
"id": "robotics_example",
"label": "Robotics",
"relationship": "Example"},
{
"id": "autonomous_example",
"label": "Autonomous Vehicles",
"relationship": "of one"
}
]
}
]
},
{
"id": "problem_solving",
"label": "Problem Solving",
"relationship": "can",
"subnodes": [
{
"id": "optimization",
"label": "Optimization",
"relationship": "as is",
"subnodes": [
{
"id": "algorithms_example",
"label": "Algorithms",
"relationship": "for example"
}
]
}
]
}
]
}
]
}
"""
SYNOPTIC_CHART_JSON = """
{
"central_node": "AI Project Lifecycle",
"nodes": [
{
"id": "phase1",
"label": "I. Problem Definition & Data Acquisition",
"relationship": "Starts with",
"subnodes": [
{
"id": "sub1_1",
"label": "1. Problem Formulation",
"relationship": "Involves",
"subnodes": [
{"id": "sub1_1_1", "label": "1.1. Identify Business Need", "relationship": "e.g."},
{"id": "sub1_1_2", "label": "1.2. Define KPIs", "relationship": "e.g."}
]
},
{
"id": "sub1_2",
"label": "2. Data Collection",
"relationship": "Followed by",
"subnodes": [
{"id": "sub1_2_1", "label": "2.1. Source Data", "relationship": "from"},
{"id": "sub1_2_2", "label": "2.2. Data Cleaning", "relationship": "includes"}
]
}
]
},
{
"id": "phase2",
"label": "II. Model Development",
"relationship": "Proceeds to",
"subnodes": [
{
"id": "sub2_1",
"label": "1. Feature Engineering",
"relationship": "Comprises",
"subnodes": [
{"id": "sub2_1_1", "label": "1.1. Feature Selection", "relationship": "e.g."},
{"id": "sub2_1_2", "label": "1.2. Feature Transformation", "relationship": "e.g."}
]
},
{
"id": "sub2_2",
"label": "2. Model Training",
"relationship": "Involves",
"subnodes": [
{"id": "sub2_2_1", "label": "2.1. Algorithm Selection", "relationship": "uses"},
{"id": "sub2_2_2", "label": "2.2. Hyperparameter Tuning", "relationship": "optimizes"}
]
}
]
},
{
"id": "phase3",
"label": "III. Evaluation & Deployment",
"relationship": "Culminates in",
"subnodes": [
{
"id": "sub3_1",
"label": "1. Model Evaluation",
"relationship": "Includes",
"subnodes": [
{"id": "sub3_1_1", "label": "1.1. Performance Metrics", "relationship": "measures"},
{"id": "sub3_1_2", "label": "1.2. Bias & Fairness Audits", "relationship": "ensures"}
]
},
{
"id": "sub3_2",
"label": "2. Deployment & Monitoring",
"relationship": "Requires",
"subnodes": [
{"id": "sub3_2_1", "label": "2.1. API/Integration Development", "relationship": "for"},
{"id": "sub3_2_2", "label": "2.2. Continuous Monitoring", "relationship": "ensures"}
]
}
]
}
]
}
"""
RADIAL_DIAGRAM_JSON = """
{
"central_node": "AI Core Concepts & Domains",
"nodes": [
{
"id": "foundational_ml",
"label": "Foundational ML",
"relationship": "builds on",
"subnodes": [
{"id": "supervised_l", "label": "Supervised Learning", "relationship": "e.g."},
{"id": "unsupervised_l", "label": "Unsupervised Learning", "relationship": "e.g."}
]
},
{
"id": "dl_architectures",
"label": "Deep Learning Arch.",
"relationship": "evolved from",
"subnodes": [
{"id": "cnns_rad", "label": "CNNs", "relationship": "e.g."},
{"id": "rnns_rad", "label": "RNNs", "relationship": "e.g."}
]
},
{
"id": "major_applications",
"label": "Major AI Applications",
"relationship": "applied in",
"subnodes": [
{"id": "nlp_rad", "label": "Natural Language Processing", "relationship": "e.g."},
{"id": "cv_rad", "label": "Computer Vision", "relationship": "e.g."}
]
},
{
"id": "ethical_concerns",
"label": "Ethical AI Concerns",
"relationship": "addresses",
"subnodes": [
{"id": "fairness_rad", "label": "Fairness & Bias", "relationship": "e.g."},
{"id": "explainability", "label": "Explainability (XAI)", "relationship": "e.g."}
]
},
{
"id": "future_trends",
"label": "Future AI Trends",
"relationship": "looking at",
"subnodes": [
{"id": "agi_future", "label": "AGI Development", "relationship": "e.g."},
{"id": "quantum_ai", "label": "Quantum AI", "relationship": "e.g."}
]
}
]
}
"""
PROCESS_FLOW_JSON = """
{
"start_node": "Start Inference Request",
"nodes": [
{
"id": "user_input",
"label": "Receive User Input (Data)",
"type": "io"
},
{
"id": "preprocess_data",
"label": "Preprocess Data",
"type": "process"
},
{
"id": "validate_data",
"label": "Validate Data Format/Type",
"type": "decision"
},
{
"id": "data_valid_yes",
"label": "Data Valid?",
"type": "decision"
},
{
"id": "load_model",
"label": "Load AI Model (if not cached)",
"type": "process"
},
{
"id": "run_inference",
"label": "Run AI Model Inference",
"type": "process"
},
{
"id": "postprocess_output",
"label": "Postprocess Model Output",
"type": "process"
},
{
"id": "send_response",
"label": "Send Response to User",
"type": "io"
},
{
"id": "log_error",
"label": "Log Error & Notify User",
"type": "process"
},
{
"id": "end_inference_process",
"label": "End Inference Process",
"type": "end"
}
],
"connections": [
{"from": "start_node", "to": "user_input", "label": "Request"},
{"from": "user_input", "to": "preprocess_data", "label": "Data Received"},
{"from": "preprocess_data", "to": "validate_data", "label": "Cleaned"},
{"from": "validate_data", "to": "data_valid_yes", "label": "Check"},
{"from": "data_valid_yes", "to": "load_model", "label": "Yes"},
{"from": "data_valid_yes", "to": "log_error", "label": "No"},
{"from": "load_model", "to": "run_inference", "label": "Model Ready"},
{"from": "run_inference", "to": "postprocess_output", "label": "Output Generated"},
{"from": "postprocess_output", "to": "send_response", "label": "Ready"},
{"from": "send_response", "to": "end_inference_process", "label": "Response Sent"},
{"from": "log_error", "to": "end_inference_process", "label": "Error Handled"}
]
}
"""
WBS_DIAGRAM_JSON = """
{
"project_title": "AI Model Development Project",
"phases": [
{
"id": "phase_prep",
"label": "Preparation",
"tasks": [
{
"id": "task_1_1_vision",
"label": "Identify Vision",
"subtasks": [
{
"id": "subtask_1_1_1_design_staff",
"label": "Design & Staffing",
"sub_subtasks": [
{
"id": "ss_task_1_1_1_1_env_setup",
"label": "Environment Setup",
"sub_sub_subtasks": [
{
"id": "sss_task_1_1_1_1_1_lib_install",
"label": "Install Libraries",
"final_level_tasks": [
{"id": "ft_1_1_1_1_1_1_data_access", "label": "Grant Data Access"}
]
}
]
}
]
}
]
}
]
},
{
"id": "phase_plan",
"label": "Planning",
"tasks": [
{
"id": "task_2_1_cost_analysis",
"label": "Cost Analysis",
"subtasks": [
{
"id": "subtask_2_1_1_benefit_analysis",
"label": "Benefit Analysis",
"sub_subtasks": [
{
"id": "ss_task_2_1_1_1_risk_assess",
"label": "AI Risk Assessment",
"sub_sub_subtasks": [
{
"id": "sss_task_2_1_1_1_1_model_selection",
"label": "Model Selection",
"final_level_tasks": [
{"id": "ft_2_1_1_1_1_1_data_strategy", "label": "Data Strategy"}
]
}
]
}
]
}
]
}
]
},
{
"id": "phase_dev",
"label": "Development",
"tasks": [
{
"id": "task_3_1_change_mgmt",
"label": "Data Preprocessing",
"subtasks": [
{
"id": "subtask_3_1_1_implementation",
"label": "Feature Engineering",
"sub_subtasks": [
{
"id": "ss_task_3_1_1_1_beta_testing",
"label": "Model Training",
"sub_sub_subtasks": [
{
"id": "sss_task_3_1_1_1_1_other_task",
"label": "Model Evaluation",
"final_level_tasks": [
{"id": "ft_3_1_1_1_1_1_hyperparam_tune", "label": "Hyperparameter Tuning"}
]
}
]
}
]
}
]
}
]
}
]
}
"""
CONCEPT_MAP_JSON = """
{
"central_node": "Artificial Intelligence (AI)",
"nodes": [
{
"id": "ml_fundamental",
"label": "Machine Learning",
"relationship": "is essential for",
"subnodes": [
{
"id": "dl_branch",
"label": "Deep Learning",
"relationship": "for example",
"subnodes": [
{
"id": "cnn_example",
"label": "CNNs",
"relationship": "for example"
},
{
"id": "rnn_example",
"label": "RNNs",
"relationship": "for example"
}
]
},
{
"id": "rl_branch",
"label": "Reinforcement Learning",
"relationship": "for example",
"subnodes": [
{
"id": "qlearning_example",
"label": "Q-Learning",
"relationship": "example"
},
{
"id": "pg_example",
"label": "Policy Gradients",
"relationship": "example"
}
]
}
]
},
{
"id": "ai_types",
"label": "Types",
"relationship": "formed by",
"subnodes": [
{
"id": "agi_type",
"label": "AGI",
"relationship": "this is",
"subnodes": [
{
"id": "strong_ai",
"label": "Strong AI",
"relationship": "provoked by",
"subnodes": [
{
"id": "human_intel",
"label": "Human-level Intel.",
"relationship": "of"
}
]
}
]
},
{
"id": "ani_type",
"label": "ANI",
"relationship": "this is",
"subnodes": [
{
"id": "weak_ai",
"label": "Weak AI",
"relationship": "provoked by",
"subnodes": [
{
"id": "narrow_tasks",
"label": "Narrow Tasks",
"relationship": "of"
}
]
}
]
}
]
},
{
"id": "ai_capabilities",
"label": "Capabilities",
"relationship": "change",
"subnodes": [
{
"id": "data_proc",
"label": "Data Processing",
"relationship": "can",
"subnodes": [
{
"id": "big_data",
"label": "Big Data",
"relationship": "as",
"subnodes": [
{
"id": "analysis_example",
"label": "Data Analysis",
"relationship": "example"
},
{
"id": "prediction_example",
"label": "Prediction",
"relationship": "example"
}
]
}
]
},
{
"id": "decision_making",
"label": "Decision Making",
"relationship": "can be",
"subnodes": [
{
"id": "automation",
"label": "Automation",
"relationship": "as",
"subnodes": [
{
"id": "robotics_example",
"label": "Robotics",
"relationship": "Example"},
{
"id": "autonomous_example",
"label": "Autonomous Vehicles",
"relationship": "of one"
}
]
}
]
},
{
"id": "problem_solving",
"label": "Problem Solving",
"relationship": "can",
"subnodes": [
{
"id": "optimization",
"label": "Optimization",
"relationship": "as is",
"subnodes": [
{
"id": "algorithms_example",
"label": "Algorithms",
"relationship": "for example"
}
]
}
]
}
]
}
]
}
"""
# JSON for Synoptic Chart (horizontal hierarchy) - AI related, 4 levels
SYNOPTIC_CHART_JSON = """
{
"central_node": "AI Project Lifecycle",
"nodes": [
{
"id": "phase1",
"label": "I. Problem Definition & Data Acquisition",
"relationship": "Starts with",
"subnodes": [
{
"id": "sub1_1",
"label": "1. Problem Formulation",
"relationship": "Involves",
"subnodes": [
{"id": "sub1_1_1", "label": "1.1. Identify Business Need", "relationship": "e.g."},
{"id": "sub1_1_2", "label": "1.2. Define KPIs", "relationship": "e.g."}
]
},
{
"id": "sub1_2",
"label": "2. Data Collection",
"relationship": "Followed by",
"subnodes": [
{"id": "sub1_2_1", "label": "2.1. Source Data", "relationship": "from"},
{"id": "sub1_2_2", "label": "2.2. Data Cleaning", "relationship": "includes"}
]
}
]
},
{
"id": "phase2",
"label": "II. Model Development",
"relationship": "Proceeds to",
"subnodes": [
{
"id": "sub2_1",
"label": "1. Feature Engineering",
"relationship": "Comprises",
"subnodes": [
{"id": "sub2_1_1", "label": "1.1. Feature Selection", "relationship": "e.g."},
{"id": "sub2_1_2", "label": "1.2. Feature Transformation", "relationship": "e.g."}
]
},
{
"id": "sub2_2",
"label": "2. Model Training",
"relationship": "Involves",
"subnodes": [
{"id": "sub2_2_1", "label": "2.1. Algorithm Selection", "relationship": "uses"},
{"id": "sub2_2_2", "label": "2.2. Hyperparameter Tuning", "relationship": "optimizes"}
]
}
]
},
{
"id": "phase3",
"label": "III. Evaluation & Deployment",
"relationship": "Culminates in",
"subnodes": [
{
"id": "sub3_1",
"label": "1. Model Evaluation",
"relationship": "Includes",
"subnodes": [
{"id": "sub3_1_1", "label": "1.1. Performance Metrics", "relationship": "measures"},
{"id": "sub3_1_2", "label": "1.2. Bias & Fairness Audits", "relationship": "ensures"}
]
},
{
"id": "sub3_2",
"label": "2. Deployment & Monitoring",
"relationship": "Requires",
"subnodes": [
{"id": "sub3_2_1", "label": "2.1. API/Integration Development", "relationship": "for"},
{"id": "sub3_2_2", "label": "2.2. Continuous Monitoring", "relationship": "ensures"}
]
}
]
}
]
}
"""
# JSON for Radial Diagram (central expansion) - AI related, 3 levels with 5->10 structure
RADIAL_DIAGRAM_JSON = """
{
"central_node": "AI Core Concepts & Domains",
"nodes": [
{
"id": "foundational_ml",
"label": "Foundational ML",
"relationship": "builds on",
"subnodes": [
{"id": "supervised_l", "label": "Supervised Learning", "relationship": "e.g."},
{"id": "unsupervised_l", "label": "Unsupervised Learning", "relationship": "e.g."}
]
},
{
"id": "dl_architectures",
"label": "Deep Learning Arch.",
"relationship": "evolved from",
"subnodes": [
{"id": "cnns_rad", "label": "CNNs", "relationship": "e.g."},
{"id": "rnns_rad", "label": "RNNs", "relationship": "e.g."}
]
},
{
"id": "major_applications",
"label": "Major AI Applications",
"relationship": "applied in",
"subnodes": [
{"id": "nlp_rad", "label": "Natural Language Processing", "relationship": "e.g."},
{"id": "cv_rad", "label": "Computer Vision", "relationship": "e.g."}
]
},
{
"id": "ethical_concerns",
"label": "Ethical AI Concerns",
"relationship": "addresses",
"subnodes": [
{"id": "fairness_rad", "label": "Fairness & Bias", "relationship": "e.g."},
{"id": "explainability", "label": "Explainability (XAI)", "relationship": "e.g."}
]
},
{
"id": "future_trends",
"label": "Future AI Trends",
"relationship": "looking at",
"subnodes": [
{"id": "agi_future", "label": "AGI Development", "relationship": "e.g."},
{"id": "quantum_ai", "label": "Quantum AI", "relationship": "e.g."}
]
}
]
}
"""
PROCESS_FLOW_JSON = """
{
"start_node": "Start Inference Request",
"nodes": [
{
"id": "user_input",
"label": "Receive User Input (Data)",
"type": "io"
},
{
"id": "preprocess_data",
"label": "Preprocess Data",
"type": "process"
},
{
"id": "validate_data",
"label": "Validate Data Format/Type",
"type": "decision"
},
{
"id": "data_valid_yes",
"label": "Data Valid?",
"type": "decision"
},
{
"id": "load_model",
"label": "Load AI Model (if not cached)",
"type": "process"
},
{
"id": "run_inference",
"label": "Run AI Model Inference",
"type": "process"
},
{
"id": "postprocess_output",
"label": "Postprocess Model Output",
"type": "process"
},
{
"id": "send_response",
"label": "Send Response to User",
"type": "io"
},
{
"id": "log_error",
"label": "Log Error & Notify User",
"type": "process"
},
{
"id": "end_inference_process",
"label": "End Inference Process",
"type": "end"
}
],
"connections": [
{"from": "start_node", "to": "user_input", "label": "Request"},
{"from": "user_input", "to": "preprocess_data", "label": "Data Received"},
{"from": "preprocess_data", "to": "validate_data", "label": "Cleaned"},
{"from": "validate_data", "to": "data_valid_yes", "label": "Check"},
{"from": "data_valid_yes", "to": "load_model", "label": "Yes"},
{"from": "data_valid_yes", "to": "log_error", "label": "No"},
{"from": "load_model", "to": "run_inference", "label": "Model Ready"},
{"from": "run_inference", "to": "postprocess_output", "label": "Output Generated"},
{"from": "postprocess_output", "to": "send_response", "label": "Ready"},
{"from": "send_response", "to": "end_inference_process", "label": "Response Sent"},
{"from": "log_error", "to": "end_inference_process", "label": "Error Handled"}
]
}
"""
# New JSON for Work Breakdown Structure (WBS) Diagram - similar to image, but not identical
WBS_DIAGRAM_JSON = """
{
"project_title": "AI Model Development Project",
"phases": [
{
"id": "phase_prep",
"label": "Preparation",
"tasks": [
{
"id": "task_1_1_vision",
"label": "Identify Vision",
"subtasks": [
{
"id": "subtask_1_1_1_design_staff",
"label": "Design & Staffing",
"sub_subtasks": [
{
"id": "ss_task_1_1_1_1_env_setup",
"label": "Environment Setup",
"sub_sub_subtasks": [
{
"id": "sss_task_1_1_1_1_1_lib_install",
"label": "Install Libraries",
"final_level_tasks": [
{"id": "ft_1_1_1_1_1_1_data_access", "label": "Grant Data Access"}
]
}
]
}
]
}
]
}
]
},
{
"id": "phase_plan",
"label": "Planning",
"tasks": [
{
"id": "task_2_1_cost_analysis",
"label": "Cost Analysis",
"subtasks": [
{
"id": "subtask_2_1_1_benefit_analysis",
"label": "Benefit Analysis",
"sub_subtasks": [
{
"id": "ss_task_2_1_1_1_risk_assess",
"label": "AI Risk Assessment",
"sub_sub_subtasks": [
{
"id": "sss_task_2_1_1_1_1_model_selection",
"label": "Model Selection",
"final_level_tasks": [
{"id": "ft_2_1_1_1_1_1_data_strategy", "label": "Data Strategy"}
]
}
]
}
]
}
]
}
]
},
{
"id": "phase_dev",
"label": "Development",
"tasks": [
{
"id": "task_3_1_change_mgmt",
"label": "Data Preprocessing",
"subtasks": [
{
"id": "subtask_3_1_1_implementation",
"label": "Feature Engineering",
"sub_subtasks": [
{
"id": "ss_task_3_1_1_1_beta_testing",
"label": "Model Training",
"sub_sub_subtasks": [
{
"id": "sss_task_3_1_1_1_1_other_task",
"label": "Model Evaluation",
"final_level_tasks": [
{"id": "ft_3_1_1_1_1_1_hyperparam_tune", "label": "Hyperparameter Tuning"}
]
}
]
}
]
}
]
}
]
}
]
}
"""
# JSON for Timeline Diagram
TIMELINE_JSON = """
{
"title": "Complete History of Artificial Intelligence",
"events_per_row": 4,
"events": [
{
"id": "event_1",
"label": "AI Concept Birth",
"date": "1943",
"description": "McCulloch & Pitts neural network model"
},
{
"id": "event_2",
"label": "Turing Test",
"date": "1950",
"description": "Alan Turing proposes machine intelligence test"
},
{
"id": "event_3",
"label": "Dartmouth Conference",
"date": "1956",
"description": "Term 'Artificial Intelligence' coined"
},
{
"id": "event_4",
"label": "First AI Program",
"date": "1957",
"description": "General Problem Solver (GPS) created"
},
{
"id": "event_5",
"label": "Perceptron Algorithm",
"date": "1958",
"description": "Frank Rosenblatt develops perceptron"
},
{
"id": "event_6",
"label": "LISP Programming",
"date": "1959",
"description": "John McCarthy creates LISP for AI"
},
{
"id": "event_7",
"label": "Expert Systems",
"date": "1965",
"description": "DENDRAL - first expert system"
},
{
"id": "event_8",
"label": "AI Winter Begins",
"date": "1974",
"description": "Funding cuts due to unmet expectations"
},
{
"id": "event_9",
"label": "Backpropagation",
"date": "1986",
"description": "Algorithm for training neural networks"
},
{
"id": "event_10",
"label": "Deep Blue Victory",
"date": "1997",
"description": "IBM computer defeats chess champion"
},
{
"id": "event_11",
"label": "Machine Learning Boom",
"date": "2000s",
"description": "Support Vector Machines, Random Forests"
},
{
"id": "event_12",
"label": "Deep Learning Revival",
"date": "2006",
"description": "Geoffrey Hinton's deep belief networks"
},
{
"id": "event_13",
"label": "ImageNet Challenge",
"date": "2012",
"description": "AlexNet wins with deep CNN"
},
{
"id": "event_14",
"label": "AlphaGo Triumph",
"date": "2016",
"description": "DeepMind defeats Go world champion"
},
{
"id": "event_15",
"label": "Transformer Architecture",
"date": "2017",
"description": "Attention Is All You Need paper"
},
{
"id": "event_16",
"label": "GPT Era Begins",
"date": "2018-2023",
"description": "Large Language Models revolution"
}
]
}
"""
BINARY_TREE_JSON = """
{
"root": {
"id": "root",
"label": "50",
"left": {
"id": "left_1",
"label": "30",
"left": {
"id": "left_2",
"label": "20",
"left": {
"id": "left_4",
"label": "10"
},
"right": {
"id": "right_4",
"label": "25"
}
},
"right": {
"id": "right_2",
"label": "40",
"left": {
"id": "left_5",
"label": "35"
},
"right": {
"id": "right_5",
"label": "45"
}
}
},
"right": {
"id": "right_1",
"label": "70",
"left": {
"id": "left_3",
"label": "60",
"left": {
"id": "left_6",
"label": "55"
},
"right": {
"id": "right_6",
"label": "65"
}
},
"right": {
"id": "right_3",
"label": "80",
"left": {
"id": "left_7",
"label": "75"
},
"right": {
"id": "right_7",
"label": "90"
}
}
}
}
}
"""
NETWORK_GRAPH_JSON = """
{
"nodes": [
{"id": "customers", "label": "Customers", "type": "user"},
{"id": "sellers", "label": "Sellers", "type": "user"},
{"id": "admin", "label": "Admin", "type": "user"},
{"id": "web_frontend", "label": "Web Frontend", "type": "server"},
{"id": "product_service", "label": "Product Service", "type": "service"},
{"id": "cart_service", "label": "Cart Service", "type": "service"},
{"id": "order_service", "label": "Order Service", "type": "service"},
{"id": "payment_service", "label": "Payment Service", "type": "service"},
{"id": "inventory_tracker", "label": "Inventory Tracker", "type": "service"},
{"id": "review_system", "label": "Review System", "type": "service"},
{"id": "email_sender", "label": "Email Sender", "type": "service"},
{"id": "image_uploader", "label": "Image Uploader", "type": "service"},
{"id": "product_db", "label": "Product Database", "type": "database"},
{"id": "user_db", "label": "User Database", "type": "database"},
{"id": "order_db", "label": "Order Database", "type": "database"},
{"id": "image_storage", "label": "Image Storage", "type": "database"},
{"id": "stripe_api", "label": "Stripe API", "type": "service"}
],
"connections": [
{"from": "customers", "to": "web_frontend", "label": "Browse", "weight": 5},
{"from": "sellers", "to": "web_frontend", "label": "Manage Store", "weight": 3},
{"from": "admin", "to": "web_frontend", "label": "Admin Panel", "weight": 2},
{"from": "web_frontend", "to": "product_service", "label": "Get Products", "weight": 4},
{"from": "web_frontend", "to": "cart_service", "label": "Cart Actions", "weight": 4},
{"from": "web_frontend", "to": "order_service", "label": "Place Order", "weight": 3},
{"from": "product_service", "to": "product_db", "label": "Product Data", "weight": 4},
{"from": "product_service", "to": "review_system", "label": "Product Reviews", "weight": 2},
{"from": "cart_service", "to": "inventory_tracker", "label": "Check Stock", "weight": 3},
{"from": "order_service", "to": "order_db", "label": "Store Order", "weight": 4},
{"from": "order_service", "to": "payment_service", "label": "Process Payment", "weight": 4},
{"from": "order_service", "to": "email_sender", "label": "Order Confirmation", "weight": 2},
{"from": "payment_service", "to": "stripe_api", "label": "Charge Card", "weight": 4},
{"from": "inventory_tracker", "to": "product_db", "label": "Update Stock", "weight": 3},
{"from": "review_system", "to": "user_db", "label": "User Reviews", "weight": 2},
{"from": "sellers", "to": "image_uploader", "label": "Upload Images", "weight": 2},
{"from": "image_uploader", "to": "image_storage", "label": "Store Images", "weight": 3}
]
}
"""
CLASS_DIAGRAM_JSON = """
{
"classes": [
{
"name": "Vehicle",
"type": "abstract",
"attributes": [
{"name": "id", "type": "String", "visibility": "-"},
{"name": "brand", "type": "String", "visibility": "#"},
{"name": "model", "type": "String", "visibility": "#"},
{"name": "year", "type": "int", "visibility": "#"},
{"name": "price", "type": "double", "visibility": "+"},
{"name": "vehicleCount", "type": "int", "visibility": "+", "static": true}
],
"methods": [
{"name": "Vehicle", "parameters": [{"name": "brand", "type": "String"}, {"name": "model", "type": "String"}], "return_type": "Vehicle", "visibility": "+"},
{"name": "startEngine", "return_type": "void", "visibility": "+", "abstract": true},
{"name": "stopEngine", "return_type": "void", "visibility": "+"},
{"name": "getPrice", "return_type": "double", "visibility": "+"},
{"name": "setPrice", "parameters": [{"name": "price", "type": "double"}], "return_type": "void", "visibility": "+"},
{"name": "getTotalVehicles", "return_type": "int", "visibility": "+", "static": true}
]
},
{
"name": "Car",
"type": "class",
"attributes": [
{"name": "doors", "type": "int", "visibility": "-"},
{"name": "transmission", "type": "TransmissionType", "visibility": "-"},
{"name": "fuelType", "type": "FuelType", "visibility": "-"}
],
"methods": [
{"name": "Car", "parameters": [{"name": "brand", "type": "String"}, {"name": "model", "type": "String"}, {"name": "doors", "type": "int"}], "return_type": "Car", "visibility": "+"},
{"name": "startEngine", "return_type": "void", "visibility": "+"},
{"name": "openTrunk", "return_type": "void", "visibility": "+"},
{"name": "getDoors", "return_type": "int", "visibility": "+"},
{"name": "setTransmission", "parameters": [{"name": "transmission", "type": "TransmissionType"}], "return_type": "void", "visibility": "+"}
]
},
{
"name": "Motorcycle",
"type": "class",
"attributes": [
{"name": "engineSize", "type": "int", "visibility": "-"},
{"name": "hasWindshield", "type": "boolean", "visibility": "-"}
],
"methods": [
{"name": "Motorcycle", "parameters": [{"name": "brand", "type": "String"}, {"name": "model", "type": "String"}], "return_type": "Motorcycle", "visibility": "+"},
{"name": "startEngine", "return_type": "void", "visibility": "+"},
{"name": "wheelie", "return_type": "void", "visibility": "+"},
{"name": "getEngineSize", "return_type": "int", "visibility": "+"}
]
},
{
"name": "Engine",
"type": "class",
"attributes": [
{"name": "horsepower", "type": "int", "visibility": "-"},
{"name": "cylinders", "type": "int", "visibility": "-"},
{"name": "fuelType", "type": "FuelType", "visibility": "-"}
],
"methods": [
{"name": "Engine", "parameters": [{"name": "horsepower", "type": "int"}, {"name": "cylinders", "type": "int"}], "return_type": "Engine", "visibility": "+"},
{"name": "start", "return_type": "boolean", "visibility": "+"},
{"name": "stop", "return_type": "void", "visibility": "+"},
{"name": "getHorsepower", "return_type": "int", "visibility": "+"}
]
},
{
"name": "TransmissionType",
"type": "enum",
"attributes": [
{"name": "MANUAL", "type": "TransmissionType", "visibility": "+", "static": true},
{"name": "AUTOMATIC", "type": "TransmissionType", "visibility": "+", "static": true},
{"name": "CVT", "type": "TransmissionType", "visibility": "+", "static": true}
],
"methods": []
},
{
"name": "FuelType",
"type": "enum",
"attributes": [
{"name": "GASOLINE", "type": "FuelType", "visibility": "+", "static": true},
{"name": "DIESEL", "type": "FuelType", "visibility": "+", "static": true},
{"name": "ELECTRIC", "type": "FuelType", "visibility": "+", "static": true},
{"name": "HYBRID", "type": "FuelType", "visibility": "+", "static": true}
],
"methods": []
},
{
"name": "VehicleService",
"type": "interface",
"attributes": [],
"methods": [
{"name": "maintenance", "parameters": [{"name": "vehicle", "type": "Vehicle"}], "return_type": "void", "visibility": "+", "abstract": true},
{"name": "repair", "parameters": [{"name": "vehicle", "type": "Vehicle"}, {"name": "issue", "type": "String"}], "return_type": "boolean", "visibility": "+", "abstract": true},
{"name": "inspectVehicle", "parameters": [{"name": "vehicle", "type": "Vehicle"}], "return_type": "InspectionReport", "visibility": "+", "abstract": true}
]
},
{
"name": "GarageService",
"type": "class",
"attributes": [
{"name": "garageName", "type": "String", "visibility": "-"},
{"name": "location", "type": "String", "visibility": "-"}
],
"methods": [
{"name": "GarageService", "parameters": [{"name": "name", "type": "String"}], "return_type": "GarageService", "visibility": "+"},
{"name": "maintenance", "parameters": [{"name": "vehicle", "type": "Vehicle"}], "return_type": "void", "visibility": "+"},
{"name": "repair", "parameters": [{"name": "vehicle", "type": "Vehicle"}, {"name": "issue", "type": "String"}], "return_type": "boolean", "visibility": "+"},
{"name": "inspectVehicle", "parameters": [{"name": "vehicle", "type": "Vehicle"}], "return_type": "InspectionReport", "visibility": "+"}
]
}
],
"relationships": [
{
"from": "Car",
"to": "Vehicle",
"type": "inheritance"
},
{
"from": "Motorcycle",
"to": "Vehicle",
"type": "inheritance"
},
{
"from": "Car",
"to": "Engine",
"type": "composition",
"multiplicity_from": "1",
"multiplicity_to": "1"
},
{
"from": "Motorcycle",
"to": "Engine",
"type": "composition",
"multiplicity_from": "1",
"multiplicity_to": "1"
},
{
"from": "Car",
"to": "TransmissionType",
"type": "association",
"multiplicity_from": "1",
"multiplicity_to": "1"
},
{
"from": "Vehicle",
"to": "FuelType",
"type": "association",
"multiplicity_from": "1",
"multiplicity_to": "1"
},
{
"from": "GarageService",
"to": "VehicleService",
"type": "realization"
},
{
"from": "GarageService",
"to": "Vehicle",
"type": "dependency",
"multiplicity_from": "1",
"multiplicity_to": "*"
}
]
}
"""
# JSON for Entity Relationship Diagram
ENTITY_RELATIONSHIP_JSON = """
{
"entities": [
{
"name": "User",
"type": "strong",
"attributes": [
{
"name": "user_id",
"type": "primary_key"
},
{
"name": "username",
"type": "regular"
},
{
"name": "email",
"type": "regular"
},
{
"name": "password_hash",
"type": "regular"
},
{
"name": "full_name",
"type": "composite"
},
{
"name": "phone_numbers",
"type": "multivalued"
},
{
"name": "age",
"type": "derived"
}
]
},
{
"name": "Product",
"type": "strong",
"attributes": [
{
"name": "product_id",
"type": "primary_key"
},
{
"name": "name",
"type": "regular"
},
{
"name": "description",
"type": "regular"
},
{
"name": "price",
"type": "regular"
},
{
"name": "stock_quantity",
"type": "regular"
},
{
"name": "tags",
"type": "multivalued"
}
]
},
{
"name": "Category",
"type": "strong",
"attributes": [
{
"name": "category_id",
"type": "primary_key"
},
{
"name": "name",
"type": "regular"
},
{
"name": "description",
"type": "regular"
}
]
},
{
"name": "Order",
"type": "strong",
"attributes": [
{
"name": "order_id",
"type": "primary_key"
},
{
"name": "order_date",
"type": "regular"
},
{
"name": "status",
"type": "regular"
},
{
"name": "total_amount",
"type": "derived"
},
{
"name": "shipping_address",
"type": "composite"
}
]
},
{
"name": "OrderItem",
"type": "weak",
"attributes": [
{
"name": "line_number",
"type": "partial_key"
},
{
"name": "quantity",
"type": "regular"
},
{
"name": "unit_price",
"type": "regular"
},
{
"name": "subtotal",
"type": "derived"
}
]
},
{
"name": "Payment",
"type": "strong",
"attributes": [
{
"name": "payment_id",
"type": "primary_key"
},
{
"name": "amount",
"type": "regular"
},
{
"name": "payment_method",
"type": "regular"
},
{
"name": "payment_date",
"type": "regular"
},
{
"name": "status",
"type": "regular"
}
]
},
{
"name": "Review",
"type": "strong",
"attributes": [
{
"name": "review_id",
"type": "primary_key"
},
{
"name": "rating",
"type": "regular"
},
{
"name": "comment",
"type": "regular"
},
{
"name": "review_date",
"type": "regular"
}
]
},
{
"name": "Vendor",
"type": "strong",
"attributes": [
{
"name": "vendor_id",
"type": "primary_key"
},
{
"name": "company_name",
"type": "regular"
},
{
"name": "contact_person",
"type": "regular"
},
{
"name": "contact_emails",
"type": "multivalued"
},
{
"name": "business_address",
"type": "composite"
}
]
},
{
"name": "ShoppingCart",
"type": "strong",
"attributes": [
{
"name": "cart_id",
"type": "primary_key"
},
{
"name": "created_date",
"type": "regular"
},
{
"name": "last_updated",
"type": "regular"
},
{
"name": "total_items",
"type": "derived"
}
]
},
{
"name": "CartItem",
"type": "weak",
"attributes": [
{
"name": "item_position",
"type": "partial_key"
},
{
"name": "quantity",
"type": "regular"
},
{
"name": "added_date",
"type": "regular"
}
]
}
],
"relationships": [
{
"name": "PlacesOrder",
"type": "regular",
"entities": ["User", "Order"],
"cardinalities": {
"User": "1",
"Order": "M"
},
"attributes": []
},
{
"name": "Contains",
"type": "identifying",
"entities": ["Order", "OrderItem"],
"cardinalities": {
"Order": "1",
"OrderItem": "M"
},
"attributes": []
},
{
"name": "OrdersProduct",
"type": "regular",
"entities": ["OrderItem", "Product"],
"cardinalities": {
"OrderItem": "M",
"Product": "1"
},
"attributes": []
},
{
"name": "BelongsTo",
"type": "regular",
"entities": ["Product", "Category"],
"cardinalities": {
"Product": "M",
"Category": "1"
},
"attributes": []
},
{
"name": "ProcessesPayment",
"type": "regular",
"entities": ["Order", "Payment"],
"cardinalities": {
"Order": "1",
"Payment": "M"
},
"attributes": []
},
{
"name": "WritesReview",
"type": "regular",
"entities": ["User", "Review"],
"cardinalities": {
"User": "1",
"Review": "M"
},
"attributes": []
},
{
"name": "ReviewsProduct",
"type": "regular",
"entities": ["Review", "Product"],
"cardinalities": {
"Review": "M",
"Product": "1"
},
"attributes": []
},
{
"name": "Supplies",
"type": "regular",
"entities": ["Vendor", "Product"],
"cardinalities": {
"Vendor": "M",
"Product": "M"
},
"attributes": [
{
"name": "supply_price"
},
{
"name": "lead_time"
}
]
},
{
"name": "HasCart",
"type": "regular",
"entities": ["User", "ShoppingCart"],
"cardinalities": {
"User": "1",
"ShoppingCart": "1"
},
"attributes": []
},
{
"name": "CartContains",
"type": "identifying",
"entities": ["ShoppingCart", "CartItem"],
"cardinalities": {
"ShoppingCart": "1",
"CartItem": "M"
},
"attributes": []
},
{
"name": "CartHasProduct",
"type": "regular",
"entities": ["CartItem", "Product"],
"cardinalities": {
"CartItem": "M",
"Product": "1"
},
"attributes": []
}
]
}
"""