Skip to content

Commit

Permalink
Final tweaks #74
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorSteeman committed Dec 21, 2022
1 parent 5a9f9c6 commit fb04786
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions MassDigitizer/specify_merge_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,19 @@ def handleSpecifyTaxon(self, specifyTaxon):
self.logger.info('Original author and lookup author are not identical and neither is empty!')
self.logger.info('Retrieving authorship from GBIF...')

self.resolveAuthorName(original)
self.resolveAuthorName(lookup)
criterium1 = self.resolveAuthorName(original)
criterium2 = self.resolveAuthorName(lookup)
unResolved = criterium1 and criterium2
else:
if (original.author is None and lookup.author is None):
self.logger.info('Author info is missing...')
# Update authorname at Specify also
self.resolveAuthorName(original)
self.resolveAuthorName(lookup)
criterium1 = self.resolveAuthorName(original)
criterium2 = self.resolveAuthorName(lookup)
unResolved = criterium1 and criterium2
else:
self.logger.info('Original and lookup have no author data or the author is identical. ')
unResolved = False
unResolved = False

if unResolved:
# If authorship could not be resolved, add to ambivalent cases
Expand Down Expand Up @@ -308,12 +310,14 @@ def handleSpecifyTaxon(self, specifyTaxon):
lookup.duplicateSpid = original.spid
self.ambivalentCases.append(lookup)
else:
print('No duplicates found...')
print('x', end='')

def resolveAuthorName(self, taxonInstance):
"""
TODO
Method for resolve the author name of a given taxon class instance by consulting the GBIF API
CONTRACT
taxonInstance (taxon.Taxon) : Taxon class instance for which the author should be resolved
RETURNS boolean : Flag to indicate whether the resolution was succesful
"""
self.logger.info('Resolving author name...')
acceptedNameMatches = self.gbif.matchName('species', taxonInstance.fullName, self.collection.spid)
Expand Down

0 comments on commit fb04786

Please sign in to comment.