Skip to content

expose search facets via ws

Justin Clark-Casey edited this page Aug 8, 2017 · 5 revisions

Expose search facets on webservice

Date of creation: 2017-07-18

Status: On hold, since the underlying code change (get facet information) would require more work than expected.

https://github.com/intermine/intermine/issues/1632 is a request to expose search facet information via a public endpoint.

A requirement is that this is extensible in the future (when other search information needs to be exposed).

Design alternatives:

1. Create a new endpoint to expose this information.

Possibly search/config returning JSON. Something like

{
   "properties":{
     "facets":{
       "Category":[
         "MRNAExpressionTerm",
         "Transcript",
         "Mutagen",
         "..."
       ],
       "Organism":[
         "E. coli",
         "B. subtilis",
         "..."
       ]
     ]
   }
}

Pros:

  • Endpoint is search only, which might be more self-documenting

Cons:

  • One of a number of config exposing endpoints that may be necessary as BlueGenes adds functionality

2. Create a new endpoint to expose this information but make it general

So other similar config information can be added in the future. Possibly info/ returning JSON. Something like

{
   "properties":{
     "search":{
       "facets":[
         "Category":[
           "MRNAExpressionTerm",
           "Transcript",
           "Mutagen",
           "..."
         ],
         "Organism":[
           "E. coli",
           "B. subtilis",
           "..."
         ]
       ]
     }
   }
}

Pros:

  • Endpoint is for general config, which aims to prevent a proliferation of similar endpoints in the future.

Cons:

  • branding/ already exists and appears to have precedent for this information. Having two similar endpoints is not a great thing, though it wouldn't be hard to also serve the branding/ "defaults" key/value pairs on info/

3. Alternatively, search config info could be incorporated into the existing branding/ endpoint.

The name 'branding' is bad but it looks like the "defaults" property may already set a precedent.

Current example:

{
   "properties":{
      "defaults":{
         "identifiers":"eve, zen, bib, r, h",
         "value":"eve",
         "class":"Gene",
         "extraValue":{
            "extraFor":"SequenceFeature",
            "value":"D. melanogaster",
            "path":"organism.shortName",
            "class":"Organism"
         }
      },
      "colors":{
         "focus":{
            "fg":"#fff",
            "bg":"#5c0075;"
         },
         "header":{
            "text":"#fff",
            "main":"#5c0075"
         },
         "main":{
            "fg":"#535353;",
            "bg":"#fff"
         }
      },
      "images":{
         "logo":"http://www.flymine.org/flymine/model/images/logo.png",
         "small":"model/images/logo.png",
         "main":"model/images/logo.png"
      }
   },
   "executionTime":"2017.07.18 16:20::51",
   "wasSuccessful":true,
   "error":null,
   "statusCode":200
}

New would be

{
   "properties":{
      "defaults":{
         "identifiers":"eve, zen, bib, r, h",
         "value":"eve",
         "class":"Gene",
         "extraValue":{
            "extraFor":"SequenceFeature",
            "value":"D. melanogaster",
            "path":"organism.shortName",
            "class":"Organism"
         }
      },
      "search": {
        "facets": [
          "Category":[
            "MRNAExpressionTerm",
            "Transcript",
            "Mutagen",
            "..."
          ],
          "Organism":[
            "E. coli",
            "B. subtilis",
            "..."
          ]        
        ]
      },
      "colors":{
         "focus":{
            "fg":"#fff",
            "bg":"#5c0075;"
         },
         "header":{
            "text":"#fff",
            "main":"#5c0075"
         },
         "main":{
            "fg":"#535353;",
            "bg":"#fff"
         }
      },
      "images":{
         "logo":"http://www.flymine.org/flymine/model/images/logo.png",
         "small":"model/images/logo.png",
         "main":"model/images/logo.png"
      }
   },
   "executionTime":"2017.07.18 16:20::51",
   "wasSuccessful":true,
   "error":null,
   "statusCode":200
}

Pros:

  • Doesn't require another endpoint to expose simple information.
  • Future config exposure could also live in branding/

Cons:

  • May be less self-documenting
  • May overload branding/ with information not of interest to many callers