ncbo / bioportal-project

Serves to consolidate (in Zenhub) all public issues in BioPortal
BSD 2-Clause "Simplified" License
7 stars 5 forks source link

reduce number of Ajax calls for mappings #185

Open graybeal opened 3 years ago

graybeal commented 3 years ago

The number of Ajax calls for mappings is very high, because these are generated when an ontology summary page is visited (for whole ontology), or when a class is visited (for that class).

Reduce the number of calls for mapping, e.g, by delaying the start of mapping calls until the mapping tab is clicked; or by deleting the mappings tabs altogether (as a temporary measure for diagnosis).

Related to https://github.com/ncbo/bioportal-project/issues/184

graybeal commented 3 years ago

This seems much faster now, virtually instantaneous.

graybeal commented 2 years ago

@jvendetti Do you think this can be closed?

jvendetti commented 2 years ago

I think this should remain open and we should consider refactoring this code if time allows.

If an end user navigates to the class tree for an ontology and selects a class that has a lot of mappings (e.g., the "Event" class in SNOMEDCT), the Rails application issues hundreds of Ajax calls in order to build the display for the Class Mappings tab.

Just to flesh this out w/more detail - the following REST API call retrieves all the mappings for the Event class in SNOMEDCT:

https://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F272379006/mappings?display_context=false&display_links=false

Snippet of the resulting JSON showing a single mapping:

{
  "id": null,
  "source": "LOOM",
  "classes": [
    {
      "@id": "http://purl.bioontology.org/ontology/SNOMEDCT/272379006",
      "@type": "http://www.w3.org/2002/07/owl#Class"
    },
    {
      "@id": "http://presence-ontology.org/ontology/Event",
      "@type": "http://www.w3.org/2002/07/owl#Class"
    }
  ]

For each mapping, the Rails application issues two Ajax calls to retrieve additional information about the destination class, i.e., one call to determine the human readable ontology acronym, and one call to determine the human readable class label. The Class Mappings table structure appears as follows:

Screen Shot 2021-11-30 at 4 30 06 PM

The Event class in SNOMEDCT has 245 mappings, which results in 490 Ajax calls.