railtoolkit / TrainRuns.jl

TrainRun.jl will take a user-defined train and a path as an input for a train run calculation. It can calculate the train run as a time-efficient or energy-efficient operation mode. The results can then be used within the Julia environment.
https://railtoolkit.org/projects/trainruns.jl
ISC License
5 stars 2 forks source link

Passthrough of POI DataFrame columns #55

Closed apriljunge closed 4 months ago

apriljunge commented 6 months ago

It would be really nice if all columns ~(or all columns that are not :measure and :position)~[^1] defined in a POI dataframe would be passed to the output DataFrame.

If a DataFrame like this

points_of_interest = DataFrame([
    19900 1 "view point"        "front";
    20000 1 "distant"       "front";
    21000 1 "main"          "front";
    26000 1 "clearing signal"   "rear";
], [:position, :blockid, :label, :measure)

would keep :blockid and :label in the output of trainrun() this would be really nice and much more flexible. With this behaviour more information for later calculation or display could be added.

[^1]: I think the original position could be very important in the calculated DataFrame. :position and :measure should be kept too

apriljunge commented 6 months ago

I think it would make sense not to transform POIs from DataFrame to Dict, from Dict to NamedTuple and from NamedTuple to Dict and from Dict to DataFrame.

I have not reviewed the whole code, but maybe it would be possible to directly use and modify the DataFrame?