osmnx icon indicating copy to clipboard operation
osmnx copied to clipboard

[WIP] ENH: add graph validation function

Open gboeing opened this issue 7 months ago • 1 comments

This PR adds a private internal _validate module and a public validate_graph function to the graph module. This allows users to validate their graphs and, in turn, will make it easier for people manually create their own from raw data while ensuring it has all the required attributes that OSMnx expects (and adds automatically in the graph_from_x functions).

This ensures that all the "expected standard structure" exists in a graph if you've created it from raw data, hopefully making it much easier for users to do so without guessing at a checklist themselves.

  • [x] add private internal _validate module
  • [x] add public validate_graph function to the graph module
  • [ ] expose public validate_node_edge_gdfs function (see #1234)

Maybe add a validate_features_gdf function too?

See also #1314.

gboeing avatar Jun 19 '25 00:06 gboeing

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 98.57%. Comparing base (f98bae6) to head (5fb2de1). :warning: Report is 38 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1317      +/-   ##
==========================================
+ Coverage   98.47%   98.57%   +0.09%     
==========================================
  Files          24       25       +1     
  Lines        2425     2591     +166     
==========================================
+ Hits         2388     2554     +166     
  Misses         37       37              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 19 '25 00:06 codecov[bot]