Pythia Call in Postman

API

11 min read

Pythia Call in Postman
Prerequisites
GraphQL Query
Variables
Example Request in Postman
Response
Pythia Call without Question
Output without Question

Postman is an API platform that simplifies API usage. Here’s how you can call Pythia from Postman.

Prerequisites

Ensure you have Postman installed. You can download it here.

GraphQL Query

The GraphQL query structure to query Pythia is as follows:

query askPythia($reference: [String!], $response: String!, $question: String) {
  askPythia(reference: $reference, response: $response, question: $question)
}

Variables

The following variables are required when making an API call:

reference: An array of strings containing detailed medical information.

response: A string summarizing the diagnosis or key information.

question: A string posing a specific question related to the medical data.

Example Request in Postman

  1. Open Postman.

    Sign in to Postman and create or log in to your account.

  2. Set up the request:

    Follow the below steps to set up a request in Postman:

  1. Select the HTTP method as POST.

  2. Enter the API endpoint URL (http://localhost:8080/graphql).

  3. Add the required headers under the Headers section:
    Content-Type: application/json
    x-api-key: {Your API Key}

  4. In the Body tab, select raw and choose JSON from the dropdown.

  5. Paste the following JSON payload into the body

{
  "query": "query askPythia($reference: [String!], $response: String!, $question: String) { askPythia(reference: $reference, response: $response, question: $question) }",
  "variables": {
    "reference": [
      "Paste your detailed medical report here"
    ],
    "response": "Enter a summary of the diagnosis or key information",
    "question": "Pose your specific question related to the medical data"
  }
}

  1. Send Request

    Send a request from the Postman interface to call ask_pythia().

Alternatively, you can also use Python to make the Pythia call programmatically:

import requests
import json

url = "http://localhost:8080/graphql"

payload = {
    "query": "query askPythia($reference: [String!], $response: String!, $question: String) {  askPythia(reference: $reference, response: $response, question: $question) }",
    "variables": {
        "reference": [
            "WJ Health Care",
            "Anatomic Pathology",
            "$21-14349",
            "One Hospital Drive, Columbia, MO 65212",
            "Phone: (573) 882-1226 Fax. (573) 884-5948",
            "SURGICAL PATHOLOGY REPORT",
            "** FINAL **",
            "Patient:",
            "Operation Date: 9/15/2021",
            "Patient ID: (am)",
            "Accession Date: 9/16/2021",
            "Service: General Surgery Oncology",
            "Signout Date: 9/21/2021",
            "Location: Oncology",
            "Facility: University of MO Hospital (a",
            "Attending Physician: Zihao Wu, M.D.",
            "DOB: ey",
            "Other Physician(s): {None Given}",
            "Sex: GEE",
            "FINAL DIAGNOSIS:",
            "1. COLON AND OSTOMY, TAKEDOWN: BENIGN SKIN AND COLONIC TISSUE",
            "ONE BENIGN LYMPH NODE (0/1)",
            "2. RECTUM AND ANUS, ABDOMINAL PERINEAL RESECTION: INVASIVE ADENOCARCINOMA, MODERATELY DIFFERENTIATED",
            "GREATEST DIMENSION INCLUDING TREATMENT EFFECTS - 4 CM",
            "ADENOCARCINOMA INVADES THROUGH MUSCULARIS PROPRIA INTO PERICOLORECTAL TISSUE",
            "PARTIAL TREATMENT RESPONSE (SCORE 2)",
            "ADENOCARCINOMA AND TREATMENT EFFECTS PRESENT AT CIRCUMFERENTIAL MARGIN",
            "ONE OF NINETEEN LYMPH NODES, POSITIVE FOR ADENOCARCINOMA (1/19)",
            "PLEASE SEE ATTACHED TUMOR CHECKLIST FOR ADDITIONAL INFORMATION",
            "3. SOFT TISSUE, RIGHT ANTERIOR ADDITIONAL MARGIN, EXCISION: FOCIALLY POSITIVE FOR ADENOCARCINOMA WITH ADJACENT TREATMENT EFFECTS",
            "4. SOFT TISSUE, RIGHT LATERAL SIDEWALL, EXCISION: FOCIALLY POSITIVE FOR ADENOCARCINOMA WITH ADJACENT TREATMENT EFFECTS",
            "By this signature, | attest that the above diagnosis is based upon my personal examination of the tissue and slides (and/or other material indicated in the diagnosis), per policy. A resident was invoived in the pathologic evaluation of this case, | have reviewed and edited the findings of the resident.",
            "Van Thi Nguyen, M.D.",
            "** Electronically Signed Out **",
            "Diagnosis Comment Slides 2C and 2F: tumor at soft tissue circumferential margins.",
            "Page 1 of 4",
            "$21-14349",
            "$21-14349",
            "a Specimen(s) Received 1: COLON AND OSTOMY 2: ANUS AND RECTUM 3: RIGHT ANTERIOR ADDITIONAL MARGIN 4: RIGHT LATERAL SIDEWALL Histo NOT PROVIDED ON REQUISITION Gross Description In formalin are four specimens. Specimen #1, labeled "colon and ostomy\\\" is an 8.5 cm long segment of colon with a circumference of 2.7 cm. The specimen is closed on the ostomy side with a suture line, and the opposite side is open, with scant attached mesentery. Opening the bowel longitudinally reveals unremarkable mucosa. The ostomy end is inked blue, and the opposite end is inked black. There is a 0.6 x 0.5 x 0.3 cm polypoid lesion. Samples are submitted as follows: 1A - longitudinal section of ostomy site 1B - opposite resection margin, en face 1C - polypoid lesion 1D - five possible lymph nodes 1E - representative section of unremarkable bowel Specimen #2, labeled "anus and rectum" is a 28.5 cm long segment of colon with a circumference of 2.6 cm. The proximal end is closed with a 3.7 cm long staple line, and the distal end is closed with a suture line. The mesorectal envelope is incomplete. The proximal margin is inked blue and distal margin is inked green. The soft tissue below the peritoneal reflection margin is inked black. Surrounding the anus is a 5.5 x 2.5 cm piece of unremarkable skin. Opening the bowel longitudinally reveals an ill-defined, 4 x 2 x 2. cm, nearly circumferetial, erythemous lesion with a 1.5 x 1.3 cm area of ulceration. The mass is 18.2 cm from the proximal resection margin, 5 cm from the distal resection margin, abuts the mesorectal margin, and 2 cm proximal to the dentate line. The mass is right below the anterior peritoneal reflection. The mass invades into the surrounding fat. The remainder of the colonic mucosa is unremarkable. In the pericolonic fat, twenty-six lymph nodes are found ranging in size from 0.9 x 0.7 x 0.4 to 0.3 x 0.3 x 0.2 cm. Samples are submitted as foltows: 2A - longitudinal proximal margin 2B - longitudinal distal margin 2C-2F - mass to area of deepest invasion 2G-2H - sequential section of mass to adjacent mucosa 21-2J - sequential section of mass to adjacent mucosa 2K-2L - sequential section of mass to adjacent mucosa 2M - uninvolved colon mucosa 2N - five lymph nodes in total 20 - seven lymph nodes in total qa. Page 2 of 4 $21-14349 $21-14349 aeiRD, 2P - six lymph nodes in total 2Q - six lymph nodes in total 2R - two lymph nodes bisected, one inked green-black Specimen #3, labeled "right anterior additional margin" is a 2.2 x 0.8 x 0.6 cm unoriented, tan-brown cauterized piece of soft tissue. Serial sections from along the long axis are submitted entirely in 3A. Specimen #4, labeled "right lateral sidewall\\\" is a 3.2 x 1.2 x 1.5 cm portion of tan-brown soft tissue, with one side cauterized. The cauterized side is inked black. The specimen is serially sectioned perpendicular to the cauterized side, and submitted entirely in 4A-4B. (Iw) Liangli Wang, M.D. Microscopic Description SPECIMEN Procedure: Right hemicolectomy Macroscopic Evaluation of Mesorectum: Incomplete TUMOR Tumor Site: Rectum Rectal Tumor Location: Entirely below anterior peritoneal reflection Histologic Type: Adenocarcinoma Histologic Grade: G2, moderately differentiated Tumor Size: Greatest dimension (Centimeters): 4 cm Tumor Extent: Invades through muscularis propria into pericolorectal tissue Macroscopic Tumor Perforation: Not identified Lymphovascular Invasion: Not identified Perineural Invasion: Not identified Treatment Effect: Present, with residual cancer showing evident tumor regression, but more than single Cells or rare smail groups of cancer cells (partial response, score 2) MARGINS Margin Status for Invasive Carcinoma: Cannot be determined: Additional right anterior and right lateral margins (part 3 and 4) were focally positive for addenocarcinoma. However, due to the focal nature of the tumor present in these specimens, the true cicumferetial margin is probably free, but needs to be correlated with operative findings. Margin Status for Non-Invasive Tumor: All margins negative for high-grade dysplasia / intramucosal carcinoma and low-grade dysplasia REGIONAL LYMPH NODES Regional Lymph Node Status: Tumor present in regional lymph node(s) Number of Lymph Nodes with Tumor: 1 Number of Lymph Nodes Examined: 20 Tumor Deposits: Not identified PATHOLOGIC STAGE CLASSIFICATION (pTNM, AJCC 8th Edition) TNM Descriptors: y (post-treatment) pT Category: pT3: Tumor invades through the muscularis propria into pericolorectal tissues pN Category: pN1a: One regional lymph node is positive Page 3 of 4 $21-14349 $21-14349 'The periormanca characteviancs of Oe 1 staers ated i tes report (¥ Bry) ware determined by the Unireraty af Masoun Department of Pathology They hava not oven cleared oF approved by the US Food and Orug Aanuristraton Tha FDA haa determeved that such

Response

{
    "data": {
        "askPythia": {
            "claims": [
                {
                    "claim": [
                        "65 year old female",
                        "presented with",
                        "pT3 pN1a moderately differentiated adenocarcinoma of rectum"
                    ],
                    "class": "entailment"
                },
                {
                    "claim": [
                        "pT3 pN1a moderately differentiated adenocarcinoma of rectum",
                        "is",
                        "TNM stage of the cancer"
                    ],
                    "class": "entailment"
                },
                {
                    "claim": [
                        "Presentation of pT3 pN1a moderately differentiated adenocarcinoma of rectum",
                        "occurred on",
                        "9/15/2021"
                    ],
                    "class": "entailment"
                }
            ],
            "metrics": {
                "accuracy": 1.0,
                "contradiction": 0.0,
                "entailment": 1.0,
                "neutral": 0.0
            }
        }
    }
}

Pythia Call without Question

question is an optional field. Therefore, you can structure your query accordingly to avoid errors:

query askPythia($reference: [String!], $response: String!, $question: String) {
askPythia(reference: $reference, response: $response, question: $question)
}

Output without Question

{

"data": {

"askPythia": {

"claims": [

{

"claim": [

"65 year old female",

"presented with",

"pT3 pN1a moderately differentiated adenocarcinoma of rectum"

],

"class": "neutral"

},

{

"claim": [

"pT3 pN1a moderately differentiated adenocarcinoma of rectum",

"occurred on",

"9/15/2021"

],

"class": "entailment"

}

],

"metrics": {

"accuracy": 0.666666667,

"contradiction": 0.0,

"entailment": 0.5,

"neutral": 0.5

}

}

}

}



Pythia Call in Postman
Prerequisites
GraphQL Query
Variables
Example Request in Postman
Response
Pythia Call without Question
Output without Question

© 2024 Wisecube AI

© 2024 Wisecube AI

© 2024 Wisecube AI