mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-22 04:43:54 +02:00
Bug fixes v2
This commit is contained in:
@ -81,11 +81,20 @@ company_relation_type_filter = get_all_company_relations()["relation_type"].uniq
|
|||||||
def update_table(
|
def update_table(
|
||||||
metric_dropdown_value: str, metrics: pd.DataFrame
|
metric_dropdown_value: str, metrics: pd.DataFrame
|
||||||
) -> tuple[dict, list]:
|
) -> tuple[dict, list]:
|
||||||
|
"""_summary_.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
metric_dropdown_value (str): _description_
|
||||||
|
metrics (pd.DataFrame): _description_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple[dict, list]: _description_
|
||||||
|
"""
|
||||||
table_df = metrics.sort_values(metric_dropdown_value, ascending=False).head(10)
|
table_df = metrics.sort_values(metric_dropdown_value, ascending=False).head(10)
|
||||||
table_df = table_df[["designation", "category", metric_dropdown_value]]
|
table_df = table_df[["designation", "category", metric_dropdown_value]]
|
||||||
table_df.to_dict("records")
|
table_df.to_dict("records")
|
||||||
columns = [{"name": i, "id": i} for i in table_df.columns]
|
columns = [{"name": i, "id": i} for i in table_df.columns]
|
||||||
return table_df.to_dict("records"), columns # type: ignore
|
return table_df.to_dict("records"), columns # type: ignore
|
||||||
|
|
||||||
|
|
||||||
top_companies_dict, top_companies_columns = update_table("closeness", metrics)
|
top_companies_dict, top_companies_columns = update_table("closeness", metrics)
|
||||||
@ -314,6 +323,15 @@ def update_graph_data(
|
|||||||
person_relation_type: str = "HAFTENDER_GESELLSCHAFTER",
|
person_relation_type: str = "HAFTENDER_GESELLSCHAFTER",
|
||||||
company_relation_type: str = "GESCHAEFTSFUEHRER",
|
company_relation_type: str = "GESCHAEFTSFUEHRER",
|
||||||
) -> tuple[nx.Graph, pd.DataFrame, dict, list]:
|
) -> tuple[nx.Graph, pd.DataFrame, dict, list]:
|
||||||
|
"""_summary_.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
person_relation_type (str, optional): _description_. Defaults to "HAFTENDER_GESELLSCHAFTER".
|
||||||
|
company_relation_type (str, optional): _description_. Defaults to "GESCHAEFTSFUEHRER".
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple[nx.Graph, pd.DataFrame, dict, list]: _description_
|
||||||
|
"""
|
||||||
# Get Data
|
# Get Data
|
||||||
person_df = get_all_person_relations()
|
person_df = get_all_person_relations()
|
||||||
company_df = get_all_company_relations()
|
company_df = get_all_company_relations()
|
||||||
@ -394,7 +412,7 @@ def update_figure(
|
|||||||
selected_metric,
|
selected_metric,
|
||||||
layout,
|
layout,
|
||||||
switch_edge_annotaion_value,
|
switch_edge_annotaion_value,
|
||||||
slider_value,# type: ignore
|
slider_value, # type: ignore
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -409,7 +427,7 @@ def update_figure(
|
|||||||
selected_metric,
|
selected_metric,
|
||||||
layout,
|
layout,
|
||||||
switch_edge_annotaion_value,
|
switch_edge_annotaion_value,
|
||||||
slider_value, # type: ignore
|
slider_value, # type: ignore
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -421,6 +439,14 @@ def update_figure(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def update_Dropdown(datasource_value: str) -> str:
|
def update_Dropdown(datasource_value: str) -> str:
|
||||||
|
"""_summary_.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
datasource_value (str): _description_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: _description_
|
||||||
|
"""
|
||||||
style = ""
|
style = ""
|
||||||
match datasource_value:
|
match datasource_value:
|
||||||
case "Company Data only":
|
case "Company Data only":
|
||||||
|
@ -189,7 +189,7 @@ def filter_relation_with_more_than_one_connection(
|
|||||||
|
|
||||||
if count > 1:
|
if count > 1:
|
||||||
# tmp_df = pd.concat([tmp_df, pd.DataFrame(row)])+
|
# tmp_df = pd.concat([tmp_df, pd.DataFrame(row)])+
|
||||||
tmp_df.loc[len(tmp_df)] = row # type: ignore
|
tmp_df.loc[len(tmp_df)] = row # type: ignore
|
||||||
count = 0
|
count = 0
|
||||||
else:
|
else:
|
||||||
count = 0
|
count = 0
|
||||||
@ -269,7 +269,7 @@ def create_edge_and_node_list(
|
|||||||
|
|
||||||
def find_company_relations(
|
def find_company_relations(
|
||||||
selected_company_id: int,
|
selected_company_id: int,
|
||||||
) -> tuple[pd.DataFrame, pd.DataFrame]:
|
) -> tuple[pd.DataFrame, pd.DataFrame]:
|
||||||
relations_company_query = (
|
relations_company_query = (
|
||||||
session.query(
|
session.query(
|
||||||
to_company.id.label("id_company_to"),
|
to_company.id.label("id_company_to"),
|
||||||
|
Reference in New Issue
Block a user