Commit 48f6dcd4 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Rename UIC to EVA. EVA IDs are often (but not always!) UIC IDs

parent 33ce867b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -87,10 +87,10 @@ If the changes you made are suitable for inclusion in Travel::Status::DE::IRIS,
please [open a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) afterwards.

Please only include stations which are usable with DB IRIS, that is, which have
both DS100 and UIC numbers. If
both DS100 and EVA numbers. If

```
curl -s https://iris.noncd.db.de/iris-tts/timetable/station/UICNUMBER
curl -s https://iris.noncd.db.de/iris-tts/timetable/station/EVANUMBER
```

and
@@ -101,3 +101,6 @@ curl -s https://iris.noncd.db.de/iris-tts/timetable/station/DS100

return a `<station>` element with "name", "eva" and "ds100" attributes, you're
good to go.

Note that although EVA numbers are often identical with UIC station IDs,
there are stations where this is not the case.
+1 −1
Original line number Diff line number Diff line
@@ -724,7 +724,7 @@ Returns a list of hashes describing related stations whose
arrivals/departures are included in B<results>. Only useful when setting
B<with_related> to a true value, see its documentation above for details.

Each hash contains the keys B<uic> (UIC/EVA number; known as IBNR in Germany),
Each hash contains the keys B<uic> (EVA number; often same as UIC station ID),
B<name> (station name), and B<ds100> (station code). Note that stations
returned by B<related_stations> are not necessarily known to
Travel::Status::DE::IRIS::Stations(3pm).
+2 −1
Original line number Diff line number Diff line
@@ -1141,7 +1141,8 @@ Name of the station this train result belongs to.

=item $result->station_uic

UIC number of the station this train result belongs to.
EVA number of the station this train result belongs to.
This is often, but not always, identical with the UIC station number.

=item $result->stop_no

+4 −4
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ for my $station (@{$stations}) {
			"['%s','%s',%s,%s,%s],\n",
			$station->{ds100},
			$station->{name},
			$station->{uic},
			$station->{eva},
			$station->{latlong}[1],
			$station->{latlong}[0],
		);
@@ -57,7 +57,7 @@ for my $station (@{$stations}) {
			"['%s','%s',%s],\n",
			$station->{ds100},
			$station->{name},
			$station->{uic}
			$station->{eva}
		);
	}
}
@@ -205,7 +205,7 @@ that it may contain space characters.

=item * Station name

=item * International station number (UIC number / IBNR, "Internationale Bahnhofsnummer")
=item * EVA station number (often, but not always, same as UIC station number)

=item * Station longitude, if available

@@ -225,7 +225,7 @@ Returns a list of all known stations, lexically sorted by station name.

Returns a list of stations matching I<$in>.

If a I<$in> is a valid station (either DS100 code or UIC/EVA number),
If a I<$in> is a valid station (either DS100 code or EVA number),
a single array reference describing the station is returned. Otherwise,
I<$in> is passed to get_station_by_name(I<$in>) (see below).

+8 −8
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ shift @csv_lines;

for my $line (@csv_lines) {
	if ( $csv->parse($line) ) {
		my ( $name, $ds100, $uic, $lat, $lon ) = $csv->fields;
		my ( $name, $ds100, $eva, $lat, $lon ) = $csv->fields;

		if ( not $name ) {
			say "Station name is mandatory -- skipping this line: $line";
@@ -27,16 +27,16 @@ for my $line (@csv_lines) {
			say "DS100 is mandatory at the moment -- skipping this line: $line";
			next;
		}
		if ( not $uic or $uic !~ m{ ^ \d+ $ }x ) {
		if ( not $eva or $eva !~ m{ ^ \d+ $ }x ) {
			say
"UIC is mandatory and must be numeric -- skipping this line: $line";
"EVA is mandatory and must be numeric -- skipping this line: $line";
			next;
		}

		my $station = {
			name    => $name,
			ds100   => $ds100,
			uic     => 0 + $uic,
			eva     => 0 + $eva,
			latlong => undef
		};
		if ( $lat and $lon ) {
@@ -51,7 +51,7 @@ for my $line (@csv_lines) {
my $have_duplicates = 0;
my @names           = map { $_->{name} } @stations;
my @ds100           = map { $_->{ds100} } sort { $a->{ds100} cmp $b->{ds100} } @stations;
my @uic_ids         = map { $_->{uic} } sort { $a->{uic} <=> $b->{uic} } @stations;
my @eva_ids         = map { $_->{eva} } sort { $a->{eva} <=> $b->{eva} } @stations;

for my $i ( 1 .. $#names ) {
	if ( $names[ $i - 1 ] eq $names[$i] ) {
@@ -65,9 +65,9 @@ for my $i ( 1 .. $#ds100 ) {
		$have_duplicates = 1;
	}
}
for my $i ( 1 .. $#uic_ids ) {
	if ( $uic_ids[ $i - 1 ] == $uic_ids[$i] ) {
		say "Duplicate UIC ID: $uic_ids[$i]";
for my $i ( 1 .. $#eva_ids ) {
	if ( $eva_ids[ $i - 1 ] == $eva_ids[$i] ) {
		say "Duplicate EVA ID: $eva_ids[$i]";
		$have_duplicates = 1;
	}
}
Loading