mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-05-14 05:48:46 +02:00
Added Graph to Company page again
This commit is contained in:
parent
e5769b3c25
commit
fdbb6b5fd4
@ -380,9 +380,6 @@ def network_layout(selected_company_id: int) -> html.Div:
|
||||
"""
|
||||
person_relations, company_relations = find_company_relations(selected_company_id)
|
||||
|
||||
# get_all_metrics_from_id(selected_company_id)
|
||||
# get_relations_number_from_id(f"c_{selected_company_id}")
|
||||
|
||||
# Create Edge and Node List from data
|
||||
nodes, edges = create_edge_and_node_list_for_company(company_relations)
|
||||
# Initialize the Network and receive the Graph and a DataFrame with Metrics
|
||||
|
@ -39,28 +39,10 @@ dash.register_page(
|
||||
],
|
||||
)
|
||||
|
||||
# Create Edge and Node List from data
|
||||
# nodes, edges = create_edge_and_node_list(person_relation, company_relation)
|
||||
# Initialize the Network and receive the Graph and a DataFrame with Metrics
|
||||
# graph, metrics = initialize_network(nodes=nodes, edges=edges)
|
||||
metric = "None"
|
||||
# layout = "Spring"
|
||||
# # switch_node_annotaion_value = False
|
||||
switch_edge_annotaion_value = False
|
||||
egde_thickness = 1
|
||||
network = None
|
||||
# create_3d_graph(
|
||||
# graph,
|
||||
# nodes,
|
||||
# edges,
|
||||
# metrics,
|
||||
# metric,
|
||||
# layout,
|
||||
# switch_edge_annotaion_value,
|
||||
# egde_thickness,
|
||||
# )
|
||||
|
||||
# Get the possible Filter values for the Dropdowns.
|
||||
|
||||
|
||||
def person_relation_type_filter() -> np.ndarray:
|
||||
@ -146,26 +128,6 @@ def layout() -> list[html.Div]:
|
||||
className="networkx_style",
|
||||
children=[
|
||||
html.H1(className="header", children=["Social Graph"]),
|
||||
# html.Div(
|
||||
# className="filter-wrapper",
|
||||
# children=[
|
||||
# html.Div(
|
||||
# className="filter-wrapper-item",
|
||||
# children=[
|
||||
# html.H5(
|
||||
# className="filter-description",
|
||||
# children=["Data Source:"],
|
||||
# ),
|
||||
# dcc.Dropdown(
|
||||
# ["Company Data only", "Person Data only", "Company & Person Data"],
|
||||
# "Company Data only",
|
||||
# id="dropdown_data_soruce_filter",
|
||||
# className="dropdown_style",
|
||||
# ),
|
||||
# ],
|
||||
# ),
|
||||
# ],
|
||||
# ),
|
||||
html.Div(
|
||||
className="filter-wrapper",
|
||||
id="company_dropdown",
|
||||
|
@ -237,7 +237,7 @@ def find_company_relations(
|
||||
"""
|
||||
session = SessionHandler.session
|
||||
assert session # noqa: S101
|
||||
relations_company_query = (
|
||||
relations_company = (
|
||||
session.query(
|
||||
to_company.id.label("id_company_to"),
|
||||
to_company.name.label("name_company_to"),
|
||||
@ -257,18 +257,11 @@ def find_company_relations(
|
||||
(from_company.id == selected_company_id)
|
||||
| (to_company.id == selected_company_id)
|
||||
)
|
||||
.all()
|
||||
)
|
||||
company_relations = pd.DataFrame(relations_company_query.all())
|
||||
# logger.debug(str(relations_company_query))
|
||||
# relations_company_query = relations_company_query.filter(entities.CompanyRelation.company2_id == selected_company_id) # or (entities.CompanyRelation.company2_id == selected_company_id))
|
||||
# logger.debug(str(relations_company_query))
|
||||
# tmp = str(relations_company_query) + " WHERE from_company.id = " + str(selected_company_id)
|
||||
# print(tmp)
|
||||
# query = str(relations_company_query.filter((entities.CompanyRelation.company_id == selected_company_id) or (entities.CompanyRelation.company2_id == selected_company_id)))
|
||||
# print(query)
|
||||
# company_relations = get_all_company_relations()
|
||||
|
||||
company_relations = pd.DataFrame(
|
||||
relations_company_query.all(),
|
||||
relations_company,
|
||||
columns=[
|
||||
"id_company_to",
|
||||
"name_company_to",
|
||||
@ -309,12 +302,14 @@ def create_edge_and_node_list_for_company(
|
||||
"id": row["id_company_from"],
|
||||
"name": row["name_company_from"],
|
||||
"color": COLOR_COMPANY,
|
||||
"type": "company",
|
||||
}
|
||||
if nodes.get(row["id_company_to"]) is None:
|
||||
nodes[row["id_company_to"]] = {
|
||||
"id": row["id_company_to"],
|
||||
"name": row["name_company_to"],
|
||||
"color": COLOR_COMPANY,
|
||||
"type": "company",
|
||||
}
|
||||
edges.append(
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user