neurobagel / query-tool

User interface for searching across Neurobagel graph
https://query.neurobagel.org/
MIT License
2 stars 1 forks source link

Query tool fails when attribute responses include a label of `null` #123

Closed surchs closed 7 months ago

surchs commented 7 months ago

We have a case where some attributes for e.g. nb:Diagnosis return instances without a label. In this case, the label key seems to have a null value.

Here is an example:

{
  "errors": [
    {
      "node_name": "International Neuroimaging Data-sharing Initiative",
      "error": "Bad Gateway: <html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.18.0 (Ubuntu)</center>\r\n</body>\r\n</html>\r\n"
    }
  ],
  "responses": {
    "nb:Diagnosis": [
      {
        "TermURL": "snomed:58214004",
        "Label": "Schizophrenia"
      },
      {
        "TermURL": "snomed:13746004",
        "Label": "Bipolar disorder"
      },
      {
        "TermURL": "snomed:406506008",
        "Label": "Attention deficit hyperactivity disorder"
      },
      {
        "TermURL": "snomed:126943008",
        "Label": "Separation anxiety"
      },
      {
        "TermURL": "snomed:370143000",
        "Label": "Major depressive disorder"
      },
      {
        "TermURL": "snomed:35919005",
        "Label": "Autism spectrum disorder"
      },
      {
        "TermURL": "snomed:238131007",
        "Label": "Overweight"
      },
      {
        "TermURL": "snomed:49049000",
        "Label": "Parkinson's disease"
      },
      {
        "TermURL": "snomed:127295002",
        "Label": "Traumatic brain injury"
      },
      {
        "TermURL": "snomed:191736004",
        "Label": "Obsessive-compulsive disorder"
      },
      {
        "TermURL": "snomed:203082005",
        "Label": "Fibromyalgia"
      },
      {
        "TermURL": "snomed:35489007",
        "Label": "Depressive disorder"
      },
      {
        "TermURL": "snomed:59770006",
        "Label": "Dyslexia"
      },
      {
        "TermURL": "snomed:268738002",
        "Label": "Specific spelling disorder"
      },
      {
        "TermURL": "snomed:397540003",
        "Label": "Visual impairment"
      },
      {
        "TermURL": "snomed:310496002",
        "Label": "Moderate depression"
      },
      {
        "TermURL": "snomed:310495003",
        "Label": "Mild depression"
      },
      {
        "TermURL": "snomed:87486003",
        "Label": "Aphasia"
      },
      {
        "TermURL": "snomed:21897009",
        "Label": "Generalized anxiety disorder"
      },
      {
        "TermURL": "snomed:25501002",
        "Label": "Social phobia"
      },
      {
        "TermURL": "snomed:77176002",
        "Label": null
      },
      {
        "TermURL": "snomed:78667006",
        "Label": "Dysthymia"
      },
      {
        "TermURL": "snomed:46206005",
        "Label": "Mood disorder"
      },
      {
        "TermURL": "snomed:74732009",
        "Label": "Mental disorder"
      },
      {
        "TermURL": "snomed:197480006",
        "Label": "Anxiety disorder"
      },
      {
        "TermURL": "snomed:37796009",
        "Label": null
      },
      {
        "TermURL": "snomed:82838007",
        "Label": null
      },
      {
        "TermURL": "snomed:110030002",
        "Label": "Concussion injury of brain"
      },
      {
        "TermURL": "snomed:192976002",
        "Label": "Progressive supranuclear palsy"
      },
      {
        "TermURL": "snomed:722964001",
        "Label": "Atypical Parkinsonism"
      },
      {
        "TermURL": "snomed:230297002",
        "Label": "Multiple system atrophy"
      },
      {
        "TermURL": "snomed:609558009",
        "Label": null
      },
      {
        "TermURL": "snomed:415238003",
        "Label": null
      }
    ]
  },
  "nodes_response_status": "partial success"
}

The query tool cannot handle a null label, because the label is used for several functional things like giving dropdown elements an id, sorting elements, displaying them, and so on.

A short time fix might be to just filter out all the options that have a null label. We probably still want to have a warning somewhere (not sure).

The real fix will be tricky. We cannot rely on nodes having good data, so we have to make the query tool able to deal with things like this.

surchs commented 7 months ago

:rocket: Issue was released in v0.2.1 :rocket: