Skip to content

Instantly share code, notes, and snippets.

@timrobertson100
Last active August 29, 2015 14:06
Show Gist options
  • Save timrobertson100/9b8d23ac0bff444059a3 to your computer and use it in GitHub Desktop.
Save timrobertson100/9b8d23ac0bff444059a3 to your computer and use it in GitHub Desktop.

This explains the dip we are seeing on Plantae on http://oliver.gbif.org/global/

SELECT
  occ1.k, occ1.cnt, occ2.cnt, occ2.cnt - occ1.cnt as increase
FROM
  (SELECT COALESCE(kingdom, 'UNKNOWN') AS k, count(*) AS cnt 
   FROM occurrence_20140908 GROUP BY kingdom) occ1 
JOIN
  (SELECT COALESCE(kingdom, 'UNKNOWN') AS k, count(*) AS cnt 
   FROM occurrence_20140918 GROUP BY kingdom) occ2 
ON occ1.k=occ2.k
   Kingdom       08th Sept      18th Sept      Increase
--------------------------------------------------------
Animalia        355,522,879    354,137,322    -1,385,557
Archaea         14,270         14,267         -3
Bacteria        1,031,114      1,015,350      -15,764
Chromista       2,061,204      2,016,988      -44,216
Fungi           8,930,097      8,875,396      -54,701
Plantae         130,321,342    124,761,883    -5,559,459
Protozoa        4,575,256      4,590,060      14,804
UNKNOWN         4,614,451      10,857,394     6,242,943
Viruses         7,938          7,936          -2
incertae sedis  848,537        831,785        -16,752

So, looking for things that were plants but now unknown:

SELECT
  occ1.dataset_id, count(*) AS count  
FROM
  occurrence_20140908 occ1
JOIN
  occurrence_20140918 occ2
ON occ1.id = occ2.id
WHERE COALESCE(occ2.kingdom, 'UNKNOWN') = 'UNKNOWN' AND COALESCE(occ1.kingdom, 'UNKNOWN') = 'Plantae'
GROUP BY occ1.dataset_id

We find that the French NHM have lost all their plants: http://www.gbif.org/occurrence/search?DATASET_KEY=b5cdf794-8fa4-4a85-8b26-755d087bf531&ISSUE=TAXON_MATCH_NONE

And if we look at the record, we see they are now using the identification extension only, and not mapping the latest names to the core: http://www.gbif.org/occurrence/1019617425/verbatim

I think I saw some helpdesk stuff on this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment