Alef1986 commited on
Commit
70993df
·
verified ·
1 Parent(s): 74beae5

Upload 2 files

Browse files
Files changed (2) hide show
  1. src/ISO15288_Archi_Import.xml +0 -0
  2. src/app_det.py +71 -0
src/ISO15288_Archi_Import.xml CHANGED
The diff for this file is too large to render. See raw diff
 
src/app_det.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import streamlit as st
3
+ from parser import load_and_parse_xml
4
+ import case_manager
5
+
6
+ st.set_page_config(page_title="ISO 15288 Analyzer", layout="wide")
7
+
8
+ st.markdown("""
9
+ <style>
10
+ .main .block-container { max-width: 100% !important; padding: 1rem 1rem 0 1rem !important; }
11
+ iframe { width: 100% !important; height: 85vh !important; border: 1px solid #ccc; border-radius: 8px; }
12
+ header { visibility: hidden; }
13
+ div.row-widget.stRadio { margin-bottom: -5px; }
14
+ </style>
15
+ """, unsafe_allow_html=True)
16
+
17
+ st.title("ISO 15288: Architecture Analyzer")
18
+
19
+ mode = st.radio(
20
+ "Select analysis scenario:",
21
+ (
22
+ "Case 1: Interface exchange between selected processes",
23
+ "Case 2: Shortest DATA FLOW path (Directed)",
24
+ "Case 3: Closest STRUCTURAL connection (Undirected)",
25
+ "Case 4: All possible DATA FLOW paths (Directed)",
26
+ "Case 5: Process Neighborhood & Internal Steps (Subgraphs)",
27
+ "Case 6: Shortest connection between Business Objects (Undirected)",
28
+ "Case 7: N2 Chart Simulation (Process Inputs & Outputs)"
29
+ )
30
+ )
31
+
32
+ # Expand to 3 columns to accommodate the new checkbox
33
+ col_opt1, col_opt2, col_opt3 = st.columns(3)
34
+ with col_opt1:
35
+ use_hierarchy = st.checkbox("Include derived connections (Whole-Part, Specialization hierarchy)", value=True)
36
+ with col_opt2:
37
+ connect_border_objects = st.checkbox("Show relationships between boundary objects on diagram", value=True)
38
+ with col_opt3:
39
+ # New checkbox for the meta-level
40
+ include_enablers = st.checkbox("Include Enablers and Controls", value=False)
41
+
42
+ try:
43
+ current_script_dir = os.path.dirname(os.path.abspath(__file__))
44
+ xml_file_path = os.path.join(current_script_dir, "ISO15288_Archi_Import.xml")
45
+
46
+ # Pass the checkbox state to the parser
47
+ G_full, G_direct, processes, business_objects = load_and_parse_xml(xml_file_path, include_enablers)
48
+ sorted_process_names = sorted(list(processes.values()))
49
+ sorted_object_names = sorted(list(business_objects.values()))
50
+ except FileNotFoundError:
51
+ st.error(f"File 'ISO15288_Archi_Import.xml' not found. Looked at: {xml_file_path}")
52
+ st.stop()
53
+
54
+ # Build the global context to pass to the cases
55
+ ctx = {
56
+ "G_full": G_full,
57
+ "G_active": G_full if use_hierarchy else G_direct,
58
+ "U_active": (G_full if use_hierarchy else G_direct).to_undirected(),
59
+ "processes": processes,
60
+ "business_objects": business_objects,
61
+ "sorted_process_names": sorted_process_names,
62
+ "sorted_object_names": sorted_object_names,
63
+ "use_hierarchy": use_hierarchy,
64
+ "connect_border_objects": connect_border_objects,
65
+ "include_enablers": include_enablers # Added to the context for potential use within cases
66
+ }
67
+
68
+ st.markdown("---")
69
+
70
+ # Pass execution to the router
71
+ case_manager.run_case(mode, ctx)