Skip to content

Making PolarRoute-server compatible with latest PolarRoute and MeshiPhi versions - #175

Open
thomaszwagerman wants to merge 10 commits into
mainfrom
tz/version_updates
Open

Making PolarRoute-server compatible with latest PolarRoute and MeshiPhi versions#175
thomaszwagerman wants to merge 10 commits into
mainfrom
tz/version_updates

Conversation

@thomaszwagerman

@thomaszwagerman thomaszwagerman commented Dec 14, 2025

Copy link
Copy Markdown
Collaborator

Specifically updating how evaluate_route works with PolarRoute changes to route_calc api:

# From
calc_route = route_calc(route_file.name, mesh_file.name)

# To
calc_route = route_calc(df, from_wp, to_wp, mesh.json, "fuel")

Also removing all TempFile related code, as now longer required for new API.

@davidwyld

Copy link
Copy Markdown
Collaborator

I appreciate this is still in draft, but looks good so far, I'm very pleased to finally be getting rid of the need to deal with tempfiles now we can use the python interface more directly.

Feel free to make any other improvements to this function you feel are necessary.

I'm sure you will, but don't forget to restrict the polar-route version in the pyproject.toml from this point.

@thomaszwagerman
thomaszwagerman marked this pull request as ready for review April 7, 2026 12:32
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissBranchBrPartCoverMissing
polarrouteserver
   __init__.py3000100% 
   _version.py11000100% 
   celery.py153000 80%
polarrouteserver/route_api
   __init__.py4000100% 
   models.py742000 97%
   responses.py33020100% 
   serializers.py12053644 94%
   tasks.py138213277 84%
   utils.py114104644 91%
   views.py277175244 94%
polarrouteserver/route_api/management
   __init__.py0000100% 
polarrouteserver/route_api/management/commands
   __init__.py0000100% 
   ensure_adminuser.py2222600 0%
   insert_mesh.py2626800 0%
polarrouteserver/utils
   __init__.py0000100% 
   loggers.py1010000 0%
TOTAL8471161821986% 

@thomaszwagerman

Copy link
Copy Markdown
Collaborator Author

Satisfied this successfully runs and returns routes

@thomaszwagerman
thomaszwagerman requested a review from davidwyld June 3, 2026 09:52

@davidwyld davidwyld left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I've said, this is a huge improvement, thanks for doing this.

I wonder if we should add to the testing of this functionality in test_utils? I'm happy to write a test if you don't have time.

Don't forget to update the changelog in this PR too.

Comment thread polarrouteserver/route_api/utils.py Outdated
Co-authored-by: David Wyld <24752124+davidwyld@users.noreply.github.com>
@thomaszwagerman

Copy link
Copy Markdown
Collaborator Author

I've added route_type parameter as a positional argument and updated the route evaluation API endpoint + schema.

Opened an issue in PolarRoute for related issues within route_calc

@thomaszwagerman
thomaszwagerman requested a review from davidwyld June 3, 2026 15:33

@davidwyld davidwyld left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth discussing whether we want to expose route_type in the API?

Want me to implement a test for evaluate_route? Or we can just open an issue since there isn't one to begin with so I don't want it to hold back this branch.

Comment thread docs/apischema.yml
Comment thread polarrouteserver/route_api/utils.py
Comment thread polarrouteserver/route_api/utils.py Outdated
df = pd.DataFrame(df_data)

# Get start and end waypoint names
from_wp = "waypoint_0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's possible for the submitted route to have waypoint names, we may want to preserve those in the future, but lets leave this as is for now, they don't really matter for SIIS at least.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TZ review geojson schema and safety of waypoint name here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much better IMO if route_calc took a geojson/dict as input rather than a dataframe, but whatever, this is fine.
It would be nice to preserve waypoint names from the geojson if it has them

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waypoint names preserved with e6a2b24, agree it would be lot less hassle if route_calc took a GeoJSON though - although that is a PolarRoute change. Might investigate.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see bas-logist/PolarRoute#355 - I think worth holding off on this until that is reviewed, as well as possibly implementing bas-logist/PolarRoute#350 as it touches this

Comment thread polarrouteserver/route_api/views.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants