HERE-API wrong route cost on Poland - here-api

I am sending a request for a route with costs for a truck. Route Warsaw - Berlin, vehicle parameters
trucks
width 255 cm
height 256 cm
length 13.6 meters
weight 14 tons
number of axles 5
The costs received, unfortunately, due to the number of axles, the api calculates for a category 5 vehicle, see Price kat 5
which is wrong because a category 5 vehicle is a vehicle that meets any of the conditions
width > 255 cm
height > 400 cm
length > 16.5 meters
weight > 42t
The api correctly interprets only the height condition, at a time the API will overinterpret the number of axles which does not affect the category of the vehicle
For an inquiry in accordance with the vehicle parameters, I meet the requirements of the price list for category 4 see Price kat 4
Please help

Related

Woocommerce rounding totals and tax still gives a wrong impression to the client

A Regular price of a product is 46.875 but the figure displayed is 55 on the client view because of Rounding per Line ( UNCHECKED : Round tax at subtotal level, instead of rounding per line) and depends on the Decimals Set in this case Zero (0).
When a Client takes Quantity of 2 the Subtotal is 109 instead of 110. For the client expects 110 instead of 109.
Here is the Math:
46.875 x 0.16(VAT) = 7.5 then Add 46.875 = 54.375 (x2 (Quantity) = 108.75 => rounded subtotal is 109)
Even if we change the regular price 46.875 to 47. We get the same.
47 x 0.16(VAT) = 7.52 then Add 47 = 54.52 (x2 (Quantity) = 109.04 => rounded subtotal 109)
My Question or idea is, can i Round the items Subtotal before multiplying by Quantity so that i have something like this:
46.875 x 0.16(VAT) = 7.5 then Add 46.875 = ROUNDED SUBTOTAL 55 instead of 54.375 (x2 (Quantity) = 110 => rounded subtotal is 110)
or
47 x 0.16(VAT) = 7.52 then Add 47 = 54.52 ROUND TO 55 (x2 (Quantity) = 110 => rounded subtotal 110)
The solution though makes the client pay the extra decimals added to the rounding and it becomes more if the quantity increases. (55 - 54.52 = 0.48 X Quantity Increase).
This Increase were not taxed as well.
So my last solution to this part is on receipting and invoice or order , I can calculate how much VAT is in the total 110 and send to Quickbooks online the total as 110 and tax as 0.16 of 110 instead of 109.
This means the tax i calculated earlier was just to factor in Tax in the price to the client and the increase in rounding is a markup by the seller or considered by the seller within their mark up.
The last generation of new tax amount at the receipting/order level is just to make sure we tax the Total.
Sounds crazy but i think its a win win for everyone.
SO, i would really like to try this by rounding subtotal before multiplying by Quantity and generating new Tax amount at totals when receipting/invoicing so that the client sees accurate tax from totals.
If you have a different idea, i would really like to try.
Thanks :)

Dealing with missing data for rating agencies, is deletion an accepted approach in this case?

