Open brettforbes opened 1 year ago
Assuming the report is loaded (Issue 537 works https://github.com/typerefinery-ai/typerefinery/issues/537), getting the objects is easy, as one can just use the get() method. However, they take a few seconds each, so this following code can take many minutes
def get_object_cluster(cluster_head_id, connection):
cluster_type = cluster_head_id.split('--')[0]
stix_list = []
if cluster_type == "report":
typedb_source = TypeDBSource(connection, import_type)
report_obj = typedb_source.get(cluster_head_id)
if report_obj.type == cluster_type:
stix_list.append(report_obj)
if hasattr(report_obj, "created_by_ref"):
identity = typedb_source.get(report_obj.created_by_ref)
stix_list.append(identity)
if hasattr(report_obj, "object_refs"):
report_list = report_obj.object_refs
for report_component_id in report_list:
print(f"find obj {report_component_id}")
tmp_obj = typedb_source.get(report_component_id)
stix_list.append(tmp_obj)
print("found and added")
return stix_list
The question is how to split this one operation up so it can happen iteratively, and the user can get feedback.
Do we:
How should this look?
the real question is, what should this secondary loop look like?
Ok, so the layout is simple, but we still need a message to the ui.
Clearly, we just build the flow so the iteration loop is exposed, then every iteration, grow the list that then gets converted into nodes/edges and ultimately visualised in the force graph.
But to do this we need to give regular feedback to the ui about what is going on. How does that messaging work, and what should the message log on the ui look like?
Prerequisites
Some blocks will be long running, but how can the user know they are working correctly???
As an example the following report contains 153 objects, so retrieving them all and putting them into a single Stix_Object_List will take many minutes (i.e. the report and all objects referenced in the report into one list).
This may be able to be sped up through parallel processing, but it will still take a long time, no matter what happens. Consider this report object below can consider what it takes to retrieve every object?
Expected Behavior
If a block that takes 5min or longer starts, there must be some way to let the user know,so they do not believe it iis broken
Current Behavior
There will beno feedback to the user, and they will have no idea that their process could take so long, and indeed is still running
Example Object
Imagine building a list containing all of the objects in this report. How should the user be told????