Skip to content

Commit

Permalink
traffic-a22-elaborations: add some checks to metadata mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Jan 19, 2024
1 parent bc4fc2a commit 203ed1d
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,15 @@ public StationList readStationList(Connection connection) throws IOException, SQ

// add sensor type metadata field, that will be used for simplification of
// further elaborations
String stationId = code.split(":")[1];
String sensorType = sensorTypeByStation.getOrDefault(stationId, null);
if (sensorType != null && !sensorType.isEmpty()) {
metadataMap.put("sensor_type", sensorType);
String[] codes = code.split(":");
if (codes.length > 1) {
String stationId = codes[1].trim();
String sensorType = sensorTypeByStation.getOrDefault(stationId, null);
if (sensorType != null && !sensorType.isEmpty()) {
metadataMap.put("sensor_type", sensorType.trim());
}
} else {
LOG.info("Station with code {} has not correct format A22:station_id:sensor_id", code);
}

station.setMetaData(metadataMap);
Expand Down

0 comments on commit 203ed1d

Please sign in to comment.