~ihabunek/triglav

ref: 0d810ed3f097c611840f7ded5d949562fbcd405c triglav/lib/triglav_web/templates/zet/routes/index.html.eex -rw-r--r-- 3.8 KiB
0d810ed3Ivan Habunek Simplify naming 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<main role="main" class="container-wide">
  <h1>ZET Routes Validation</h1>

  <p>Compares ZET GTFS data with existing OSM relations.</p>

  <section class="callout">
    <p>Zagreb public transport relations are found by looking for relations tagged with <span class="tag">[type=route]</span> or <span class="tag">[type=route_master]</span> in combination with <span class="tag">[operator=ZET]</span> or <span class="tag">[operator=Zagrebački Električni Tramvaj]</span>.</p>

    <p>Routes are matched by comparing the route number with the <span class="tag">ref=*</span> tag on selected relations.</p>

    <p>If no relations are found, it may be due to them not being correctly tagged.</p>
  </section>

  <section class="callout warning">
    <p>These errors are generated based on some rules which may not be perfect.</p>
    <p>Think about what you're doing, don't blindly correct all errors. If you're unsure, first discuss on the osm_hr <a href="http://lists.openstreetmap.org/listinfo/talk-hr">mailing list</a> or <a href="https://t.me/osmhr">telegram group</a>.</p>
  </section>

  <h2>Imported data</h2>

  <div style="display: flex">
    <table>
      <tr>
        <th colspan="2">GTFS</th>
      </tr>
      <tr>
        <th>Publisher</th>
        <td>
          <a href="https://www.zet.hr/odredbe/datoteke-u-gtfs-formatu/669">
            <%= @gtfs_info.publisher_name %>
          </a>
        </td>
      </tr>
      <tr>
        <th>Date range</th>
        <td><%= @gtfs_info.start_date %> - <%= @gtfs_info.end_date %></td>
      </tr>
      <tr>
        <th>Version</th>
        <td><%= @gtfs_info.version %></td>
      </tr>
    </table>

    <table style="margin-left: 1rem">
      <tr>
        <th colspan="2">OSM</th>
      </tr>
      <tr>
        <th>Source</th>
        <td>
          <a href="https://download.geofabrik.de/europe/croatia.html">Geofabrik</a>
        </td>
      </tr>
      <tr>
        <th>Imported at</th>
        <td><%= @osm_state.timestamp %></td>
      </tr>
      <tr>
        <th>Sequence no.</th>
        <td><%= @osm_state.sequence_number %></td>
      </tr>
    </table>
  </div>

  <h2>Routes</h2>

  <table>
    <thead>
      <tr>
        <th>ID</th>
        <th>GTFS Route</th>
        <th>OSM Relations</th>
        <th>Route variants</th>
        <th>Errors</th>
      </tr>
    </thead>
    <tbody>
      <%= for {route, hierarchy, counts} <- @routes do %>
      <tr>
        <td><%= route.id %></td>
        <td>
          <a href="<%= Routes.zet_routes_path(@conn, :detail, route.id) %>">
            <%= route.long_name %>
          </a>
        </td>
        <td>
          <%= render_relation_hierarchy(hierarchy) %>
        </td>
        <td class="<%= if counts.total == counts.correct and counts.incorrect == 0, do: "success" %>">
          ZET: <%= counts.total %><br />
          Correct: <%= counts.correct %><br />
          <span class="<%= if counts.incorrect > 0, do: "text-red" %>">
            Incorrect: <%= counts.incorrect %>
          </span>
        </td>
        <td>
          <% route_errors = Map.get(@errors, route.id, []) %>
          <%= if !Enum.empty?(route_errors) do %>
          <ul>
            <%= for error <- route_errors do %>
              <li>
                <span class="text-red"><%= render_error(error) %></span>
              </li>
            <% end %>
          </ul>
          <% else %>
            <span class="text-green">OK!</span>
          <% end %>
        </td>
      </tr>
      <% end %>
    </tbody>
  </table>

  <%= if !Enum.empty?(@unmached_relations) do %>
    <h2>Unmatched relations</h2>

    <p>The following OSM relations were not matched to any GTFS route.</p>
    <ul>
      <%= for relation <- @unmached_relations do %>
      <li>
        <%= osm_link(relation, tags: ["type", "ref"], name: true) %>
      </li>
      <% end %>
    </ul>
  <% end %>
</main>