diff --git a/dashBoard.py b/dashBoard.py index c9644014adde456b59fe5761a4b18b0224c4b881..11c55fcef3d1910c85263e65e5bcf627342a9b0b 100644 --- a/dashBoard.py +++ b/dashBoard.py @@ -6,6 +6,8 @@ import diagramParser as parse +# TODO Need to fix some metric parsing issues, only the metric from the bowtie gets added i think + def openFile(): fileName = filedialog.askopenfilename(initialdir= "/", @@ -15,7 +17,6 @@ def openFile(): diagram = parse.parseDiagramFile(fileName) print(diagram.metrics) - guiRoot = Tk() guiRoot.title("Dynamics Analyzer for SSC Risk") diff --git a/diagramParser.py b/diagramParser.py index ba1a3323400af24c86f2ce2801efef64d55728b3..a4d252c08fa196e81bbd52e0a9b7864aa69e7e73 100644 --- a/diagramParser.py +++ b/diagramParser.py @@ -80,8 +80,6 @@ def parseDynamic(df, metricDict, dynamicsDict): df[const.Id][i], # Component ID LucidChart df[const.textArea3][i] # Name of dynamic ) - #threatDynamic.metrics = extractMetrics(df, i, 4) # Extracts metrics from the dynamic component - #metricList = joinMetrcs(threatDynamic.metrics, metricList) # Adds the metrics to the global metric list threatDynamic.associateBowtie(df, threatDynamic.type, metricDict) # Associate the dynamic with the correct components dynamicsDict[df.Id[i]] = threatDynamic @@ -91,8 +89,6 @@ def parseDynamic(df, metricDict, dynamicsDict): df[const.Id][i], # Component ID LucidChart df[const.textArea3][i] # Name of dynamic ) - #consequenceDynamic.metrics = extractMetrics(df, i, 4) # Extracts metrics from the dynamic component - #metricList = joinMetrcs(consequenceDynamic.metrics, metricList) # Adds the metrics to the global metric list@ consequenceDynamic.associateBowtie(df, consequenceDynamic.type, metricDict) dynamicsDict[df.Id[i]] = consequenceDynamic @@ -114,8 +110,6 @@ def parseDynamic(df, metricDict, dynamicsDict): df[const.textArea3][i], # Component type df[const.textArea5][i] # Description ) - #erDynamic.metrics = extractMetrics(df, i, 8) - #metricList = joinMetrcs(erDynamic.metrics, metricList) # Adds the metrics to the global metric list erDynamic.associatER(df, metricDict) dynamicsDict[df.Id[i]] = erDynamic diff --git a/documentation/applicationRequirements.md b/documentation/applicationRequirements.md index 91dc7c021501c6605c261f682a9cc743fc464e6a..59017985d95de6b70ca265f00921deb5fc531666 100644 --- a/documentation/applicationRequirements.md +++ b/documentation/applicationRequirements.md @@ -32,6 +32,10 @@ Additionally the document contains success criteria which are formulated from th - The application will be able to run on as a standalone application on a local machine - The application will only parse the diagrams if the architecture and bowtie diagram have been annotated with the custom library +## Spørsmål til Aida + +Hvordan skal jeg definere suksesskriteriene for applikasjonen? Skal jeg definere de først og så tenke på evaluering? + ## Thesis problem description The thesis aims to innovate in the area of risk modeling through the use of bowtie diagrams by facilitating the identification and documentation of dynamic indicators related to software supply chain risk. diff --git a/dynamics.py b/dynamics.py index 81f92e303a59022d6cf419505b22c1aca981d58b..5f0d4ea75c8f0c4d010ab6df2652b4b36b3b4aab 100644 --- a/dynamics.py +++ b/dynamics.py @@ -149,6 +149,7 @@ class BowtieDynamic(DynamicComponent): metricID = dynamicComponent["Text Area "+str(i)].item() # Find the metric ID in the component metricName = dynamicComponent["Text Area "+str(i+1)].item() # Find the metric Name + self.metrics.append(metricID) # ? Adds the metric to the metric list associated with the dynamic component specifically if checkDuplicateMetrics(metricsDict, metricID) == False: # If the metric is in the global list @@ -169,7 +170,7 @@ class BowtieDynamic(DynamicComponent): if checkDuplicate(metric.bowtieID, self.associatedAttack[const.Id].item()): #* If the associated component is a duplicate continue metric.bowtieID.append(self.associatedAttack[const.Id].item()) - + metricsDict[metricID] = metric # ! Adds the metric to the global metric list class ERDynamic(DynamicComponent): @@ -213,7 +214,6 @@ class ERDynamic(DynamicComponent): if line[const.From] == componentId or line[const.To] == componentId: # If the line is associated with the component relevantLines.append(lines.iloc[i]) # Add the line to the relevant lines list - log.info("Amount of relevant lines found:", len(relevantLines)) for i in range(len(relevantLines)): line = relevantLines[i] @@ -227,7 +227,6 @@ class ERDynamic(DynamicComponent): associatedComponent = df.iloc[df.index[df[const.Id] == associatedComponentID]] # Find the component associated with the line self.associatedERComponents.append(associatedComponent) # Add the associated component to the list of associated components - log.info("Associated components found: ", self.associatedERComponents) self.linkMetric(df, metricsDict) # Link the metrics to the ER dynamic component @@ -248,31 +247,33 @@ class ERDynamic(DynamicComponent): break metricID = dynamicComponent["Text Area "+str(i)].item() # Find the metric ID - metricName = dynamicComponent["Text Area "+str(i+1)].item() # Find the metric ID + metricName = dynamicComponent["Text Area "+str(i+1)].item() # Find the metric ID + self.metrics.append(metricID) # ? Adds the metric to the metric list associated with the dynamic component specifically if checkDuplicateMetrics(metricsDict, metricID) == False: # If the metric is not a duplicate metric = Metric(metricID, metricName) # Create a new metric object else: metric = metricsDict[metricID] - + for i in range(len(self.associatedERComponents)): erID = self.associatedERComponents[i][const.Id].item() if checkDuplicate(metric.erID, erID): #* If the associated component is a duplicate continue metric.erID.append(erID) - - metricsDict[metricID] = metric # ! Adds the metric to the global metric list - + metricsDict[metricID] = metric # ! Adds the metric to the global metric list + def checkDuplicateMetrics(metricsDict: dict, metricID: str): """_summary_ Function will check if the diagrams metric dict contains a metric, with the same ID as the one which is listed in the dynamics component, if it does """ - if metricID in metricsDict: + + if metricID in metricsDict.keys(): return True + else: return False @@ -280,7 +281,7 @@ def checkDuplicate(list: list, id: str): """_summary_ Check if the already contains the associated component """ - if id in list: + if id in list: return True else: return False \ No newline at end of file