diff --git a/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfile.java b/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfile.java index ec1bc5434e7..49b8df97169 100644 --- a/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfile.java +++ b/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfile.java @@ -10,18 +10,18 @@ public enum MobilityProfile { WCHAIRM("WChairM"), WCHAIRE("WChairE"), MSCOOTER("MScooter"), - VISION("Vision"), - VISIONPLUS("Vision+"), - SOME_VISION("Some-Vision"), - DEVICE_VISION("Device-Vision"), - WCHAIRM_VISION("WChairM-Vision"), - WCHAIRE_VISION("WChairE-Vision"), - MSCOOTER_VISION("MScooter-Vision"), - SOME_VISIONPLUS("Some-Vision+"), - DEVICE_VISIONPLUS("Device-Vision+"), - WCHAIRM_VISIONPLUS("WChairM-Vision+"), - WCHAIRE_VISIONPLUS("WChairE-Vision+"), - MSCOOTER_VISIONPLUS("MScooter-Vision+"); + LOW_VISION("LowVision"), + BLIND("Blind"), + SOME_LOW_VISION("Some-LowVision"), + DEVICE_LOW_VISION("Device-LowVision"), + WCHAIRM_LOW_VISION("WChairM-LowVIsion"), // Typo in CSV header + WCHAIRE_LOW_VISION("WChairE-LowVision"), + MSCOOTER_LOW_VISION("Mscooter-LowVision"), // Typo in the CSV header + SOME_BLIND("Some-Blind"), + DEVICE_BLIND("Device-Blind"), + WCHAIRM_BLIND("WChairM-Blind"), + WCHAIRE_BLIND("WChairE-Blind"), + MSCOOTER_BLIND("Mscooter-Blind"); // Typo in the CSV header private final String text; diff --git a/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfileParser.java b/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfileParser.java index 42048bf067c..11e156d1da5 100644 --- a/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfileParser.java +++ b/src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfileParser.java @@ -50,13 +50,15 @@ private static void parseRow( CsvReader reader, ImmutableTable.Builder> tableBuilder ) throws IOException { + String currentColumnHeader = ""; try { long fromNode = Long.parseLong(reader.get("Upstream Node"), 10); long toNode = Long.parseLong(reader.get("Downstream Node"), 10); var weightMap = new HashMap(); for (var profile : MobilityProfile.values()) { - weightMap.put(profile, Float.parseFloat(reader.get(profile.getText()))); + currentColumnHeader = profile.getText(); + weightMap.put(profile, Float.parseFloat(reader.get(currentColumnHeader))); } tableBuilder.put( @@ -65,7 +67,11 @@ private static void parseRow( weightMap ); } catch (NumberFormatException | NullPointerException e) { - LOG.warn("Skipping mobility profile data at line {}: missing/invalid data", lineNumber); + LOG.warn( + "Skipping mobility profile data at line {}: missing/invalid data in column {}.", + lineNumber, + currentColumnHeader + ); } } } diff --git a/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java b/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java index fd61872bf53..0cc96bd9ad3 100644 --- a/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java +++ b/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java @@ -4,16 +4,19 @@ import static org.opentripplanner.datastore.api.FileType.NETEX; import static org.opentripplanner.datastore.api.FileType.OSM; +import com.google.common.collect.ImmutableTable; import jakarta.inject.Inject; import java.io.IOException; import java.time.Duration; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.ext.emissions.EmissionsDataModel; +import org.opentripplanner.ext.mobilityprofile.MobilityProfile; import org.opentripplanner.ext.mobilityprofile.MobilityProfileParser; import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; import org.opentripplanner.framework.application.OTPFeature; @@ -106,7 +109,10 @@ public static GraphBuilder create( if (mobilityDataSource.isPresent()) { // Parse stuff from the mobility profile CSV try (var inputStream = mobilityDataSource.get().asInputStream()) { - osmModule.setMobilityProfileData(MobilityProfileParser.parseData(inputStream)); + ImmutableTable> mobilityProfileData = + MobilityProfileParser.parseData(inputStream); + LOG.info("Imported {} rows from mobility-profile.csv", mobilityProfileData.rowKeySet().size()); + osmModule.setMobilityProfileData(mobilityProfileData); } catch (IOException e) { throw new RuntimeException(e); }