Call a Different Endpoint

Learn about available API endpoints and how to quickly call a different one.

ScienceIO's API currently has the following endpoints available:

📘

If you are calling the API via HTTP, you must use dashes instead of underscores. So for HTTP users, the endpoints you should use in your code are structure, identify-phi, and redact-phi.

Call a Different Endpoint

Making a request to a different endpoint is as easy as updating one or two lines of code.

📘

For additional help, see Make an API Call (Python SDK) or Make an API Call (HTTP).

Python SDK

Update the scio.structure() part of your code to the endpoint you wish to call.

For example, instead of response = scio.structure(query_text) as shown here:

from scienceio import ScienceIO
scio = ScienceIO()

query_text = """Patient: John Doe
Address: 112 First Ave, New York, NY
Phone: 555-555-1212
Admission date: December 13, 2022
Diagnosis: UTI
Physician: Dr. Jane Smith
NPI: 1234567890
Physician number: 555-555-9876
Clinical note:
Mr. Doe is a 75-year-old male with a history of urinary tract infections.
He presented to the Pearson clinic today with symptoms of dysuria and frequency.
A urine culture was performed by Dr. Jones and showed significant growth of Escherichia coli.
The patient was started on a course of oral antibiotics and will follow up with
the clinic in one week for a repeat urine culture.
If no improvement, patient will be referred to St. Joseph Hospital."""

#calling the structure endpoint
response = scio.structure(query_text)

print(response)

Use response = scio.identify_phi(query_text) instead:

from scienceio import ScienceIO
scio = ScienceIO()

query_text = """Patient: John Doe
Address: 112 First Ave, New York, NY
Phone: 555-555-1212
Admission date: December 13, 2022
Diagnosis: UTI
Physician: Dr. Jane Smith
NPI: 1234567890
Physician number: 555-555-9876
Clinical note:
Mr. Doe is a 75-year-old male with a history of urinary tract infections.
He presented to the Pearson clinic today with symptoms of dysuria and frequency.
A urine culture was performed by Dr. Jones and showed significant growth of Escherichia coli.
The patient was started on a course of oral antibiotics and will follow up with
the clinic in one week for a repeat urine culture.
If no improvement, patient will be referred to St. Joseph Hospital."""

response = scio.identify_phi(query_text)

print(response)

HTTP

Update the link in line 1 of the code to the endpoint you wish to call, and update the last line of the text as follows:

  • If calling the structure or structure-ontologies endpoints, leave the last line as text
  • If calling the identify-phi or redact-phi endpoints, change the last line to query_text

📘

The change to input_text is part of a larger standardization of underlying schemas. It is currently in use with the identify-phi and redact-phi endpoints, and will be rolled out to other endpoints in future releases.

For example, instead of curl https://api.aws.science.io/v2/structure and text as shown here:

curl https://api.aws.science.io/v2/structure \
  --request POST \
  --header "Content-type: application/json" \
  --header "x-api-id: $SCIENCEIO_KEY_ID" \
  --header "x-api-secret: $SCIENCEIO_KEY_SECRET" \
  --data '{ "text": "Patient: John Doe\nAddress: 112 First Ave, New York, NY\nPhone: 555-555-1212\nAdmission date: December 13, 2022\nDiagnosis: UTI\nPhysician: Dr. Jane Smith\nNPI: 1234567890\nPhysician number: 555-555-9876\nClinical note: Mr. Doe is a 75-year-old male with a history of urinary tract infections. He presented to the Pearson clinic today with symptoms of dysuria and frequency. A urine culture was performed by Dr. Jones and showed significant growth of Escherichia coli.The patient was started on a course of oral antibiotics and will follow up with the clinic in one week for a repeat urine culture.If no improvement, patient will be referred to St. Joseph Hospital."}'

Use curl https://api.aws.science.io/v2/identify-phi and input_text:

curl https://api.aws.science.io/v2/identify-phi \
  --request POST \
  --header "Content-type: application/json" \
  --header "x-api-id: $SCIENCEIO_KEY_ID" \
  --header "x-api-secret: $SCIENCEIO_KEY_SECRET" \
  --data '{ "input_text": "Patient: John Doe\nAddress: 112 First Ave, New York, NY\nPhone: 555-555-1212\nAdmission date: December 13, 2022\nDiagnosis: UTI\nPhysician: Dr. Jane Smith\nNPI: 1234567890\nPhysician number: 555-555-9876\nClinical note: Mr. Doe is a 75-year-old male with a history of urinary tract infections. He presented to the Pearson clinic today with symptoms of dysuria and frequency. A urine culture was performed by Dr. Jones and showed significant growth of Escherichia coli.The patient was started on a course of oral antibiotics and will follow up with the clinic in one week for a repeat urine culture.If no improvement, patient will be referred to St. Joseph Hospital."}'

Make sure your GET request also uses the correct endpoint in line 1:

curl https://api.aws.science.io/v2/identify-phi/<REQUEST_ID> \
  --request GET \
  --header "x-api-id: $SCIENCEIO_KEY_ID" \
  --header "x-api-secret: $SCIENCEIO_KEY_SECRET"