humlab-sead / sead_query_api

.NET Core port of Query SEAD API
Other
2 stars 0 forks source link

Wrong number of analysis entities returned for a site? #113

Closed johanvonboer closed 8 months ago

johanvonboer commented 8 months ago

The /result/load endpoint returns a list of sites with their number of analysis entities. However several sites seem to have an incorrect number, e.g. site 5604 which the server says only have 1 analysis entity, but when I access it at https://supersead.humlab.umu.se/site/5604 it seems it actually has 3 analysis entities in 3 datasets (one AE in each).

Are AE's not summarized across datasets for a site?

roger-mahler commented 8 months ago

The method associated to two of the entities has no assigned record type i.e. the record_type_id is set to null. In total five methods has no associated record type. SQL queries having tbl_record_types inner joined will be filtered out.

SELECT  tbl_sites.site_name AS alias_1,
        tbl_record_types.record_type_name AS alias_2,
        tbl_analysis_entities.analysis_entity_id AS alias_3,
        tbl_sites.site_id AS alias_4,
        tbl_sites.site_id AS alias_5,
        tbl_sites.site_name AS alias_6
FROM tbl_analysis_entities
INNER JOIN tbl_physical_samples ON tbl_physical_samples."physical_sample_id" = tbl_analysis_entities."physical_sample_id"
INNER JOIN tbl_sample_groups ON tbl_sample_groups."sample_group_id" = tbl_physical_samples."sample_group_id"
INNER JOIN tbl_sites ON tbl_sites."site_id" = tbl_sample_groups."site_id"
INNER JOIN tbl_datasets ON tbl_datasets."dataset_id" = tbl_analysis_entities."dataset_id"
INNER JOIN tbl_methods ON tbl_methods."method_id" = tbl_datasets."method_id"
INNER JOIN tbl_record_types ON tbl_record_types."record_type_id" = tbl_methods."record_type_id" 
WHERE 1 = 1
  AND tbl_sites.site_id::text in ('5604')
roger-mahler commented 8 months ago

Methods Cal, CalAMS, GeolPer, IRMS, AE lack record_type_id. Since the facet groups results by record_type_name we could either: