BiologicalRecordsCentre / iRecord

Repository to store and track enhancements, issues and tasks regarding the iRecord website.
http://irecord.org.uk
2 stars 1 forks source link

Include recording scheme attribution on species details pages #1435

Open DavidRoy opened 1 year ago

DavidRoy commented 1 year ago

I think it would be good to recognise/link to the relevant recording schemes for species details page e.g. https://burkmar2-brc-irecord.pantheonsite.io/species-details?taxa_taxon_list_id=76635 should include a logo for BBS?

Requires a link between the UKSI and National Recording Scheme, which i believe is in the planning

burkmarr commented 1 year ago

Dependent on https://github.com/BiologicalRecordsCentre/iRecord/issues/876

burkmarr commented 1 year ago

@johnvanbreda - can you check this SQL for me - is it okay or is there a better way? I need to get from taxon_meaning_id to the RSS that have an interest.

select rs.title 
from cache_taxon_paths ctp 
join cache_taxa_taxon_lists cttl on cttl.taxon_meaning_id = ANY(ctp.path) and cttl.taxon_list_id = 15 and cttl.preferred = true 
join recording_scheme_taxa rst on rst.organism_key = cttl.organism_key 
join recording_schemes rs on rs.id = rst.recording_scheme_id 
where 
ctp.taxon_meaning_id=106116 
johnvanbreda commented 1 year ago

@burkmarr the query looks good to me and works pretty quickly. Looking at the EXPLAIN ANALYZE there is a sequential scan on recording_scheme_taxa.organism_key which may not matter if the table remains small, but adding an index on this field would be slightly more efficient.

burkmarr commented 1 year ago

@johnvanbreda @JimBacon - can I ask your advice on a question of workflow? I have created a new warehouse report 'reports/library/taxa/taxon_rss.xml' which returns the RSS associated with a taxon meaning id. This is on the live warehouse, but not committed to a repo. I was thinking I would add it it with the hotfeature workflow:

However I can see that the remote master has other changes not yet pulled to the live warehouse, so I was unsure about doing this. I also noticed that there are a number of other untracked reports on the warehouse. What's the best way to proceed?

johnvanbreda commented 1 year ago

Thanks for checking @burkmarr - your steps are correct.

The changes in master that are not yet on the live warehouse relate to fixes to the CORS header behaviour that were required for the new server. Since they were done just before the originally intended server move and we had tested them with the headers that are going to be configured on the new server, even though they should be OK on the live server in theory I had decided not to pull them in case it broke the apps. We could pull them, but it means a small risk that the changes won't work on the current live server. As we are about to migrate it could be less risky if you do your first 4 steps, then just leave the untracked report on the live warehouse and don't pull. The new warehouse will then pick up the new report from GitHub. In order for this to work you need to make sure you add a tag to the warehouse master branch (v8.23.7) so we know it is a new minor version.

I've removed a couple of my untracked reports which were used for a temporary re-population of some ES data.

@BirenRathod there are some reports in a folder reports/reports_for_prebuilt_forms/european/ which are not in GitHub and I think are not used - I'm not sure who added them, but there are no references in the request log data so it looks like they are redundant. Perhaps keep a backup of these before the server migration just in case?

burkmarr commented 1 year ago

@johnvanbreda - many thanks, I've done as you suggested, including the tag.

BirenRathod commented 1 year ago

@johnvanbreda It may have been used in the european-mammals.brc.ac.uk website. Not sure at present as I need to check those first.

BirenRathod commented 1 year ago

Or european-ladybird.brc.ac.uk?

burkmarr commented 1 year ago

@DavidRoy @kitenetter - You can see the initial implementation of this here: https://burkmar3-brc-irecord.pantheonsite.io/species-details.

The completion of #876 has enable me to add a form control [rss] that lists the RSS associated with a taxon (via the UKSI). Here I've placed it under the species details control, but this can be changed if preferred.

There are three possible scenarios for any given taxon:

The first two cases are treated the same - the RSS appear in a bulleted list under the heading Recording schemes & societies. Where no RSS is associated with a taxon, the following message is displayed under the heading: No societies are listed in the UK Species Inventory for this taxon.

Some issues have occurred to me since implementing and testing the control.

SCHEME_KEY SCHEME_NAME
NHMSYS0021567699 Acari Recording Scheme
NHMSYS0021567700 Aquatic Heteroptera Recording Scheme
NHMSYS0021567701 Auchenorrhyncha Recording Scheme
NHMSYS0021567702 Barkfly Recording Scheme
NHMSYS0021567703 Bees, Wasps and Ants Recording Society
NHMSYS0021567704 British Arachnological Society, Harvestman Recording Scheme
NHMSYS0021567705 British Arachnological Society, Pseudoscorpion Recorders' Group
NHMSYS0021567706 British Arachnological Society, Spider Recording Scheme
NHMSYS0021567707 British Dragonfly Society, Dragonfly Recording Network
NHMSYS0021567708 British Dragonfly Society, Migrant Dragonfly Project
NHMSYS0021567709 British Myriapod and Isopod Group, Centipede Recording Scheme
NHMSYS0021567710 British Myriapod and Isopod Group, Millipede Recording Scheme
NHMSYS0021567711 British Myriapod and Isopod Group, Woodlice & Waterlice Recording Scheme
NHMSYS0021567712 British Trust for Ornithology
NHMSYS0021567713 Chrysomelidae Recording Scheme
NHMSYS0021567714 Cladocera Interest Group
NHMSYS0021567715 Clown Beetles Recording Scheme
NHMSYS0021567716 Collembola Recording Scheme
NHMSYS0021567717 Crambidae & Pyralidae Recording Scheme
NHMSYS0021567718 Dermestidae Recording Scheme
NHMSYS0021567719 Dipterists Forum, Anthomyiid Recording Scheme
NHMSYS0021567720 Dipterists Forum, Calliphoridae and Rhiniidae Recording Scheme
NHMSYS0021567721 Dipterists Forum, Chironomidae Study Group
NHMSYS0021567722 Dipterists Forum, Chloropid Study Group
NHMSYS0021567723 Dipterists Forum, Conopidae, Lonchopteridae & Picture-winged Fly Recording Scheme
NHMSYS0021567724 Dipterists Forum, Cranefly Recording Scheme
NHMSYS0021567725 Dipterists Forum, Dixidae and Thaumaleidae Recording Scheme
NHMSYS0021567726 Dipterists Forum, Empididae, Hybotidae & Dolichopodidae Recording Scheme
NHMSYS0021567727 Dipterists Forum, Flat-footed Fly Recording Scheme
NHMSYS0021567728 Dipterists Forum, Fungus Gnat Recording Scheme
NHMSYS0021567729 Dipterists Forum, Hoverfly Recording Scheme
NHMSYS0021567730 Dipterists Forum, Pipunculidae Study Group
NHMSYS0021567731 Dipterists Forum, Sepsid Recording Scheme
NHMSYS0021567732 Dipterists Forum, Snail-killing Flies Recording Scheme
NHMSYS0021567733 Dipterists Forum, Stilt and Stalk Fly Recording Scheme
NHMSYS0021567734 Dipterists Forum, Tachinid Recording Scheme
NHMSYS0021567735 Dipterists Forum, Tephritid Flies Recording Scheme
NHMSYS0021567736 Earthworm Society of Britain: National Earthworm Recording Scheme
NHMSYS0021567737 Elateroidea Recording Scheme
NHMSYS0021567738 Freshwater Fish Recording Scheme
NHMSYS0021567739 Freshwater Flatworm Recording Scheme
NHMSYS0021567740 Gelechiid Recording Scheme
NHMSYS0021567741 Grasshoppers and Related Insects Recording Scheme
NHMSYS0021567742 Ground Beetle Recording Scheme
NHMSYS0021567743 Hypogean Crustacea Recording Scheme
NHMSYS0021567744 Incurvarioidea Recording Scheme
NHMSYS0021567745 Lacewings and Allies Recording Scheme
NHMSYS0021567746 Mammal Society
NHMSYS0021567747 Mosquitoes Recording Scheme
NHMSYS0021567748 National Agromyzidae Recording Scheme
NHMSYS0021567749 National Amphibian & Reptile Recording Scheme
NHMSYS0021567750 National Bat Monitoring Programme
NHMSYS0021567751 National Longhorn Beetle Recording Scheme
NHMSYS0021567752 Oestridae Recording Scheme
NHMSYS0021567753 Parasitic Wasps Recording Scheme
NHMSYS0021567754 Plume Moth Recording Scheme
NHMSYS0021567755 Psylloidea Recording Scheme
NHMSYS0021567756 Riverfly Recording Schemes: Ephemeroptera
NHMSYS0021567757 Riverfly Recording Schemes: Plecoptera
NHMSYS0021567758 Riverfly Recording Schemes: Trichoptera
NHMSYS0021567759 Sawfly Recording Scheme
NHMSYS0021567760 Scarabaeoidea Recording Scheme
NHMSYS0021567761 Scathophagid Recording Scheme
NHMSYS0021567762 Scirtidae Recording Scheme
NHMSYS0021567763 Silphidae Recording Scheme
NHMSYS0021567764 Siphonaptera Recording Scheme
NHMSYS0021567765 Soldier Beetles, Jewel Beetles and Glow-worms Recording Scheme
NHMSYS0021567766 Soldierflies and Allies Recording Scheme
NHMSYS0021567767 Staphylinidae Recording Scheme
NHMSYS0021567768 Stenini Recording Scheme
NHMSYS0021567769 Tenebrionoidea Recording Scheme
NHMSYS0021567770 Terrestrial Flatworm Recording Scheme
NHMSYS0021567771 Terrestrial Heteroptera Recording Scheme - Plant bugs and allied species
NHMSYS0021567772 Terrestrial Heteroptera Recording Scheme - Shield bugs and allied species
NHMSYS0021567773 Tick Surveillance Scheme
NHMSYS0021567774 UK Ladybird Survey
NHMSYS0021567775 Weevil and Bark Beetle Recording Scheme
DavidRoy commented 1 year ago

Worked well for the ladybird example I tried https://burkmar3-brc-irecord.pantheonsite.io/species-details?taxa_taxon_list_id=171090

but not a plant https://burkmar3-brc-irecord.pantheonsite.io/species-details?taxa_taxon_list_id=235730

or moth example https://burkmar3-brc-irecord.pantheonsite.io/species-details?taxa_taxon_list_id=46973

burkmarr commented 1 year ago

@DavidRoy - those RSS appear to be missing from the data supplied to us by Chris (see my comment above). I think Steph worked with him to come up with the initial list? Regardless, we need to establish how this information will be supplied to Chris so that he can update and maintain it in the UKSI.

DavidRoy commented 1 year ago

@burkmarr that's suprising as these schemes are a single point on the taxon tree? Can you work with Martin to update?

kitenetter commented 1 year ago

@burkmarr will have a look at the new tables when I get a chance, but may not be for a little while.

burkmarr commented 1 year ago

Okay @kitenetter. I've put a copy of the SCHEME table from the latest UKSI snapshot here if it helps: W:_BRC_Recording Schemes liaison\UKSI 20230901a SCHEME.xlsx

Presumably the workflow would be for us to supply Chris with a list of the missing RSS and an indication of the taxonomic group(s) covered. He can then update the SCHEME and SCHEME_TAXA tables in the UKSI and supply it back to us. I can then run the scripts to update our own recording_schemes and recording_scheme_taxa tables.