This commit is contained in:
Tykayn 2023-08-05 17:24:40 +02:00 committed by tykayn
parent c099f827a6
commit d342c1e689
11 changed files with 10755 additions and 3229 deletions

View File

@ -11,10 +11,7 @@
]
},
"properties": {
"nom_amenageur": "ELECTRA",
"siren_amenageur": "891624884",
"consolidated_commune": "S\u00e9r\u00e9zin-du-Rh\u00f4ne",
"consolidated_is_lon_lat_correct": true
"accessibilite_pmr":"Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30"
}
}
]

View File

@ -40,7 +40,7 @@ const MappingIRVE: MappingConfigType = {
// ******* dates
date_mise_en_service: 'start_date',
date_maj: 'source:date',
// date_maj: 'source:date',
// TODO gestion des types dont on doit convertir la valeur
// ******** champs booléens
@ -77,23 +77,23 @@ const MappingIRVE: MappingConfigType = {
// accessibilite_pmr: 'wheelchair',
// paiement_cb: 'payment:credit_cards',
accessibilite_pmr: {
key_converted: "wheelchair",
conditional_values: {
"Accessibilité inconnue": {
// value_converted: "",
ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à Accessibilité inconnue.
// transform_function : (original_value) => original_value.toLowerCase(),
},
"Accessible mais non réservé PMR": {
value_converted: "yes"
},
"Réservé PMR": {
value_converted: "yes"
},
"Non accessible": {
value_converted: "no"
},
// accessibilite_pmr: {
// key_converted: "wheelchair",
// conditional_values: {
// "Accessibilité inconnue": {
// // value_converted: "",
// ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à Accessibilité inconnue.
// // transform_function : (original_value) => original_value.toLowerCase(),
// },
// "Accessible mais non réservé PMR": {
// value_converted: "yes"
// },
// "Réservé PMR": {
// value_converted: "yes"
// },
// "Non accessible": {
// value_converted: "no"
// },
// "Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30": {
// value_converted: "Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30"
// },
@ -113,8 +113,8 @@ const MappingIRVE: MappingConfigType = {
// Mo-Fr 09:00-16:00
// Mo-Fr 08:00-12:00,Mo-Fr 14:00-18:00,Th 08:00-18:00
}
},
// }
// },
station_deux_roues: {
remove_original_key: true,
conditional_values: {
@ -132,6 +132,10 @@ const MappingIRVE: MappingConfigType = {
}
// "nom_amenageur": "ELECTRA",
// "siren_amenageur": "891624884",
// "consolidated_commune": "S\u00e9r\u00e9zin-du-Rh\u00f4ne",
// "consolidated_is_lon_lat_correct": true,
// "cable_t2_attache": "True"
// "goal": "jeu de données pour tester la mapping engine",
// "prise_type_2": "yes",

View File

@ -251,15 +251,21 @@ export default class {
let keysConditionnalValues: any = Object.keys(configObject.conditional_values)
let isFoundValue = keysConditionnalValues.indexOf(originalValue)
debugLog('isFoundValue', isFoundValue)
debugLog('keysConditionnalValues', keysConditionnalValues)
console.log('isFoundValue', isFoundValue, originalValue)
console.log('keysConditionnalValues', keysConditionnalValues)
if (isFoundValue !== -1) {
if (isFoundValue > -1) {
let conditionnalConfig: any = configObject.conditional_values[keysConditionnalValues[isFoundValue]]
/** ----------------------
* gestion des valeurs conditionnelles
* ---------------------- */
console.log('conditionnalConfig', conditionnalConfig)
if (conditionnalConfig.ignore_this_data) {
console.log(`on ignore cette clé car sa valeur "${originalValue}" est à exclure: `, pointKeyName, '=>', newKey)
remove_original_key = true;
}
if (conditionnalConfig.tags_to_add) {
// on peut définir un ensemble de tags à rajouter
let tagKeys = Object.keys(conditionnalConfig.tags_to_add)
@ -305,11 +311,11 @@ export default class {
}
debugLog('convertProperty: convertedValue ==========> {', newKey, ':', convertedValue, '}')
debugLog(' =============== remove_original_key', remove_original_key)
console.log(' =============== remove_original_key',newKey, remove_original_key)
if (!remove_original_key && newKey && convertedValue && !configObject.ignore_this_data) {
debugLog('convertProperty: added')
newProperties[newKey] = convertedValue
newProperties[newKey] = convertedValue.trim()
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -11,19 +11,7 @@
]
},
"properties": {
"amenity": "charging_station",
"operator": "ELECTRA",
"owner:ref:FR:SIREN": "891624884",
"email": "help@electra.com",
"network": "ELECTRA",
"socket:type2_combo": "yes",
"fee": "false",
"authentication:none": "true",
"reservation": "yes",
"opening_hours": "24/7",
"wheelchair": "Accessibilité inconnue",
"start_date": "2022-10-27",
"source:date": "2023-07-29"
"amenity": "charging_station"
}
}
]