~ihabunek/triglav

ref: 26f2c3b921aea5c0e33d1f7c4320e9e6ceb08ea0 triglav/lib/mix/tasks/triglav/generate_derived_data.ex -rw-r--r-- 488 bytes
26f2c3b9Ivan Habunek Calculate and store derived data for public transport 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
defmodule Mix.Tasks.Triglav.GenerateDerivedData do
  use Mix.Task

  @shortdoc "(re)generates data derived from imported OSM and GTFS data"

  @impl Mix.Task
  def run(_) do
    Application.put_env(:triglav, :repo_only, true)
    {:ok, _} = Application.ensure_all_started(:triglav)

    {time, _} = :timer.tc(&Triglav.Derived.PublicTransport.generate/0)
    time_seconds = :erlang.float_to_binary(time / 1_000_000, decimals: 2)
    IO.puts("Done. Took #{time_seconds} seconds")
  end
end