I have a set of 72 public companies of the chilean stock exchange. The selection of the data wasn't random, as the choice of public companies was adressed first by those ones that have a total 24h market volume of at least 400 USD (yes, the stock exchange is small), for which I got the sample of 72 public companies.
The ESG ratings, are ratings that agencies give in order to measure the sustainability of a company. I used 4 different rating agencies.
The data is Missing at Random (MAR), as as the data is randomly missing for companies that aren’t part of the main chilean market index ("ipsa" you can ignore this). The data looks like this (on the table): (very few (like 5%) of the cases of companies that are in the main market index have missing values. Meanwhile for the other companies, missing values are in 70%+ of the cases.
Companies
Agency 1 Rating
Agency 2 rating
is part of main index?
A
40
20
yes
B
20
30
yes
C
55
30
yes
D
55
missing
yes
E
70
30
yes
F
30
50
yes
G
30
60
yes
H
30
60
yes
I
missing
60
no
N
40
missing
no
K
20
missing
no
L
30
missing
no
M
40
missing
no
Z
20
20
no
Y
30
10
no
Is deletion of all those cases where the companies have missing values an accepted method to deal with these missing values to then run the correlation between ratings of different agencies, or am I doing a big mistake (big bias)? I end up deleting almost all entries of the group of companies that aren't in the main market index, only two are remaining, while of the ones that are part of the market index, 26 remain. The total sample is 29 remaining alive, can I run correlation this way?

Woocomerce Points & Rewards Change Points Rewarded Upon Quantity Change

I Have installed Woocommerce Points & Rewards
Now the customer is rewarded with 5 points for 1 item purchased
However, I would like to reward 15 points for the same item purchased when the quantity increases to 2 units.
example:
purchase 1 item A = 5 points
purchase 2 items A = 15 points
How do I do this?

Fetching Toll costs

I'm trying to fetch Toll costs data (cost, TollCost groups from the Json response). I'm making the call to https://route.api.here.com/routing/7.2/calculateroute.json with the following parameters
alternatives: 0
currency: EUR
rollup: none,total,country
mode: fastest;truck;traffic:disabled
driver_cost: 0
vehicle_cost: 0.46
vehicleCostOnFerry: 0
routeAttributes: none,no,wp,lg,sc
jsonAttributes: 41
maneuvreAttributes: none
linkAttributes: none,sh
legAttributes: none,li
cost_optimize: 1
metricsystem: metric
truckRestrictionPenalty: soft
tollVehicleType: 3
trailerType: 2
trailersCount: 1
vehicleNumberAxles: 2
trailerNumberAxles: 3
hybrid: 0
emissionType: 6
fuelType: diesel
height: 4
length: 16.55
width: 2.55
trailerHeight: 4
vehicleWeight: 16
limitedWeight: 40
weightperaxle: 10
disabledEquipped: 0
passengersCount: 2
tiresCount: 12
commercial: 1
detail: 1
heightAbove1stAxle: 3.5
waypoint0: geo!stopOver!46.8036700000,19.3648579000;;null
waypoint1: geo!stopOver!48.1872046178,14.0647109247;;null
waypoint2: geo!stopOver!48.0690426000,16.3346156000;;null
Based on the documentation (https://developer.here.com/documentation/fleet-telematics/dev_guide/topics/calculation-considerations.html), it should be enough to add the tollVehicleType parameter.
For sure I'm missing something, but would be very grateful for any support. Thank you.
If you have a problem do not use 157 different arguments for an API but only use the minimum required ones to get a result. A minimum working reproduceable example. Then add the additional arguments.
And try to omit all other problematic factors - in this example I just pasted the GET request into the address line of your browser and looked at the output.
So you have no possible interference of any kind by the programming language.
I just did this - registered for HERE API got the api key - looked at the API (never did anything with HERE) and 4 minutes later I got the toll cost.. :-)
Please replace the XXXXXXXXXXX by your own key
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey=XXXXXXXXXXXXXXXXXXXXXX
&mode=fastest;truck;traffic:disabled
&tollVehicleType=3
&waypoint0=50.10992,8.69030
&waypoint1=50.00658,8.29096
and look what it returned AT THE END of 5 pages JSON (lots of JSON before)
"cost":{"totalCost":"4.95","currency":"EUR","details":{"driverCost":"0.0","vehicleCost":"0.0",
"tollCost":"4.95","optionalValue":"0.0"}},
"tollCost":{"onError":false}}],"warnings":[{"message":"No vehicle height specified, assuming 380 cm","code":1},{"message":"No vehicle weight specified, assuming 11000 kg","code":1},{"message":"No vehicle total weight specified, assuming 11000 kg","code":1},{"message":"No vehicle height above first axle specified, assuming 380 cm","code":1},{"message":"No vehicle total length specified, assuming 1000 cm","code":1}],"language":"en-us"}}
HERE ARE YOUR TOLL COST :-)
(NOTE: Keep in mind that there is probably no toll for the given car type and country!
I also got a cost result with a car but it was 0,- because there is no toll for cars in Germany (only trucks) where the example waypoints are located. )

I am struggling to replace stringA in a column Description with stringB if stringA contains stringC

id,Description
1,DRIVING VEHICLE ON HIGHWAY WITHOUT CURRENT REGISTRATION PLATES AND VALIDATION TABS
2,EXCEEDING SPEED LIMIT IN SCHOOL ZONE WITH 35 MPH IN 25 ZONE
3,DRIVING VEHICLE IN EXCESS OF REASONABLE AND PRUDENT SPEED ON HIGHWAY 8855
If I want to replace whole Description row with "EXCESS SPEED" if it contains "SPEED".
I am using gsub function :
training_data$Description = gsub("(dot)(star)SPEED(dot)(star)","EXCESS SPEED",training_data$Description,fixed = TRUE)
It is still not working I am getting result (just replacing "SPEED" with "EXCESS SPEED" instead of the entire row) :
Output Received:
id,Description
1,DRIVING VEHICLE ON HIGHWAY WITHOUT CURRENT REGISTRATION PLATES AND VALIDATION TABS
2,EXCEEDING EXCESS SPEED LIMIT IN SCHOOL ZONE WITH 35 MPH IN 25 ZONE
3,DRIVING VEHICLE IN EXCESS OF REASONABLE AND PRUDENT EXCESS SPEED ON HIGHWAY 8855
Expected Output:
id,Description
1,DRIVING VEHICLE ON HIGHWAY WITHOUT CURRENT REGISTRATION PLATES AND VALIDATION TABS
2,EXCESS SPEED
3,EXCESS SPEED
You can try this:
training_data$Description = sapply(training_data[,2],function(sentence){
if(grepl("SPEED",sentence)){
as.character("EXCESS SPEED")
}else{
as.character(sentence)
}
})

Resources