BiologicalRecordsCentre / UKBMS-online

Issue tracking for UKBMS online recording site
2 stars 0 forks source link

Species missing from Site Details #200

Closed IanMiddlebrook closed 3 years ago

IanMiddlebrook commented 3 years ago

Hi @DavidRoy,

A recorder has noted that Small Pearl-bordered Fritillary is missing from the list of species seen on her transect, when she looks at the Site Details page: https://ukbms.org/site-details-map?location_id=245429 Yet it was clearly recorded, according to the Annual Summary page and other Reports.

I doubt if this is the only discrepancy. How is the data for Site Details page produced?

Thanks, Ian

DavidRoy commented 3 years ago

@burkmarr Can you investigate this page you developed for the UKBMS. Looks like a species dictionary issue and not picking up the right names?

burkmarr commented 3 years ago

The report applies a filter to the records for a site to ensure that it retrieves only butterflies. For some reason this filter was very complex:

 select count(*) > 0 
 from (select unnest(cof.taxon_path) taxon_meaning_id) taxon_path 
 join (select taxon_meaning_id from cache_taxa_taxon_lists
 where taxon in ('Hesperiidae', 'Lycaenidae', 'Nymphalidae', 'Papilionidae', 'Pieridae', 'Riodinidae')
 and taxon_list_id=15) bfamily on taxon_path.taxon_meaning_id=bfamily.taxon_meaning_id

I don't know why I created the filter like that when this one-liner should do the job:

cof.taxon_group_id = 104

So I can update the report accordingly and Small Pearl-bordered Fritillary is included.

However, it begs the question why the more complex filter removes this species? The reason is that, for some reason, the taxon_path field in the cache_samples_functional table is not populated for Small Pearl-bordered Fritillary records. @johnvanbreda - I suppose that might affect other reports.

burkmarr commented 3 years ago

I've amended report and will post here when implemented on live site.

IanMiddlebrook commented 3 years ago

Hi, Whilst this issue is open, I've had more feedback from a volunteer. Firstly that Dingy Skipper and Chalkhill Blue were missing from her species list (which I would guess is already addressed by the change made?). But also that she would expect to see the species listed in taxonomic order - they seem to be listed in alphabetical order of scientific name. Most recorders get used to seeing species listed in taxonomic order, so this would be a welcome improvement.

Many thanks, Ian

IanMiddlebrook commented 3 years ago

Hi @DavidRoy @burkmarr I'm not sure if this is still a work in progress, but I've had a different comment back from a recorder saying that their site list includes a whole array of unusual species that have never been recorded there: https://ukbms.org/site-details-map?location_id=193315 I investigated, and discovered that, for some reason, they had entered a series of zero counts for these extra species on one date (5/9/2019). Is it possible to exclude zero counts when calculating the species (and number of records) for each site?

Thanks, Ian

burkmarr commented 3 years ago

I updated reports for this but they haven't been pulled through to the live site yet. I've scheduled some time to revisit them early next week and I will look to add the filter for negative records in.

burkmarr commented 3 years ago

I've added a filter to this report to remove any marked as zero_abundance. Also there was a major problem with the SQL which led to some species records being double or triple counted (due to a lack of filter for preferred sp name on joined taxa table) and this has been fixed. I've pulled into master branch and hope to pull into live warehouse today.

burkmarr commented 3 years ago

These fixes are pulled into the live Warehouse now. @IanMiddlebrook - does the Lin Park site look better now? https://ukbms.org/site-details-map?location_id=193315 (I didn't look at it before applying the fix.)

IanMiddlebrook commented 3 years ago

Thanks @burkmarr
Linn Park looks sensible now, an all species are present on other sites.