update conditional config convert to name

This commit is contained in:
Tykayn 2024-10-09 16:22:57 +02:00 committed by tykayn
parent 1b8a0c590b
commit e414600d45
6 changed files with 43 additions and 18918 deletions

View File

@ -25,14 +25,17 @@ const mappingFINESS: MappingConfigType = {
// capacite: 'capacity', // capacite: 'capacity',
// ******* textes // ******* textes
siret: 'ref:FR:SIRET', siret: 'ref:FR:SIRET',
rslongue: 'name', rslongue: {
nofinesset: 'ref:FR:FINESS_et', key_converted: 'name',
nofinessej: 'ref:FR:FINESS_ej', convert_to_name: true,
categetab: 'ref:FR:categtab', },
nofinesset: 'ref:FR:FINESS:et',
nofinessej: 'ref:FR:FINESS:ej',
// categetab: 'ref:FR:categtab',
epci_code: 'ref:FR:code_EPCI', epci_code: 'ref:FR:code_EPCI',
epci_name: 'ref:FR:EPCI', epci_name: 'ref:FR:EPCI',
codeape: 'ref:FR:NAF', // https://wiki.openstreetmap.org/wiki/FR:Key:ref:FR:NAF codeape: 'ref:FR:NAF', // https://wiki.openstreetmap.org/wiki/FR:Key:ref:FR:NAF
categtab: 'type:FR:FINESS', // categtab: 'type:FR:FINESS',
dateouv: 'start_date', dateouv: 'start_date',
dateautor: 'authorisation_date', dateautor: 'authorisation_date',
telephone: { telephone: {
@ -43,27 +46,33 @@ const mappingFINESS: MappingConfigType = {
key_converted: 'operator:fax', key_converted: 'operator:fax',
convert_to_phone: true, convert_to_phone: true,
}, },
libcategagretab: { categetab: {
remove_original_key: true, // remove_original_key: true,
conditional_value: { key_converted: 'ref:FR:FINESS:category',
"Laboratoires de Biologie M\u00e9dicale": { conditional_values: {
// "Laboratoires de Biologie Médicale": {
611: {
tags_to_add: { tags_to_add: {
"healthcare": "laboratory" "healthcare": "laboratory"
} }
}, },
"Centre Hospitalier (C.H.)": { // "Centre Hospitalier (C.H.)": {
"412": {
tags_to_add: { tags_to_add: {
"amenity": "hospital" "amenity": "hospital",
"healthcare": "hospital"
} }
}, },
"Pharmacie d'Officine": { // "Pharmacie d'Officine": {
620: {
tags_to_add: { tags_to_add: {
"amenity": "pharmacy" "healthcare": "pharmacy"
} }
}, },
"Maison de sant\u00e9 (L.6223-3)": { // "Maison de santé (L.6223-3)": {
"603": {
tags_to_add: { tags_to_add: {
"amenity": "health_house" "healthcare": "centre"
} }
}, },
} }

View File

@ -437,6 +437,9 @@ export default class {
} }
} }
if (configObject.convert_to_name) {
convertedValue = Formatters.convertToName(originalValue)
}
if (configObject.remove_original_key) { if (configObject.remove_original_key) {
remove_original_key = true remove_original_key = true
} }

View File

@ -69,4 +69,11 @@ export default class Formatters {
return ""; return "";
} }
static convertToName(originalValue: string) {
let tab = originalValue.toLowerCase().split('')
tab[0] = originalValue[0].toUpperCase()
return tab.join('');
}
} }

View File

@ -65,8 +65,13 @@ export interface FeaturePropertyMappingConfigType {
[key: string]: any, [key: string]: any,
convert_to_boolean_value?: boolean, convert_to_boolean_value?: boolean,
invert_boolean_value?: boolean,
remove_original_key?: boolean, remove_original_key?: boolean,
conditionnal_values?: ConditionnalValuesType, convert_to_phone?: boolean,
convert_to_name?: boolean,
ignore_if_falsy?: boolean,
ignore_if_truthy?: boolean,
conditional_values?: ConditionnalValuesType,
transform_function?: Function, transform_function?: Function,
} }

View File

@ -11,10 +11,10 @@
] ]
}, },
"properties": { "properties": {
"ref:FR:FINESS_et": "940008006", "ref:FR:FINESS:et": "940008006",
"ref:FR:FINESS_ej": "940007990", "ref:FR:FINESS:ej": "940007990",
"name": "PHARMACIE DU PORT", "name": "PHARMACIE DU PORT",
"ref:FR:categtab": 620, "ref:FR:FINESS:category": "620",
"ref:FR:SIRET": "33909485600020", "ref:FR:SIRET": "33909485600020",
"start_date": "2021-07-12", "start_date": "2021-07-12",
"authorisation_date": "2011-02-25", "authorisation_date": "2011-02-25",

File diff suppressed because it is too large Load Diff