Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Use the scientific name if no generic name is present #28

Merged
merged 2 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GBIF"
uuid = "ee291a33-5a6c-5552-a3c8-0f29a1181037"
authors = ["Timothée Poisot <timothee.poisot@umontreal.ca>"]
version = "0.2.1"
version = "0.2.2"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
12 changes: 9 additions & 3 deletions src/types/GBIFRecords.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ function GBIFRecord(o::Dict{String, Any})
end
end

this_name = o["genericName"]
if !ismissing(get(o, "specificEpithet", missing))
this_name *= " "*get(o, "specificEpithet", missing)
# The name of the taxon is the generic name + specific epithet, but if the
# generic name is asbent, this defaults to the scientificName.
if !ismissing(get(o, "genericName", missing))
this_name = o["genericName"]
if !ismissing(get(o, "specificEpithet", missing))
this_name *= " "*get(o, "specificEpithet", missing)
end
else
this_name = o["scientificName"]
end

this_record_taxon = GBIFTaxon(
Expand Down