GTFSRealtimeViz is an OTP app that can be run by itself or as part of another application. You can send it protobuf VehiclePositions.pb files, in sequence, and then output them as an HTML fragment, to either open in a browser or embed in another view.
Example usage as stand alone:
$ iex -S mix
iex(1)> proto = File.read!("filename.pb")
iex(2)> GTFSRealtimeViz.new_message(:prod, proto, "first protobuf file")
iex(3)> File.write!("output.html", GTFSRealtimeViz.visualize(:prod, %{}))
Summary
Functions
Send protobuf files to the app's GenServer. The app can handle a series of files, belonging to different groupings (e.g., test, dev, and prod). When sending the file, you must also provide a comment (perhaps a time stamp or other information about the file), which will be displayed along with the visualization.
Renders the received protobuf files and comments into an HTML fragment that can either be opened directly in a browser or embedded within the HTML layout of another app.
Renders an HTML fragment that displays the vehicle differences between two pb files.
Types
Functions
@spec format_time_diff(time_list, time_list) :: [{time_output, time_output}] when time_list: {String.t(), DateTime.t()} | nil, time_output: Phoenix.HTML.Safe.t() | nil
@spec format_times([{String.t(), {DateTime.t(), DateTime.t()}}] | nil) :: [ Phoenix.HTML.Safe.t() ]
@spec new_message(term(), GTFSRealtimeViz.Proto.raw(), String.t()) :: :ok
Send protobuf files to the app's GenServer. The app can handle a series of files, belonging to different groupings (e.g., test, dev, and prod). When sending the file, you must also provide a comment (perhaps a time stamp or other information about the file), which will be displayed along with the visualization.
@spec visualize(term(), route_opts()) :: String.t()
Renders the received protobuf files and comments into an HTML fragment that can either be opened directly in a browser or embedded within the HTML layout of another app.
@spec visualize_diff(term(), term(), route_opts()) :: String.t()
Renders an HTML fragment that displays the vehicle differences between two pb files.