Add database taxon ID checking via regex/taxize
@sckott, what do you think about this:
- A method called
check_db_idof thetaxon_databaseclass that takes ataxon_id. It could optionally usetaxizeto actually check via an API call. - Methods in
taxon,hierarchy, andtaxonomythat call that method on all their taxa
When do you think this checking should occur?
- on constructors
- setters of
taxon_id, andtaxon, andtaxadescribed in #139
Can you think of any other instance where these should be checked automatically?
related to #144
Does check_db_id check if it's a valid/known ID to the specific data source? Or some other kind of check?
It would check if the ID conforms the the regex we set for whatever data source is specified by the taxon_database object. A taxon object would check the taxon_database object in its taxon_id object for which database it is from and use the regex there to determine what a valid ID is.
The taxon_database is one place where it might make sense to allow for vectors that match a name in database_list rather than require taxon_database objects, since each taxon will have separate database info for its name, id, and rank. Actually, we might want to force the taxon database to be a vector that matches a name in database_list and have a function that can add to that list for custom databases.
regex checking seems safe enough where it wouldn't add to much time, but API calls would have to be designed to fail safely i guess