Project

General

Profile

« Previous | Next » 

Revision 10380

inputs/BRIT/specimen_flat/: translated single-column filters to postprocessing derived columns, using the steps at wiki.vegpath.org/Switching_to_new-style_import#stage-I-source-specific > "translate single-column filters to postprocessing derived columns"

View differences:

inputs/BRIT/specimen_flat/postprocess.sql
1 1
SELECT util.search_path_append('util');
2 2

  
3 3
SELECT create_if_not_exists($$ALTER TABLE $$||:table_str||$$ ADD PRIMARY KEY (specimen_id)$$);
4

  
5
SELECT mk_derived_col((:table_str, 'occurrenceRemarks'),
6
$$CASE WHEN "Locality_Description" IS NOT NULL THEN "Notes_Plant" END$$)
7
; -- runtime: 0.3 s ("Time: 311.190 ms") @starscream
inputs/BRIT/specimen_flat/map.csv
32 32
Project_Name,projectName,,
33 33
Locality_Summary,locality,/_join/1,
34 34
Locality_Description,locality,/_join/2,
35
Locality_Description,occurrenceRemarks,"/_if[@name=""if has Locality_Description""]/cond",
36 35
Locality_Site_Specific,locality,/_join/3,
37 36
Habitat_Description,habitat,/_join/1,
38 37
Habitat_Summary,habitat,/_join/2,
39 38
Soil_Description,*Soil_Description,,
40
Notes_Plant,occurrenceRemarks,"/_if[@name=""if has Locality_Description""]/then",
39
Notes_Plant,occurrenceRemarks_verbatim,,
41 40
Phenology_Stage,reproductiveCondition,,
42 41
Height_Min,height_m,/_avg/1,Assuming units based on the range and precision of values
43 42
Height_Max,height_m,/_avg/2,Assuming units based on the range and precision of values
......
60 59
Year_Identified,yearIdentified,,
61 60
Month_Identified,monthIdentified,,
62 61
Day_Identified,dayIdentified,,
62
occurrenceRemarks,occurrenceRemarks,,
inputs/BRIT/specimen_flat/VegBIEN.csv
26 26
Day_Collected,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/day/_nullIf:[null=0,type=float]/value",
27 27
Month_Collected,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/month/_nullIf:[null=0,type=float]/value",
28 28
Year_Collected,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/year/_nullIf:[null=0,type=float]/value",
29
Locality_Description,"/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1/_if[@name=""if has Locality_Description""]/cond",
30
Notes_Plant,"/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1/_if[@name=""if has Locality_Description""]/then",
29
occurrenceRemarks,/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1,
31 30
Collection_Number,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/authorplantcode/_first/2,
32 31
Phenology_Stage,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/reproductivecondition,
33 32
Catalog_Number,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/else",
......
100 99
Global_Unique_Identifier,,** No non-empty join mapping for UNUSED#Global_Unique_Identifier ** 
101 100
Infra_Rank,,** No join mapping for infraspecificRank ** 
102 101
Local_Name,,** No join mapping for vernacularName ** 
102
Notes_Plant,,** No join mapping for occurrenceRemarks_verbatim ** 
103 103
Research_Site_Name,,** No join mapping for *Research_Site_Name ** 
104 104
Soil_Description,,** No join mapping for *Soil_Description ** 
105 105
Subclass_Name,,** No join mapping for *subclass ** 
inputs/BRIT/specimen_flat/test.xml.ref
80 80
                                            </2>
81 81
                                        </_alt>
82 82
                                    </collectiondate>
83
                                    <notes>
84
                                        <_if name="if has Locality_Description">
85
                                            <cond>$Locality_Description</cond>
86
                                            <then>$Notes_Plant</then>
87
                                        </_if>
88
                                    </notes>
83
                                    <notes>$occurrenceRemarks</notes>
89 84
                                    <plantobservation>
90 85
                                        <authorplantcode>$Collection_Number</authorplantcode>
91 86
                                        <reproductivecondition>$Phenology_Stage</reproductivecondition>
inputs/BRIT/specimen_flat/new_terms.csv
18 18
Subregion_Name,county,,
19 19
Locality_Summary,locality,/_join/1,
20 20
Locality_Description,locality,/_join/2,
21
Locality_Description,occurrenceRemarks,"/_if[@name=""if has Locality_Description""]/cond",
22 21
Locality_Site_Specific,locality,/_join/3,
23 22
Habitat_Description,habitat,/_join/1,
24 23
Habitat_Summary,habitat,/_join/2,
25
Notes_Plant,occurrenceRemarks,"/_if[@name=""if has Locality_Description""]/then",
24
Notes_Plant,occurrenceRemarks_verbatim,,
26 25
Phenology_Stage,reproductiveCondition,,
27 26
Height_Min,height_m,/_avg/1,Assuming units based on the range and precision of values
28 27
Height_Max,height_m,/_avg/2,Assuming units based on the range and precision of values
inputs/BRIT/specimen_flat/unmapped_terms.csv
3 3
vernacularName
4 4
*Research_Site_Name
5 5
*Soil_Description
6
occurrenceRemarks_verbatim
6 7
basisOfRecord
7 8
*Duplicates
8 9
modified

Also available in: Unified diff