taxa icon indicating copy to clipboard operation
taxa copied to clipboard

Add database taxon ID checking via regex/taxize

Open zachary-foster opened this issue 8 years ago • 3 comments

@sckott, what do you think about this:

  1. A method called check_db_id of the taxon_database class that takes a taxon_id. It could optionally use taxize to actually check via an API call.
  2. Methods in taxon, hierarchy, and taxonomy that call that method on all their taxa

When do you think this checking should occur?

  1. on constructors
  2. setters of taxon_id, and taxon, and taxa described in #139

Can you think of any other instance where these should be checked automatically?

related to #144

zachary-foster avatar Mar 31 '18 20:03 zachary-foster

Does check_db_id check if it's a valid/known ID to the specific data source? Or some other kind of check?

sckott avatar Apr 02 '18 16:04 sckott

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.

zachary-foster avatar Apr 02 '18 16:04 zachary-foster

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

sckott avatar Apr 02 '18 22:04 sckott