Parametrize the DriverRank.jl script

This patch makes the `DriverRank.jl` accept two arguments. The first
is the CSV file to read the input data from. The second is the CSV
file to save the parsed results to.

This patch also updates the Go code parsing the output CSV because it
contains a "header". I.e. labels for the columns.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Iaeeb02316bc04fbf27962f0f8d9ac12880a61b8d
diff --git a/scouting/DriverRank/src/DriverRank.jl b/scouting/DriverRank/src/DriverRank.jl
old mode 100644
new mode 100755
index c99be1f..39ac95e
--- a/scouting/DriverRank/src/DriverRank.jl
+++ b/scouting/DriverRank/src/DriverRank.jl
@@ -1,3 +1,5 @@
+#!/usr/bin/env julia
+
 module DriverRank
 
 using CSV
@@ -100,9 +102,11 @@
     return result
 end
 
-function rank()
-    # TODO(phil): Make the input path configurable.
-    df = DataFrame(CSV.File("./data/2022_madtown.csv"))
+function rank(
+    input_csv::String,
+    output_csv::String,
+)
+    df = DataFrame(CSV.File(input_csv))
 
     rank1 = "Rank 1 (best)"
     rank2 = "Rank 2"
@@ -133,10 +137,18 @@
             :score=>Optim.minimizer(res),
         ) |>
         x -> sort!(x, [:score], rev=true)
-    # TODO(phil): Save the output to a CSV file.
-    show(ranking_points, allrows=true)
+
+    # Uncomment to print the results on the console as well.
+    #show(ranking_points, allrows=true)
+
+    CSV.write(output_csv, ranking_points)
 end
 
 export rank
 
+# Run the program if this script is being executed from the command line.
+if abspath(PROGRAM_FILE) == @__FILE__
+    rank(ARGS[1], ARGS[2])
+end
+
 end # module