Skip to content

Commit

Permalink
chore: Update emoji mapping based on new emoji 2022/23
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieboldianus committed Aug 2, 2023
1 parent b6b073c commit 5355830
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions resources/mappings/field_mapping_inaturalist_gbif.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"Panthera pardus": ("Leopard", "🐅"),
"Felis catus": ("Cat", "🐈"),
"Equus ferus": ("Horse", "🐎"),
"Equus africanus": ("Donkey", "🫏"),
"Ovis aries": ("Sheep", "🐑"),
"Capra hircus": ("Goat", "🐐"),
"Sus domesticus": ("Pig", "🐖"),
Expand Down Expand Up @@ -81,6 +82,7 @@
"Capsicum annuum": ("Bell Pepper", "🫑"),
"Palaemon serratus": ("Shrimp", "🦐"),
"Nelumbo nucifera": ("Lotus", "🪷"),
"Zingiber officinale": ("Ginger", "🫚"),
}
TAX_GENUS = {
"Rattus": ("Rat", "🐀"),
Expand Down Expand Up @@ -143,6 +145,10 @@
"Tilia": ("Deciduous", "🌳"),
"Ulmus": ("Deciduous", "🌳"),
"Larix": ("Deciduous conifer", "🌲"),
"Alces": ("Moose", "🫎"),
"Anser": ("Goose", "🪿"),
"Branta": ("Goose", "🪿"),
# "Turdus": ("Blackbird", "🐦‍⬛"),
}
TAX_FAMILY = {
"Cercopithecidae": ("Monkey", "🐒"),
Expand Down Expand Up @@ -187,6 +193,9 @@
"Sauropodidae": ("Dinosaur", "🦕"),
"Nephropidae": ("Lobster", "🦞"),
"Ostreidae": ("Oyster", "🦪"),
"Plethodontidae": ("Lizard", "🦎"),
"Talitridae": ("Insects/Bug", "🐛"),
# "Icteridae": ("Blackbird", "🐦‍⬛"),
}
TAX_ORDER = {
"Fagales": ("Beeches, Oaks, Walnuts, And Allies", "🌳"),
Expand Down Expand Up @@ -218,28 +227,52 @@
"Oegopsida": ("Squid", "🦑"),
"Bathyteuthida": ("Squid", "🦑"),
"Odonata": ("Mosquitoes", "🦟"),
"Isopoda": ("Insects/Bug", "🐛"),
"Perciformes": ("Fish", "🐟"),
"Salmoniformes": ("Fish", "🐟"),
"Cypriniformes": ("Fish", "🐟"),
"Scorpaeniformes": ("Fish", "🐟"),
"Caudata": ("Lizard", "🦎"),
}
TAX_CLASS = {
"Gastropoda": ("Snail", "🐌"),
"Bivalvia": ("Mollusca", "🐚"),
"Actinopterygii": ("Fish", "🐟"),
"Elasmobranchii": ("Fish", "🐟"),
"Asteroidea": ("Fish", "🐟"),
"Aves": ("Birds", "🐦"),
"Pinopsida": ("Pines", "🌲"),
"Coniferopsida": ("Conifers", "🌲"),
"Testudines": ("Turtles", "🐢"),
"Squamata": ("Lizard", "🦎"),
"Insecta": ("Insects/Bug", "🐛"),
"Mammalia": ("Mammal", "🐾"),
"Arachnida": ("Spider", "🕷"),
"Diplopoda": ("Worm", "🪱"),
"Cubozoa": ("Jellyfish", "🪼"),
"Scyphozoa": ("Jellyfish", "🪼"),
"Staurozoa": ("Jellyfish", "🪼"),
"Hydrozoa": ("Jellyfish", "🪼"),
"Phaeophyceae": ("Corals", "🪸"),
"Crocodylia": ("Crocodiles", "🐊"),
}
TAX_PHYLUM = {
"Tracheophyta": ("plants", "🌱"),
"Annelida": ("worms", "🪱"),
"Nemertea": ("worms", "🪱"),
"Arthropoda": ("Insects/Bug", "🐛"),
"Cnidaria": ("Corals", "🪸"),
"Ochrophyta": ("Corals", "🪸"),
"Echinodermata": ("Fish", "🐟"),
}
TAX_KINGDOM = {
"Fungi": ("Mushrom", "🍄"),
"Protozoa": ("Mushrom", "🍄"),
"Archaea": ("Microbe", "🦠"),
"Plantae": ("plants", "🌱"),
"Bacteria": ("Microbe", "🦠"),
"Viruses": ("Microbe", "🦠"),
"Chromista": ("Corals", "🪸"),
}

TAX_EMOJI = {
Expand Down Expand Up @@ -447,13 +480,14 @@ def extract_gbif_occurrence(self, record):
if emoji:
post_record.emoji.extend([emoji])
lbsn_records.append(post_record)
if post_guid == "7145128":
input(f"Record: {record} \n\nemoji : {emoji}")
return lbsn_records

@staticmethod
def strip_occurence_guid(occurrence_id: str) -> str:
"""Strip inaturalist prefix from occurrence guid"""
prefix = "https://www.inaturalist.org/observations/"
return occurrence_id[len(prefix) :]
return occurrence_id.rsplit("/", 1)[-1]

def gbif_extract_postlatlng(self, lat_entry: str, lng_entry: str) -> str:
"""Basic routine for extracting lat/lng coordinates from post.
Expand Down Expand Up @@ -554,6 +588,10 @@ def map_species_emoji(
```
SELECT * FROM topical.post WHERE array_length(emoji, 1) > 0;
```
- for updating empty mappings:
```
SELECT emoji,post_url,array_length(emoji, 1) AS ct FROM topical.post ORDER BY ct DESC
```
[1]: https://symbl.cc/en/emoji/animals-and-nature/
[2]: https://www.gbif.org/species/5510
Expand All @@ -578,5 +616,5 @@ def get_dict_entry(record, tax_emoj):
for tax_level in level_list:
tax_level_dict = tax_emoj.get(tax_level)
match_test = tax_level_dict.get(record.get(tax_level))
if match_test is not None:
if match_test:
return match_test[1]

0 comments on commit 5355830

Please sign in to comment.