Issue 18316

Backbone ids not stable after builds

18316
Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: Backbone ids not stable after builds
Priority: Blocker
Resolution: Fixed
Status: Closed
Created: 2016-03-10 20:08:28.565
Updated: 2016-03-21 15:57:39.419
Resolved: 2016-03-10 21:26:25.706
        
Description: When a new backbone is built we must try hard to keep usage keys stable.
We use the canonical name, rank, kingdom and authorship to match to a previously existing usage, even if it was deleted before (we would then resurrect the id).

In case there are undistinguishable usages the IdGenerator fails and just creates a new identifier instead of picking one of the existing according to some rule. For example the following existing usages cause problems:

{noformat}
3241527, Rank.GENUS, Kingdom.ANIMALIA, "Cardinalis Bonaparte, 1838
2490383, Rank.GENUS, Kingdom.ANIMALIA, "Cardinalis Bonaparte, 1831
3232102, Rank.GENUS, Kingdom.PLANTAE, "Cardinalis Fabricius, 1759
2490384, Rank.SPECIES, Kingdom.ANIMALIA, "Cardinalis cardinalis (Linnaeus, 1758)
4846779, Rank.SPECIES, Kingdom.ANIMALIA, "Cardinalis cardinalis (Linnaeus, 1758)
{noformat}

The genus Cardinalis Bonaparte and the species Cardinalis cardinalis (Linnaeus, 1758) are currently conflated and for both a new id is generated.]]>
    


Author: mdoering@gbif.org
Created: 2016-03-10 20:10:03.456
Updated: 2016-03-10 20:10:03.456
        
In total we have 950.341 new ids and 315.931 deleted ones

    


Author: mdoering@gbif.org
Created: 2016-03-10 21:26:25.719
Updated: 2016-03-10 21:26:25.719
        
idlookup now tries an exact match first. and if we still have multiple ambigous matches it selects the oldest=lowest id to stay

https://github.com/gbif/checklistbank/commit/06f6039ef0772730a6d1d37abc6ee9de8e92251f
    


Author: mdoering@gbif.org
Created: 2016-03-11 09:47:22.875
Updated: 2016-03-11 09:55:52.311
        
lates nub has right ids:
{noformat}
 3241527 | GENUS | ACCEPTED | Cardinalis                 |
 2490383 | GENUS | ACCEPTED | Cardinalis Bonaparte, 1831 | 2016-03-11 02:30:37.803967
 3232102 | GENUS | DOUBTFUL | Cardinalis Fabricius, 1759 |
 8245481 | GENUS | DOUBTFUL | Cardinalis Jarocki, 1821   |
 7635491 | GENUS | DOUBTFUL | Cardinalis Rupp.           |
{noformat}

Author is still missing

{noformat}
   id    |  rank   |  status  |            scientific_name             |          deleted
---------+---------+----------+----------------------------------------+---------------------------
 4846779 | SPECIES | ACCEPTED | Cardinalis cardinalis (Linnaeus, 1758) | 2016-03-11 02:32:20.04576
 2490384 | SPECIES | ACCEPTED | Cardinalis cardinalis (Linnaeus, 1758) |
{noformat}