Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Document and check for RoadwayNetwork.shape_foreign_key #276

Closed
4 of 5 tasks
lmz opened this issue Jan 14, 2022 · 1 comment · May be fixed by #327
Closed
4 of 5 tasks

[BUG] Document and check for RoadwayNetwork.shape_foreign_key #276

lmz opened this issue Jan 14, 2022 · 1 comment · May be fixed by #327
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lmz
Copy link
Collaborator

lmz commented Jan 14, 2022

Describe the bug

I was trying to use a script that errored out when applying a project card that added new roadway links. On digging, I found it was because the RoadwayNetwork.shape_foreign_key was being used to access columns in both the shapes_df and links_df:

self.links_df[self.shape_foreign_key] = self.links_df.apply(
lambda x: create_unique_shape_id(x["geometry"])
if x["new_link"] == 1
else x[self.shape_foreign_key],
axis=1,
)

I think this is ok but it should be documented clearly and also fail earlier by checking that links_df has the column, in the same way that the check is done for shapes_df:

if self.shape_foreign_key not in self.shapes_df.columns:
valid = False
msg = "Network doesn't contain unique shape id: {}".format(
self.shape_foreign_key
)
WranglerLogger.error(msg)

Status

  • Defined
  • Planned
  • Implemented
  • Tested

To Reproduce

Steps to reproduce the behavior:

  1. Create a network with a shape_foreign_key that exists in shapes_df but not links_df
  2. Apply a project card that creates roadway links

Failing tests

  • No applicable test failed, need to create.
  • [ ]

Triggering line of code

Thoughts on resolution

Full stack trace

Environment

Operating system:
Context (conda, jupyter, etc):
Environment (e.g. output from conda list):

@lmz lmz added the bug Something isn't working label Jan 14, 2022
@e-lo e-lo added this to the v1.0 milestone Jan 19, 2022
@e-lo
Copy link
Collaborator

e-lo commented Apr 15, 2024

Resolved in v1.0 release candidate by being much more rigorous about data models for networks including checking for FKs

@e-lo e-lo self-assigned this Apr 15, 2024
@e-lo e-lo linked a pull request Apr 15, 2024 that will close this issue
@e-lo e-lo closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants