Skip to content

function taxi_fare_for_itinerary() for Portuguese taxi fare and route simulation - #4

Draft
temospena wants to merge 1 commit into
mainfrom
3-taxi-simulator-for-pt
Draft

temospena wants to merge 1 commit into
mainfrom
3-taxi-simulator-for-pt

Conversation

@temospena

Copy link
Copy Markdown
Member

This PR adds a function to estimate taxi fares in portugal (under Regulamento AMT nº 717/2026).

It encapsulates the Federação Portuguesa do Taxi web simulator, and optionally adds the toll costs, with IP toll simulator.

Relates to #3.
The issue has not yet been discussed.

@temospena temospena linked an issue Oct 16, 2026 that may be closed by this pull request
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.93671% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.28%. Comparing base (0abd508) to head (c3becc2).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
R/taxi_fare_for_itinerary.R 94.93% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   93.89%   94.28%   +0.39%     
==========================================
  Files           3        4       +1     
  Lines         131      210      +79     
==========================================
+ Hits          123      198      +75     
- Misses          8       12       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@gmatosferreira

Copy link
Copy Markdown
Member

Hey, @temospena!

I think it is a valuable contribution to MobilityDataPT. 🙂

However and due to the fact that the /route API uses TomTom services to compute the itinerary, we might have some issues regarding licensing. I suggest to remove this call and leave only the one to /price, which is the one that really adds value and novelty. Since the request payload only requires the route distance (example payload below), we might move this route computation to the method description. Maybe even document how to do so using ORS (and leaving the disclose that paid services, like TomTom, might be more accurate during peak hours due to the fact that they consider weighted speeds).

{"km":16.883,"seg":1630,"partida":"2026-10-16T17:57","tarifa":"t1","reserva":false,"portagens":0,"params":{}}

What do you think of this compromise?

@gmatosferreira
gmatosferreira marked this pull request as draft October 16, 2026 17:09
@gmatosferreira

Copy link
Copy Markdown
Member

Also, please add yourself in the DESCRIPTION file as ctb and update the NEWS.md with the new method, in version 1.1.0. If you want, I can also make these changes before approving. :)

@temospena

Copy link
Copy Markdown
Member Author

The thing is that the route may differ with the time of day.
Tomtom uses historical data in their routing algorithm, and the travel time is much more accurate than if we use the free flow on ORS.
And this is an important factor in the price estimate.

So...
Ok, for now we can split the things up, or find accurate open source route engines (?)

@gmatosferreira

gmatosferreira commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Up to you. I don't think we can merge like this. Either we find a suitable open alternative, or add the disclaim (in the method description) to warn for the importance of considering routing engines that consider traffic induced speed decays depending on the time of the day.

Either way, I think that the methods should be split, as they represent different functionalities that can be used standalone.

This branch has not been deployed

No deployments
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.

taxi simulator for PT

3 participants