From bc58a552b1be29d0f11d6856da60282034339e96 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 19 Jun 2024 01:55:08 +0200 Subject: Add logic to replace field value literals. And set them to NULL. --- config.yml | 80 +++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 16 deletions(-) (limited to 'config.yml') diff --git a/config.yml b/config.yml index 6587643..450cc5f 100644 --- a/config.yml +++ b/config.yml @@ -228,8 +228,21 @@ layers: # - field_name1 # - field_name2 # field-map: +# source_field_name1: field_name1 # source_field_name2: field_name2 -# source_field_name2: field_name2 +# +# # Mapping of (source) field values, to replace particular +# # values with something else. Useful for instance to replace +# # the empty string with NULL. +# value-map: +# source_field_name1: +# - from: '' +# to: null +# - from: 'foo' +# to: 'bar' +# source_field_name2: +# - from: 0 +# to: 1 'lansyta': description: Sveriges län (Lantmäteriet) @@ -521,9 +534,9 @@ layers: - name: Beteckn type: String width: 12 - #unique: true - # TODO: map "Visas ej" to NULL - nullable: false + unique: true + # obfuscated codes are mapped to NULL + nullable: true #comment: ärendebeteckning - name: ArendeAr type: Integer @@ -611,6 +624,10 @@ layers: Forebild: Forebild Efterbild: Efterbild Arealha: ArealHa + value-map: + Beteckn: + - from: 'Visas ej' + to: null - source: download: @@ -642,6 +659,10 @@ layers: Forebild: Forebild Efterbild: Efterbild Arealha: ArealHa + value-map: + Beteckn: + - from: 'Visas ej' + to: null - source: download: @@ -673,6 +694,10 @@ layers: Forebild: Forebild Efterbild: Efterbild Arealha: ArealHa + value-map: + Beteckn: + - from: 'Visas ej' + to: null - source: download: @@ -702,6 +727,10 @@ layers: Forebild: Forebild Efterbild: Efterbild Arealha: ArealHa + value-map: + Beteckn: + - from: 'Visas ej' + to: null 'st:betesomraden': source: @@ -807,8 +836,7 @@ layers: #comment: när tillståndets giltighet slutar - name: DiaryNr type: String - # TODO map empty string to NULL - #unique: true + unique: true width: 16 - name: LastUpdated # TODO convert to Date @@ -832,6 +860,10 @@ layers: 'Valid to': ValidTo 'Diary nr': DiaryNr 'Last updated': LastUpdated + value-map: + 'Diary nr': + - from: '' + to: null 'mrr:markanvisningar': description: Markanvisning till koncession (SGU) @@ -845,12 +877,10 @@ layers: #comment: benämning på området - name: DecisionDate type: Date - # TODO map empty string to NULL #comment: beslutsdatum - name: DiaryNr type: String - # TODO map empty string to NULL - #unique: true + unique: true width: 16 - name: LastUpdated # TODO convert to Date @@ -871,6 +901,13 @@ layers: 'Decision date': DecisionDate 'Diary nr': DiaryNr 'Last updated': LastUpdated + value-map: + 'Decision date': + - from: '' + to: null + 'Diary nr': + - from: '' + to: null 'mrr:mineral_applied': description: Undersökningstillstånd, metallar och mineral, ansökta (SGU) @@ -959,8 +996,7 @@ layers: #comment: när tillståndets giltighet slutar - name: DiaryNr type: String - # TODO map empty string to NULL - #unique: true + unique: true width: 16 - name: LastUpdated # TODO convert to Date @@ -985,6 +1021,10 @@ layers: 'Valid to': ValidTo 'Diary nr': DiaryNr 'Last updated': LastUpdated + value-map: + 'Diary nr': + - from: '' + to: null # 'mrr:mineral_expired': # source: @@ -1100,8 +1140,7 @@ layers: #comment: när tillståndets giltighet slutar - name: DiaryNr type: String - # TODO map empty string to NULL - #unique: true + unique: true width: 16 - name: LastUpdated # TODO convert to Date @@ -1126,6 +1165,10 @@ layers: 'Valid to': ValidTo 'Diary nr': DiaryNr 'Last updated': LastUpdated + value-map: + 'Diary nr': + - from: '' + to: null 'mrr:torvkoncessioner': description: Torvkoncessioner (SGU) @@ -1140,7 +1183,6 @@ layers: #comment: benämning på området - name: Mineral type: String - # TODO map empty string to NULL width: 254 #comment: koncessionsmineral - name: Owner @@ -1158,8 +1200,7 @@ layers: #comment: när tillståndets giltighet slutar - name: DiaryNr type: String - # TODO map empty string to NULL - #unique: true + unique: true width: 16 - name: LastUpdated # TODO convert to Date @@ -1183,3 +1224,10 @@ layers: 'Valid to': ValidTo 'Diary nr': DiaryNr 'Last updated': LastUpdated + value-map: + 'Mineral': + - from: '' + to: null + 'Diary nr': + - from: '' + to: null -- cgit v1.2.3