Closed steffilazerte closed 5 years ago
authority species_id species_id2 species_code rank
BSCDATA 16610 NULL YRWA 1
BSCDATA 16610 16620 MYWA 2
BSCDATA 16610 16630 AUWA 3
Worth noting: the primary key on species_codes is made of authority + species_code. In each authority, a alpha code is unique, but you can have multiple codes referring to the same species_id, as long as they have different ranks. When going from species_id to species_codes, you'd assume that the code with rank = 1 is the one to use.
That's totally my oversight, when I call in the species codes from the API, I have been asking individually for each authority, I didn't realize that authority was an optional argument, and that by omitting it I'd get the whole table. I'll pull in the whole table as is, and use the transposed table for internal search functions.
Actually, never mind, I don't need the transposed table at all :)
@denislepage Internally for the R package, I collect all the avian species codes for each authority, and combine them into one table.
I also make
species_id2
more informative by replace allNA
values withspecies_id
values (this is the approach you took in your R scripts).The resulting data works well for searching by alphanumeric code with the
species_code_search()
function.1) Is it okay that I've replace missing
species_id2
values withspecies_id
values? Is this something better done on the server itself?Would it be acceptable to have this single table for species metadata in the SQLite databases? Otherwise we'll add 31 tables (one for each of the species authorities)
If so, does it matter that there can be no primary key? (i.e. there is no unique column here).