hubmapconsortium / ontology-api

The HuBMAP Ontology Service
MIT License
4 stars 3 forks source link

Backend support for Ontology search widget #88

Closed ChuckKollar closed 2 years ago

ChuckKollar commented 3 years ago

We need three new RESTful endpoint methods to support the ontology search widget.

We need a method each to search for Codes, Concepts, and Terms (a.k.a Item) each of which returns a list of items each containing a code, concept, tty (term type), term and optionally (may be missing or blank in a response) rel (relationship type, like isa or part_of). Additional, optional parameters to constrain the query are 1) relationship types (e.g, isa, or part_of), and/or 2) terminology sets (e.g, UBERON, FMA, CCF). Terms come in two flavors, attached to a code or attached to a concept via pref_term relationship, which for the later case there will be no code information returned (blank code_id, code_sab, code).

The three WS methods are defined as:

  1. {{ontology_url}}/codes/<code>/terms?code_sab=sab1,sab2,sab3&relationship=*[sabA],rel2[sabB],rel3[*] Example response:

    [
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "x-ray abnormal",
            "rel_type":"rel1",
            "rel_sab":"relA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal x-rays",
            "rel_type":"rel2",
            "rel_sab":"sabC"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal xrays",
            "rel_type":"rel1",
            "rel_sab":"sabA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "PT",
            "term": "abnormal x-ray",
            "rel_type":"rel1",
            "rel_sab":"sabC"
        },
        {
            "code_id": "MDR 10048065",
            "code_sab":"MDR",
            "code":"10048065",
            "concept": "C0000766",
            "tty": PT,
            "term": "X-ray abnormal",
            "rel_type":"rel3",
            "rel_sab":"sabB"
        }
    ]
  2. {{ontology_url}}/concepts/<concept>/terms?code_sab=sab1,sab2,sab3&relationship=*[sabA],rel2[sabB],rel3[*] Example response:

    [
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "x-ray abnormal",
            "rel_type":"rel1",
            "rel_sab":"relA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal x-rays",
            "rel_type":"rel2",
            "rel_sab":"sabC"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal xrays",
            "rel_type":"rel1",
            "rel_sab":"sabA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "PT",
            "term": "abnormal x-ray",
            "rel_type":"rel1",
            "rel_sab":"sabC"
        },
        {
            "code_id": "MDR 10048065",
            "code_sab":"MDR",
            "code":"10048065",
            "concept": "C0000766",
            "tty": PT,
            "term": "X-ray abnormal",
            "rel_type":"rel3",
            "rel_sab":"sabB"
        }
    ]
  3. {{ontology_url}}/terms/<term>/terms?code_sab=sab1,sab2,sab3&relationship=*[sabA],rel2[sabB],rel3[*] Example response:

    [
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "x-ray abnormal",
            "rel_type":"rel1",
            "rel_sab":"relA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal x-rays",
            "rel_type":"rel2",
            "rel_sab":"sabC"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "SY",
            "term": "abnormal xrays",
            "rel_type":"rel1",
            "rel_sab":"sabA"
        },
        {
            "code_id": "CHV 0000000540",
            "code_sab":"CHV",
            "code":"0000000540",
            "concept": "C0000766",
            "tty": "PT",
            "term": "abnormal x-ray",
            "rel_type":"rel1",
            "rel_sab":"sabC"
        },
        {
            "code_id": "MDR 10048065",
            "code_sab":"MDR",
            "code":"10048065",
            "concept": "C0000766",
            "tty": PT,
            "term": "X-ray abnormal",
            "rel_type":"rel3",
            "rel_sab":"sabB"
        }
    ]