Skip to content

Commit

Permalink
use indices to check if any missing nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
yueshuaing committed Oct 10, 2024
1 parent 87e0e5c commit 067f22e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion network_wrangler/roadway/links/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def validate_links_have_nodes(links_df: pd.DataFrame, nodes_df: pd.DataFrame) ->
raises: NodesInLinksMissingError if nodes_df is missing and A or B node
"""
nodes_in_links = list(set(links_df["A"]).union(set(links_df["B"])))
node_idx_in_links = nodes_df[nodes_df["model_node_id"].isin(nodes_in_links)].index

fk_valid, fk_missing = fk_in_pk(nodes_df.index, nodes_in_links)
fk_valid, fk_missing = fk_in_pk(nodes_df.index, node_idx_in_links)
if not fk_valid:
msg = "Links are missing len{fk_missing} nodes."
WranglerLogger.error(msg + f"\n Missing: {fk_missing}")
Expand Down

0 comments on commit 067f22e

Please sign in to comment.