Skip to content

Commit

Permalink
Merge pull request #94 from HSLdevcom/DT-5253
Browse files Browse the repository at this point in the history
DT-5253: add park and ride compatibility
  • Loading branch information
vesameskanen authored May 3, 2022
2 parents 562d26b + 6544b4c commit 142222d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 3 additions & 1 deletion middleware/confidenceScoreDT.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var confidenceAddressParts = {
var layers = [
'neighbourhood',
'bikestation',
'bikepark',
'carpark',
'stop',
'venue',
'address',
Expand Down Expand Up @@ -352,7 +354,7 @@ function checkLanguageNames(text, doc, stripNumbers, tryGenitive) {
* @returns {number}
*/
function checkName(text, parsedText, hit) {
var docIsVenue = hit.layer === 'venue' || hit.layer === 'stop' || hit.layer === 'station' || hit.layer === 'bikestation';
var docIsVenue = hit.layer === 'venue' || hit.layer === 'stop' || hit.layer === 'station' || hit.layer === 'bikestation' || hit.layer === 'carpark' || hit.layer === 'bikepark';

// parsedText name should take precedence if available since it's the cleaner name property
var name = parsedText ? parsedText.name || parsedText.query : null;
Expand Down
8 changes: 5 additions & 3 deletions pelias.json.docker
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"version": "1.0",
"requestRetries": 0,
"targets": {
"canonical_sources": ["openstreetmap", "openaddresses", "nlsfi", "gtfs", "citybikes"],
"canonical_sources": ["openstreetmap", "openaddresses", "nlsfi", "gtfs", "citybikes", "carparks", "bikeparks"],
"layers_by_source": {
"nlsfi": ["venue", "stop", "station"],
"gtfs": ["stop", "station"],
"citybikes": ["bikestation"]
"citybikes": ["bikestation"],
"carparks": ["carpark"],
"bikeparks": ["bikepark"]
},
"source_aliases": {
"gtfs": ["gtfs"],
Expand Down Expand Up @@ -114,7 +116,7 @@
"streetNumberValidator": "^[0-9].*$",
"translations": "/opt/pelias/api/translations.json",
"equalCharMap": {
"":"e",
"é":"e",
"'":"",
"-":" "
},
Expand Down
10 changes: 8 additions & 2 deletions sanitizer/_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var targetError = function(target, target_list) {

function sanitizeId(rawId, messages) {
var parts = rawId.split(ID_DELIM);

if ( parts.length < 3 ) {
messages.errors.push( formatError(rawId) );
return;
Expand All @@ -30,10 +29,16 @@ function sanitizeId(rawId, messages) {
source = 'gtfs';
} else if(source.indexOf('citybikes') === 0) {
source = 'citybikes';
} else if(source.indexOf('carparks') === 0) {
source = 'carparks';
} else if(source.indexOf('bikeparks') === 0) {
source = 'bikeparks';
}
var layer = parts[1];
var id = parts.slice(2).join(ID_DELIM);



// check if any parts of the gid are empty
if (_.includes([source, layer, id], '')) {
messages.errors.push( formatError(rawId) );
Expand All @@ -50,8 +55,9 @@ function sanitizeId(rawId, messages) {
return;
}


return {
source: source === 'gtfs' || source === 'citybikes' ? parts[0] : type_mapping.source_mapping[source][0],
source: source === 'gtfs' || source === 'citybikes' || source === 'carparks' || source === 'bikeparks' ? parts[0] : type_mapping.source_mapping[source][0],
layer: layer,
id: id,
};
Expand Down
4 changes: 4 additions & 0 deletions sanitizer/_sources_and_layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function _sanitize( raw, clean ){
source = 'gtfs'; // map gtfs<feedid> to plain gtfs
} else if (source.indexOf('citybikes') === 0) {
source = 'citybikes';
} else if (source.indexOf('carparks') === 0) {
source = 'carparks';
} else if (source.indexOf('bikeparks') === 0) {
source = 'bikeparks';
}
var layers_for_source = type_mapping.layers_by_source[source];
clean.layers.forEach(function(layer) {
Expand Down
8 changes: 6 additions & 2 deletions translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -5322,7 +5322,9 @@
"stop":"hållplats",
"station":"station",
"street":"gata",
"bikestation":"Stadscykelstation"
"bikestation":"Stadscykelstation",
"carpark":"Infartsparkering",
"bikepark":"Anslutningsparkering för cyklar"
},
"__category": {
"waterway": "vattnen",
Expand Down Expand Up @@ -5449,7 +5451,9 @@
"stop":"pysäkki",
"station":"asema",
"street":"katu",
"bikestation":"Kaupunkipyöräasema"
"bikestation":"Kaupunkipyöräasema",
"carpark":"Liityntäpysäköinti",
"bikepark":"Liityntäpyöräparkki"
},
"__category": {
"waterway": "vesistö",
Expand Down

0 comments on commit 142222d

Please sign in to comment.