Structure

The structure endpoint identifies and structures all of the healthcare concepts in your query text.

When you submit text to the ScienceIO API via this endpoint, our AI analyzes the query text, identifies all text that refers to healthcare concepts, and directly maps each piece of text to the appropriate concept using an array of dictionaries under spans. Each dictionary uses keys to map the healthcare information found in the text.

How to Call the Endpoint

Web App

You can call the structure endpoint from the Analyze - Web App without needing to use code. See Analyze - Web App for more details.

Python SDK

After initializing the ScienceIO client, use the scio.structure() method to submit the request, which will ask the API to examine query_text, identify all healthcare concepts, and return the results.

#initialize the ScienceIO client
from scienceio import ScienceIO
scio = ScienceIO()

#call the endpoint
query_text = "The patient was diagnosed with CHF and renal failure and administered statins."
#specify the structure endpoint here
response = scio.structure(query_text)
print(response)

Optional:

Format the response to be more readable, as is seen in the sample JSON response on this page. To do so, use the following code instead of print(response):

# Format the JSON response and print
# Use instead of print(response)
import json
print(json.dumps(response, indent=2))

JSON Response

In this example, the query text included four pieces of healthcare information (“patient,” “CHF,” “renal failure,” and “statins”), so the API returned four dictionaries to map each one.

{
  "text": "The patient was diagnosed with CHF and renal failure and administered statins.",
  "spans": [
    {
      "concept_id": "UMLS:C0086418",
      "concept_name": "Homo sapiens",
      "concept_type": "Species & Viruses",
      "pos_end": 11,
      "pos_start": 4,
      "score_id": 0.9999945163726807,
      "score_type": 0.9999994039535522,
      "text": "patient"
    },
    {
      "concept_id": "UMLS:C0018801",
      "concept_name": "Heart failure",
      "concept_type": "Medical Conditions",
      "pos_end": 34,
      "pos_start": 31,
      "score_id": 0.997938334941864,
      "score_type": 0.9998775720596313,
      "text": "CHF"
    },
    {
      "concept_id": "UMLS:C0035078",
      "concept_name": "Kidney Failure",
      "concept_type": "Medical Conditions",
      "pos_end": 52,
      "pos_start": 39,
      "score_id": 0.9999425411224365,
      "score_type": 0.9999667406082153,
      "text": "renal failure"
    },
    {
      "concept_id": "UMLS:C0360714",
      "concept_name": "Hydroxymethylglutaryl-CoA Reductase Inhibitors",
      "concept_type": "Chemicals & Drugs",
      "pos_end": 77,
      "pos_start": 70,
      "score_id": 0.9997879862785339,
      "score_type": 0.9999738931655884,
      "text": "statins"
    }
  ]
}

Key:Value Pairs

Code Examples