Skip to content

Testing Diagnostic Agent Flow

Fast-moving development ahead!

We strive to keep our documentation accurate and up to date. However, our development cycles move quickly, and occasionally the docs may fall slightly behind. If you run into any issues or something doesn’t work as expected, please don’t hesitate to reach out — we’re here to help!

This guide walks through a complete, typical diagnostic session with the diagnostic agent. It simulates an interactive flow between a physician and the diagnostic agent, demonstrating how each step builds upon the last.

We’ll cover the following phases:

  1. Retrieving Classifications: Suggest initial medical classifications based on patient observations.
  2. Refining Classifications: Update the initial set based on follow-up observations or clarifications.
  3. Refining Treatments: Retrieve and refine treatment plans based on finalized classifications.

At each stage, you can inspect the agent’s full output and understand the logic behind its recommendations.


Initial Requirements

Ensure you’ve set up and started your local environment by following the instructions in the local setup guide.

Frontend Testing

Step 1: Open the Frontend Interface

Launch a browser and navigate to:

📎 http://localhost:3000

You should see the main UI interface:

Frontend Main Page


Step 2: Chat with the Diagnostic Agent

On the main UI, you can simply select the Chat modal at the top and converse with the diagnostic agent in a chat-like manner. For example, in the bottom chat bar, you can ask the following questions in sequence:

i have a patient exhibiting fast breathing, underweight, sunken eyes, bloody stool. i need help in understanding what are the possible classifications associated with these symptoms.

followed by:

lgtm

You should then see the following results displayed on the UI (you can also click into each result to see more details!):

Retrieve Classifications Results

As a next step, you can provide additional information such as:

the infant is 2 weeks old. she appears to be restless. not sure about speed of skin recoil. shows minimal movement when stimulated. not suckling on the breast well. This is all I can discern at the moment.

This will produce the following set of results that you can click into for more details:

Refine Classifications Results

Finally, you can say:

these look good, let's move on

This will show the set of treatment plans for each medical classification (click to see more details regarding each treatment plan):

Refine Treatments Results


Wrap-Up

This flow simulates a full diagnostic session: from initial presentation through classification refinement and treatment recommendation. Each assistant responds intelligently to updated information, ensuring that recommendations are context-aware, explainable, and clinically aligned.

You can restart the flow at any time by clicking the pencil icon on the top left to start a new session.

Backend Testing

Step 1: Open the FastAPI Interface

Launch your local server and navigate to:

📎 http://localhost:8000/docs

You should see the following FastAPI auto-generated documentation page (collapsed):

FastAPI Documentation Page


Step 2: Retrieve Initial Classifications

Expand the Diagnosis/diagnosis-patient endpoint and click on Try it out.

This will open a form for submitting a diagnostic query. You should see something like this:

Diagnosis Patient Endpoint

Paste the following payload into the Request body field:

{
  "exclude_node_properties": [
    "embedding"
  ],
  "index_type": "classification",
  "limit": 0,
  "user_id": "1",
  "delta_threshold": 0.001,
  "node_properties": [
    {
      "embedding": "COSINE"
    }
  ],
  "random_seed": 0,
  "sample_rate": 0.5,
  "top_k": 10,
  "index_limit": 5,
  "knn_similarity_thresh": 0.8,
  "query_text": "i have a patient exhibiting fast breathing, underweight, sunken eyes, bloody stool. i need help in understanding what are the possible classifications associated with these symptoms.",
  "use_score": false
}

Click Execute and wait for the response.

When the response comes back, update the query_text with the message:

lgtm

Click Execute again and wait for the response.

Click to expand the full example response from Retrieve Classifications
{
  "explanation_for_assistant_call": null,
  "explanation_for_physician_input": "Thank you for providing the summary of the results from the last assistant call. Based on the information, it seems like we need to gather more details to refine the classifications further.\n\nSpecifically, to differentiate between the dehydration levels and dysentery, could you please provide information on the patient's:\n\n1.  Skin turgor (to assess dehydration)\n2.  Mental status (to assess dehydration and neurological involvement in dysentery)\n\nAdditionally, to assess the possibility of pneumonia, please confirm the patient's age.\n\nFinally, regarding the feeding problems, could you specify if the patient is currently being breastfed or not? This will help differentiate between \"FEEDING PROBLEM OR UNDERWEIGHT - NOT BREASTFEEDING\" and \"FEEDING PROBLEM OR UNDERWEIGHT - BREASTFEEDING\".\n\nProviding these details will allow for a more accurate classification.",
  "last_assistant_call": "refine_classifications.refine_classifications",
  "last_graph_run_results": [
    {
      "classification_id": "401",
      "classification_name": "Feeding Problem Or Underweight - Not Breastfeeding",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "Mother mixing breast milk and other feeds",
          "observation_id": "425",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Are you giving any breast milk?"
          ]
        },
        {
          "observation": "Thrush (ulcers or white patches in mouth)",
          "observation_id": "358",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look for mouth ulcers or white patches in the mouth (oral thrush).",
            "Look for ulcers or white patches in the mouth (thrush)"
          ],
          "suggested_questions": [
            "Are there any white patches or ulcers in the baby's mouth?",
            "Have you noticed any signs of thrush?"
          ]
        },
        {
          "observation": "Giving insufficient replacement feeds",
          "observation_id": "423",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How many times during the day and night?"
          ]
        },
        {
          "observation": "Giving inappropriate replacement milk or other foods/fluids",
          "observation_id": "421",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "What foods or fluids in addition to the replacement feeding is given?"
          ]
        },
        {
          "observation": "Using a feeding bottle",
          "observation_id": "427",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How is the milk being given? Cup or bottle?"
          ]
        },
        {
          "observation": "Milk incorrectly or unhygienically prepared",
          "observation_id": "418",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How are you preparing the milk?\n\t- Let the mother demonstrate or explain how a feed is prepared, and how it is given to the infant",
            "How are you cleaning the utensils?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "WFA < -2Z (Underweight) (SEE FOOTNOTE A)",
          "observation_id": "356",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Determine weight for age (WFA) (SEE FOOTNOTE A)\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "311",
      "classification_name": "Feeding Problem Or Underweight - Breastfeeding",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "Receives other foods or drinks",
          "observation_id": "351",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Does the infant receive any other foods or drinks?"
          ]
        },
        {
          "observation": "Not well positioned",
          "observation_id": "339",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Is the infant well positioned?\n\tTo check the positioning, look for:\n\t\t- Infant's head and body straight\n\t\t- Facing her breast\n\t\t- Infant's body close to her body\n\t\t- Supporting the infant's whole body (all of these signs should be present if the positioning is good)"
          ],
          "suggested_questions": [
            "Does the mother have difficulty positioning the baby for breastfeeding?",
            "Can you describe the positioning during breastfeeding?"
          ]
        },
        {
          "observation": "The mother not breastfeeding at all",
          "observation_id": "354",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is the infant breastfed? If yes, how many times in 24 hours?"
          ]
        },
        {
          "observation": "Thrush (ulcers or white patches in mouth)",
          "observation_id": "358",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look for mouth ulcers or white patches in the mouth (oral thrush).",
            "Look for ulcers or white patches in the mouth (thrush)"
          ],
          "suggested_questions": [
            "Are there any white patches or ulcers in the baby's mouth?",
            "Have you noticed any signs of thrush?"
          ]
        },
        {
          "observation": "Switching the breast frequently",
          "observation_id": "347",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Do you empty one breast before switching to the other?"
          ]
        },
        {
          "observation": "Not suckling effectively",
          "observation_id": "343",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Is the infant suckling effectively (that is slow deep sucks, sometimes pausing)?\n\tNot suckling at all\n\tNot suckling effectively\n\tSuckling effectively\n\tClear blocked nose if it interferes with breastfeeding"
          ],
          "suggested_questions": [
            "Does the baby seem to be suckling effectively?",
            "Is the baby latching properly and drawing milk well?"
          ]
        },
        {
          "observation": "Less than 8 breastfeeds in 24 hours",
          "observation_id": "345",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is the infant breastfed? If yes, how many times in 24 hours?"
          ]
        },
        {
          "observation": "Not increasing frequency of breastfeeding during illness",
          "observation_id": "349",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Do you increase frequency of breastfeeding during illness?"
          ]
        },
        {
          "observation": "Not well attached to breast",
          "observation_id": "341",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Is the infant able to attach?\n\tTo check the attachment, look for:\n\t\t- Chin touching the breast\n\t\t- Mouth wide open\n\t\t- Lower lip turned outward\n\t\t- More areola visible above than below the mouth (all of these signs should be present if the attachment is good)"
          ],
          "suggested_questions": [
            "Does the mother feel that the baby is attaching well to the breast?",
            "Can you describe the latch?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "WFA < -2Z (Underweight) (SEE FOOTNOTE A)",
          "observation_id": "356",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Determine weight for age (WFA) (SEE FOOTNOTE A)\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "301",
      "classification_name": "Dysentery",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "No movement even when stimulated",
          "observation_id": "193",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable",
            "Look at the young infant’s movements. If the infant is sleeping, ask the mother to wake him/her\n\t- Infant move on his/her own\n\t- Infant move only when stimulated\n\t- Infant doesn’t move even when stimulated"
          ],
          "suggested_questions": [
            "Does the baby move at all when stimulated?",
            "What kind of stimulation have you tried?"
          ]
        },
        {
          "observation": "Movement only when stimulated",
          "observation_id": "190",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": [
            "Does the baby only move when stimulated, or do they also move spontaneously?",
            "What kind of stimulation is required to elicit movement?"
          ]
        },
        {
          "observation": "Skin pinch goes back slowly",
          "observation_id": "286",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        },
        {
          "observation": "Diarrhoea lasting 14 days or more",
          "observation_id": "289",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "For how long has the diarrhea lasted?"
          ]
        },
        {
          "observation": "Skin pinch goes back very slowly",
          "observation_id": "186",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        },
        {
          "observation": "Restless, irritable",
          "observation_id": "285",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is the child more restless or irritable than usual?",
            "Is the child crying or fussy?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Blood in stool",
          "observation_id": "306",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is there blood in the stool?"
          ]
        },
        {
          "observation": "Sunken eyes",
          "observation_id": "184",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "629",
      "classification_name": "Pneumonia",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Infant is ≥ 7 days old",
          "observation_id": "670",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How old is the infant?",
            "Is the infant 7 days old or older?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Fast breathing (≥60 bpm)",
          "observation_id": "669",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "174",
      "classification_name": "Some Dehydration",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Skin pinch goes back slowly",
          "observation_id": "200",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        },
        {
          "observation": "Restless, irritable",
          "observation_id": "203",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": [
            "Is the child more restless or irritable than usual?",
            "Is the child crying or fussy?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Sunken eyes",
          "observation_id": "199",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "173",
      "classification_name": "Severe Dehydration",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "No movement even when stimulated",
          "observation_id": "193",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable",
            "Look at the young infant’s movements. If the infant is sleeping, ask the mother to wake him/her\n\t- Infant move on his/her own\n\t- Infant move only when stimulated\n\t- Infant doesn’t move even when stimulated"
          ],
          "suggested_questions": [
            "Does the baby move at all when stimulated?",
            "What kind of stimulation have you tried?"
          ]
        },
        {
          "observation": "Movement only when stimulated",
          "observation_id": "190",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": [
            "Does the baby only move when stimulated, or do they also move spontaneously?",
            "What kind of stimulation is required to elicit movement?"
          ]
        },
        {
          "observation": "Skin pinch goes back very slowly",
          "observation_id": "186",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Sunken eyes",
          "observation_id": "184",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "175",
      "classification_name": "No Dehydration",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Not enough signs to classify as some or severe dehydration",
          "observation_id": "208",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Are there any other signs of dehydration, such as dry mouth or decreased urination?",
            "Does the child have enough signs to classify as some or severe dehydration?"
          ]
        }
      ],
      "satisfied_observations": []
    },
    {
      "classification_id": "571",
      "classification_name": "Tb Disease",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Contact history with BC-PTB patient",
          "observation_id": "594",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Does child have: \n\t> 14 days cough? (SEE FOOTNOTE A) \n\t> 14 days fever and/or night sweats? (SEE FOOTNOTE B) \n\tcontact history with known BC-PTB (Bacteriologically Confirmed Pulmonary TB) patient (SEE FOOTNOTE C)?\nFootnote A: Cough of any duration for HIV positives"
          ],
          "suggested_questions": [
            "Has the child had any contact with anyone known to have TB?",
            "Has anyone in the household been diagnosed with TB?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis symptoms or signs",
          "observation_id": "603",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any symptoms or signs of tuberculosis, such as cough, fever, or weight loss?",
            "Has the child been tested for TB?"
          ]
        },
        {
          "observation": "GeneXpert/AFB positive (SEE FOOTNOTE F)",
          "observation_id": "588",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote F: GeneXpert negative or AFB negative result don't rule out TB disease, but negative result has to be documented and reported accordingly."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Do a GeneXpert test (SEE FOOTNOTE E) for\n\t\tSputum, collected from Gastric Aspiration (NG Tube) or \n\t\tSputum, collected from production or \n\t\tSample, collected from other sites\nFootnote E: If GeneXpert is not available in your facility, send/refer sample for GeneXpert test. And in the meantime do AFB microscopy in your facility."
          ],
          "suggested_questions": [
            "Has the child been tested for TB using GeneXpert or AFB smear?",
            "If so, what were the results?"
          ]
        },
        {
          "observation": "Chest X ray suggestive of TB (SEE FOOTNOTE G)",
          "observation_id": "591",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote G: X-ray is not commonly available in health centers and primary hospitals, but if it is available use it as one of the criteria for classification."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Chest X-ray, if available"
          ],
          "suggested_questions": [
            "Has the child had a chest X-ray?",
            "If so, were there any findings suggestive of TB?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis signs (SEE FOOTNOTE H)",
          "observation_id": "598",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote H: If child has contact history with BC-PTB patient AND has only one TB symptom or a sign, continue and complete assessment and classification for other problems; advise the mother to bring the child for follow-up after 2 weeks to be re-checked for Tuberculosis Status."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any signs of tuberculosis, such as swollen lymph nodes or failure to thrive?",
            "Has the child been tested for TB?"
          ]
        },
        {
          "observation": "Known HIV positive child",
          "observation_id": "601",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Provider-initiated HIV testing and counselling"
          ],
          "suggested_questions": [
            "Is the child known to be HIV positive?",
            "Has the child been tested for HIV?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis symptoms",
          "observation_id": "596",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any symptoms of tuberculosis, such as cough, fever, or weight loss?",
            "Has the child been tested for TB?"
          ]
        }
      ],
      "satisfied_observations": []
    }
  ],
  "require_physician_input": true,
  "session_id": "-1905362772",
  "summary_for_physician": "**The following IMNCI medical classifications have been identified for the patient, along with how strongly each one applies.**\n\n**Individual observations** for a classification are marked as:\n\n- 🟢: The observation has been **positively identified**\n- 🟠: The observation is **missing or unknown**\n- ⚪️: The observation is **no longer required** to meet the classification\n\nClick on any classification to view which clinical signs have been observed, which ones are still missing, and explore suggested questions or steps to help complete the assessment.\n\n---\n\nℹ️ **Tip:** To remove a classification that doesn’t seem relevant, click the **X** button on its card.\n\n---\n\n**Let me know how you'd like to proceed**\n\n- 🔁 If the classifications don’t look accurate, you can restart by updating the patient’s symptoms.\n- ✅ If everything looks correct, just let me know — I’ll move forward with refining the treatment plan.\n"
}

Step 3: Refine Classifications Based on Additional Input

After reviewing the initial results, update the query_text with additional observations:

the infant is 2 weeks old. she appears to be restless. not sure about speed of skin recoil. shows minimal movement when stimulated. not suckling on the breast well. this is all i can discern at the moment.

Click Execute again.

This request will also invoke the Refine Classifications assistant, which will return a narrowed and more context-sensitive set of candidate classifications.

Click to expand the full example response from Refine Classifications
{
  "explanation_for_assistant_call": null,
  "explanation_for_physician_input": "Thank you for the detailed summary. To further refine the classifications, I need some additional information:\n\n1.  **Skin pinch assessment (skin turgor):** This is crucial to differentiate between *Some Dehydration* and *Severe Dehydration* and to rule out *Dysentery*.\n2.  **Confirm absence of movement:** Please confirm if the infant exhibits absolutely no movement unless stimulated. This is important for assessing the severity of dehydration.\n3.  **Duration of diarrhea:** Knowing how long the bloody stool has been present is essential for evaluating *Dysentery*.\n4.  **Feeding methods and preparation:** If the infant is not breastfeeding, please provide details on the feeding methods used (e.g., bottle feeding, cup feeding) and how the formula is prepared. This will help in assessing *FEEDING PROBLEM OR UNDERWEIGHT - NOT BREASTFEEDING*.\n5.  **Breastfeeding technique and frequency:** If the infant is breastfeeding, please provide details on the breastfeeding technique and frequency. This will help in assessing *FEEDING PROBLEM OR UNDERWEIGHT - BREASTFEEDING*.\n6.  **Contact history and TB symptoms/signs:** Please provide information on any potential contact with individuals with tuberculosis (TB) and any other TB-related symptoms or signs. This is important for assessing *TB DISEASE*.\n\nProviding this information will allow for a more accurate and specific classification of the patient's condition.",
  "last_assistant_call": "refine_classifications.refine_classifications",
  "last_graph_run_results": [
    {
      "classification_id": "629",
      "classification_name": "Pneumonia",
      "degree_of_applicability": "met",
      "missing_observations": [],
      "satisfied_observations": [
        {
          "observation": "Fast breathing (≥60 bpm)",
          "observation_id": "669",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": []
        },
        {
          "observation": "Infant is ≥ 7 days old",
          "observation_id": "670",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "174",
      "classification_name": "Some Dehydration",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "Skin pinch goes back slowly",
          "observation_id": "200",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Sunken eyes",
          "observation_id": "199",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        },
        {
          "observation": "Restless, irritable",
          "observation_id": "203",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "173",
      "classification_name": "Severe Dehydration",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "No movement even when stimulated",
          "observation_id": "193",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable",
            "Look at the young infant’s movements. If the infant is sleeping, ask the mother to wake him/her\n\t- Infant move on his/her own\n\t- Infant move only when stimulated\n\t- Infant doesn’t move even when stimulated"
          ],
          "suggested_questions": [
            "Does the baby move at all when stimulated?",
            "What kind of stimulation have you tried?"
          ]
        },
        {
          "observation": "Skin pinch goes back very slowly",
          "observation_id": "186",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Movement only when stimulated",
          "observation_id": "190",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": []
        },
        {
          "observation": "Sunken eyes",
          "observation_id": "184",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "311",
      "classification_name": "Feeding Problem Or Underweight - Breastfeeding",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "Receives other foods or drinks",
          "observation_id": "351",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Does the infant receive any other foods or drinks?"
          ]
        },
        {
          "observation": "Not well positioned",
          "observation_id": "339",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Is the infant well positioned?\n\tTo check the positioning, look for:\n\t\t- Infant's head and body straight\n\t\t- Facing her breast\n\t\t- Infant's body close to her body\n\t\t- Supporting the infant's whole body (all of these signs should be present if the positioning is good)"
          ],
          "suggested_questions": [
            "Does the mother have difficulty positioning the baby for breastfeeding?",
            "Can you describe the positioning during breastfeeding?"
          ]
        },
        {
          "observation": "The mother not breastfeeding at all",
          "observation_id": "354",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is the infant breastfed? If yes, how many times in 24 hours?"
          ]
        },
        {
          "observation": "Thrush (ulcers or white patches in mouth)",
          "observation_id": "358",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look for mouth ulcers or white patches in the mouth (oral thrush).",
            "Look for ulcers or white patches in the mouth (thrush)"
          ],
          "suggested_questions": [
            "Are there any white patches or ulcers in the baby's mouth?",
            "Have you noticed any signs of thrush?"
          ]
        },
        {
          "observation": "Switching the breast frequently",
          "observation_id": "347",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Do you empty one breast before switching to the other?"
          ]
        },
        {
          "observation": "Less than 8 breastfeeds in 24 hours",
          "observation_id": "345",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is the infant breastfed? If yes, how many times in 24 hours?"
          ]
        },
        {
          "observation": "Not increasing frequency of breastfeeding during illness",
          "observation_id": "349",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Do you increase frequency of breastfeeding during illness?"
          ]
        },
        {
          "observation": "Not well attached to breast",
          "observation_id": "341",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Is the infant able to attach?\n\tTo check the attachment, look for:\n\t\t- Chin touching the breast\n\t\t- Mouth wide open\n\t\t- Lower lip turned outward\n\t\t- More areola visible above than below the mouth (all of these signs should be present if the attachment is good)"
          ],
          "suggested_questions": [
            "Does the mother feel that the baby is attaching well to the breast?",
            "Can you describe the latch?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Not suckling effectively",
          "observation_id": "343",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Is the infant suckling effectively (that is slow deep sucks, sometimes pausing)?\n\tNot suckling at all\n\tNot suckling effectively\n\tSuckling effectively\n\tClear blocked nose if it interferes with breastfeeding"
          ],
          "suggested_questions": []
        },
        {
          "observation": "WFA < -2Z (Underweight) (SEE FOOTNOTE A)",
          "observation_id": "356",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Determine weight for age (WFA) (SEE FOOTNOTE A)\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "401",
      "classification_name": "Feeding Problem Or Underweight - Not Breastfeeding",
      "degree_of_applicability": "met",
      "missing_observations": [
        {
          "observation": "Mother mixing breast milk and other feeds",
          "observation_id": "425",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Are you giving any breast milk?"
          ]
        },
        {
          "observation": "Thrush (ulcers or white patches in mouth)",
          "observation_id": "358",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look for mouth ulcers or white patches in the mouth (oral thrush).",
            "Look for ulcers or white patches in the mouth (thrush)"
          ],
          "suggested_questions": [
            "Are there any white patches or ulcers in the baby's mouth?",
            "Have you noticed any signs of thrush?"
          ]
        },
        {
          "observation": "Giving insufficient replacement feeds",
          "observation_id": "423",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How many times during the day and night?"
          ]
        },
        {
          "observation": "Giving inappropriate replacement milk or other foods/fluids",
          "observation_id": "421",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "What foods or fluids in addition to the replacement feeding is given?"
          ]
        },
        {
          "observation": "Using a feeding bottle",
          "observation_id": "427",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How is the milk being given? Cup or bottle?"
          ]
        },
        {
          "observation": "Milk incorrectly or unhygienically prepared",
          "observation_id": "418",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "How are you preparing the milk?\n\t- Let the mother demonstrate or explain how a feed is prepared, and how it is given to the infant",
            "How are you cleaning the utensils?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "WFA < -2Z (Underweight) (SEE FOOTNOTE A)",
          "observation_id": "356",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Determine weight for age (WFA) (SEE FOOTNOTE A)\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
          ],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "301",
      "classification_name": "Dysentery",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "No movement even when stimulated",
          "observation_id": "193",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable",
            "Look at the young infant’s movements. If the infant is sleeping, ask the mother to wake him/her\n\t- Infant move on his/her own\n\t- Infant move only when stimulated\n\t- Infant doesn’t move even when stimulated"
          ],
          "suggested_questions": [
            "Does the baby move at all when stimulated?",
            "What kind of stimulation have you tried?"
          ]
        },
        {
          "observation": "Skin pinch goes back slowly",
          "observation_id": "286",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        },
        {
          "observation": "Diarrhoea lasting 14 days or more",
          "observation_id": "289",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "For how long has the diarrhea lasted?"
          ]
        },
        {
          "observation": "Skin pinch goes back very slowly",
          "observation_id": "186",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?"
          ],
          "suggested_questions": [
            "When the skin is pinched, how quickly does it return to normal?",
            "Is it immediate, slow, or very slow?"
          ]
        }
      ],
      "satisfied_observations": [
        {
          "observation": "Blood in stool",
          "observation_id": "306",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Is there blood in the stool?"
          ]
        },
        {
          "observation": "Movement only when stimulated",
          "observation_id": "190",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look at the young infant's general condition.\n\t- Infant moves only when stimulated\n\t- Infant does not move even when stimulated\n\t- Infant restless and irritable"
          ],
          "suggested_questions": []
        },
        {
          "observation": "Sunken eyes",
          "observation_id": "184",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [
            "Look for sunken eyes"
          ],
          "suggested_questions": []
        },
        {
          "observation": "Restless, irritable",
          "observation_id": "285",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": false,
          "suggested_procedure_steps": [],
          "suggested_questions": []
        }
      ]
    },
    {
      "classification_id": "175",
      "classification_name": "No Dehydration",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Not enough signs to classify as some or severe dehydration",
          "observation_id": "208",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Are there any other signs of dehydration, such as dry mouth or decreased urination?",
            "Does the child have enough signs to classify as some or severe dehydration?"
          ]
        }
      ],
      "satisfied_observations": []
    },
    {
      "classification_id": "571",
      "classification_name": "Tb Disease",
      "degree_of_applicability": "not_met",
      "missing_observations": [
        {
          "observation": "Contact history with BC-PTB patient",
          "observation_id": "594",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Does child have: \n\t> 14 days cough? (SEE FOOTNOTE A) \n\t> 14 days fever and/or night sweats? (SEE FOOTNOTE B) \n\tcontact history with known BC-PTB (Bacteriologically Confirmed Pulmonary TB) patient (SEE FOOTNOTE C)?\nFootnote A: Cough of any duration for HIV positives"
          ],
          "suggested_questions": [
            "Has the child had any contact with anyone known to have TB?",
            "Has anyone in the household been diagnosed with TB?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis symptoms or signs",
          "observation_id": "603",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any symptoms or signs of tuberculosis, such as cough, fever, or weight loss?",
            "Has the child been tested for TB?"
          ]
        },
        {
          "observation": "GeneXpert/AFB positive (SEE FOOTNOTE F)",
          "observation_id": "588",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote F: GeneXpert negative or AFB negative result don't rule out TB disease, but negative result has to be documented and reported accordingly."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Do a GeneXpert test (SEE FOOTNOTE E) for\n\t\tSputum, collected from Gastric Aspiration (NG Tube) or \n\t\tSputum, collected from production or \n\t\tSample, collected from other sites\nFootnote E: If GeneXpert is not available in your facility, send/refer sample for GeneXpert test. And in the meantime do AFB microscopy in your facility."
          ],
          "suggested_questions": [
            "Has the child been tested for TB using GeneXpert or AFB smear?",
            "If so, what were the results?"
          ]
        },
        {
          "observation": "Chest X ray suggestive of TB (SEE FOOTNOTE G)",
          "observation_id": "591",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote G: X-ray is not commonly available in health centers and primary hospitals, but if it is available use it as one of the criteria for classification."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Chest X-ray, if available"
          ],
          "suggested_questions": [
            "Has the child had a chest X-ray?",
            "If so, were there any findings suggestive of TB?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis signs (SEE FOOTNOTE H)",
          "observation_id": "598",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [
            "\nFootnote H: If child has contact history with BC-PTB patient AND has only one TB symptom or a sign, continue and complete assessment and classification for other problems; advise the mother to bring the child for follow-up after 2 weeks to be re-checked for Tuberculosis Status."
          ],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any signs of tuberculosis, such as swollen lymph nodes or failure to thrive?",
            "Has the child been tested for TB?"
          ]
        },
        {
          "observation": "Known HIV positive child",
          "observation_id": "601",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [
            "Provider-initiated HIV testing and counselling"
          ],
          "suggested_questions": [
            "Is the child known to be HIV positive?",
            "Has the child been tested for HIV?"
          ]
        },
        {
          "observation": "≥ 1 Tuberculosis symptoms",
          "observation_id": "596",
          "critical_information": [],
          "explanation": "No explanation provided.",
          "footnotes": [],
          "from_llm": true,
          "suggested_procedure_steps": [],
          "suggested_questions": [
            "Has the child exhibited any symptoms of tuberculosis, such as cough, fever, or weight loss?",
            "Has the child been tested for TB?"
          ]
        }
      ],
      "satisfied_observations": []
    }
  ],
  "require_physician_input": true,
  "session_id": "-1905362772",
  "summary_for_physician": "**The following IMNCI medical classifications have been identified for the patient, along with how strongly each one applies.**\n\n**Individual observations** for a classification are marked as:\n\n- 🟢: The observation has been **positively identified**\n- 🟠: The observation is **missing or unknown**\n- ⚪️: The observation is **no longer required** to meet the classification\n\nClick on any classification to view which clinical signs have been observed, which ones are still missing, and explore suggested questions or steps to help complete the assessment.\n\n---\n\nℹ️ **Tip:** To remove a classification that doesn’t seem relevant, click the **X** button on its card.\n\n---\n\n**Let me know how you'd like to proceed**\n\n- 🔁 If the classifications don’t look accurate, you can restart by updating the patient’s symptoms.\n- ✅ If everything looks correct, just let me know — I’ll move forward with refining the treatment plan.\n"
}

Step 4: Retrieve and Refine Treatment Recommendations

Once classifications have been confirmed or selected, it's time to retrieve treatment options.

Update the query_text with the following message:

these look good, let's move on

Click Execute.

This call invokes the Refine Treatments assistant, which generates treatment steps tailored to the most applicable classifications so far.

Click to expand the full example response from Refine Treatments
{
  "explanation_for_assistant_call": null,
  "explanation_for_physician_input": "Thank you for providing the treatment recommendations. To refine the treatment plan further, I need some additional information:\n\n1.  **For Pneumonia:** Please confirm the dosage of Amoxicillin to be administered.\n2.  **For Dysentery:** Please confirm the dosages of IM Ampicillin and Gentamicin to be administered.\n3.  **For Feeding Problem or Underweight (Not Breastfeeding):**\n    *   Is the mother using a bottle to feed the infant?\n    *   Does the infant have thrush?\n4.  **For Feeding Problem or Underweight (Breastfeeding):**\n    *   How many times in 24 hours is the baby breastfeeding?\n    *   Is the baby receiving other foods or drinks?\n    *   Does the baby have thrush (ulcers or white patches in the mouth)?\n5.  **For TB Disease:**\n    *   Has the child had a TB test performed?\n    *   What were the results of the TB test?\n\nOnce I have this information, I can help refine the treatment plan further. Please double-check all medication dosages and treatment plans before proceeding, as accuracy is critical.",
  "last_assistant_call": "refine_treatments.refine_treatments",
  "last_graph_run_results": [
    {
      "classification_id": "629",
      "classification_name": "Pneumonia",
      "degree_of_applicability": "met",
      "non_urgent": {
        "additional_clarifications": [],
        "explanation": "The logic block for PNEUMONIA contains an AND operator with two treatment steps: 'Advise mother when to return immediately' and 'Follow-up after 2 days of Amoxicillin'. Since there are no IF conditions or OR conditions, both treatment steps should be prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Advise mother when to return immediately",
            "treatment_order": 1,
            "treatment_step_id": 231,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up after 2 days of Amoxicillin",
            "treatment_order": 2,
            "treatment_step_id": 700,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      },
      "urgent": {
        "additional_clarifications": [],
        "explanation": "The patient is classified as having PNEUMONIA. The logic block contains a single treatment step: 'Give Amoxicillin for 7 days'. Since there are no qualifiers, this treatment step can be faithfully prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Give Amoxicillin for 7 days",
            "treatment_order": 1,
            "treatment_step_id": 697,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      }
    },
    {
      "classification_id": "301",
      "classification_name": "Dysentery",
      "degree_of_applicability": "not_met",
      "non_urgent": null,
      "urgent": {
        "additional_clarifications": [],
        "explanation": "The logic block for DYSENTERY consists of an AND operator with the following treatment steps: 'Give first dose of IM Ampicillin and Gentamicin', 'Treat to prevent low blood sugar', 'Advise how to keep infant warm on the way to the hospital', and 'Refer to hospital'. Since all conditions are connected by an AND operator, all treatment steps should be prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Give first dose of IM Ampicillin and Gentamicin",
            "treatment_order": 1,
            "treatment_step_id": 293,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Treat to prevent low blood sugar",
            "treatment_order": 2,
            "treatment_step_id": 294,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Advise how to keep infant warm on the way to the hospital",
            "treatment_order": 3,
            "treatment_step_id": 295,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Refer to hospital",
            "treatment_order": 4,
            "treatment_step_id": 296,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      }
    },
    {
      "classification_id": "174",
      "classification_name": "Some Dehydration",
      "degree_of_applicability": "met",
      "non_urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Infant does not have any other severe classification",
            "suggested_question": "Does the infant have any other severe classifications?"
          }
        ],
        "explanation": "The logic block for SOME DEHYDRATION contains an IF condition: 'Infant does not have any other severe classification'. Since the patient also has classifications such as Pneumonia, Dysentery, and Severe Dehydration, this IF condition is NOT met. Therefore, the treatment steps 'Give fluid for some dehydration and Zinc supplement (Plan B)', 'Advise mother when to return immediately', and 'Follow-up in 2 days' cannot be faithfully prescribed at this time.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Give fluid for some dehydration and Zinc supplement (Plan B)",
            "treatment_order": 1,
            "treatment_step_id": 226,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Pinch the skin of the abdomen. Does it go back:\n\t- Very slowly (> 2 sec.)?\n\t- Slowly?",
              "Look for sunken eyes"
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother when to return immediately",
            "treatment_order": 2,
            "treatment_step_id": 227,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up in 2 days",
            "treatment_order": 3,
            "treatment_step_id": 228,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      },
      "urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Infant has another severe classification",
            "suggested_question": "Does the infant have any other severe classifications?"
          }
        ],
        "explanation": "The logic block consists of a single IF condition. The qualifier for the IF condition is 'Infant has another severe classification'. If this condition is met, then the following treatment steps should be prescribed: 'Refer URGENTLY to hospital with mother giving frequent sips of ORS on the way', 'Advise mother to continue breastfeeding more frequently', and 'Advise mother how to keep the young infant warm on the way to hospital'.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Refer URGENTLY to hospital with mother giving frequent sips of ORS on the way",
            "treatment_order": 1,
            "treatment_step_id": 214,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for sunken eyes"
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother to continue breastfeeding more frequently",
            "treatment_order": 2,
            "treatment_step_id": 215,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother how to keep the young infant warm on the way to hospital",
            "treatment_order": 3,
            "treatment_step_id": 216,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      }
    },
    {
      "classification_id": "173",
      "classification_name": "Severe Dehydration",
      "degree_of_applicability": "met",
      "non_urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Infant does not have any other severe classification",
            "suggested_question": "Does the infant have any other severe classifications?"
          }
        ],
        "explanation": "The logic block for SEVERE DEHYDRATION contains an IF condition. The qualifier for the IF condition is 'Infant does not have any other severe classification'. Since we do not know whether the infant has any other severe classification, we cannot faithfully prescribe the treatment step 'Give fluid for severe dehydration (Plan C)'.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Give fluid for severe dehydration (Plan C).",
            "treatment_order": 1,
            "treatment_step_id": 221,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for sunken eyes"
            ],
            "suggested_questions": []
          }
        ]
      },
      "urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Infant has another severe classification",
            "suggested_question": "Does the infant have another severe classification, such as Pneumonia, Dysentery, or TB Disease?"
          }
        ],
        "explanation": "The logic block for SEVERE DEHYDRATION contains an IF condition: 'Infant has another severe classification'. Since the patient is a 2-week-old infant presenting with fast breathing, is underweight, has bloody stool and sunken eyes, is restless, and shows minimal movement when stimulated, and the classifications being considered are Pneumonia, Some Dehydration, Severe Dehydration, Feeding Problem or Underweight (Breastfeeding), Feeding Problem or Underweight (Not Breastfeeding), Dysentery, and TB Disease, we need to determine if the infant has another severe classification to satisfy the IF condition. If the infant has another severe classification, then the treatment steps 'Refer URGENTLY to hospital with mother giving frequent sips of ORS on the way', 'Advise mother to continue breastfeeding more frequently', and 'Advise mother how to keep the young infant warm on the way to hospital' can be prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Refer URGENTLY to hospital with mother giving frequent sips of ORS on the way",
            "treatment_order": 1,
            "treatment_step_id": 214,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for sunken eyes"
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother to continue breastfeeding more frequently",
            "treatment_order": 2,
            "treatment_step_id": 215,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother how to keep the young infant warm on the way to hospital",
            "treatment_order": 3,
            "treatment_step_id": 216,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      }
    },
    {
      "classification_id": "175",
      "classification_name": "No Dehydration",
      "degree_of_applicability": "not_met",
      "non_urgent": {
        "additional_clarifications": [],
        "explanation": "The logic block consists of an AND operator with three treatment steps: 'Advise mother when to return immediately', 'Follow-up in 5 days if not improving', and 'Give fluids to treat diarrhoea at home and Zinc supplement (Plan A)'. Since all conditions are under an AND operator and there are no IF conditions, all three treatment steps can be prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Advise mother when to return immediately",
            "treatment_order": 1,
            "treatment_step_id": 231,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up in 5 days if not improving",
            "treatment_order": 2,
            "treatment_step_id": 232,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Give fluids to treat diarrhoea at home and Zinc supplement (Plan A)",
            "treatment_order": 3,
            "treatment_step_id": 233,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for sunken eyes"
            ],
            "suggested_questions": []
          }
        ]
      },
      "urgent": null
    },
    {
      "classification_id": "571",
      "classification_name": "Tb Disease",
      "degree_of_applicability": "not_met",
      "non_urgent": {
        "additional_clarifications": [],
        "explanation": "The logic block for TB DISEASE contains an AND operator with three treatment steps. Since there are no IF conditions, all three treatment steps can be faithfully prescribed.\n\n1. Advise mother on the need to start TB treatment to the child: Prescribed.\n2. Advise mother to bring any other contacts to TB clinic: Prescribed.\n3. Ensure that mother is escorted and linked to TB clinic, for initiation of TB treatment and follow up: Prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Advise mother on the need to start TB treatment to the child",
            "treatment_order": 1,
            "treatment_step_id": 615,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother to bring any other contacts to TB clinic",
            "treatment_order": 2,
            "treatment_step_id": 616,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Ensure that mother is escorted and linked to TB clinic, for initiation of TB treatment and follow up",
            "treatment_order": 3,
            "treatment_step_id": 617,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      },
      "urgent": null
    },
    {
      "classification_id": "401",
      "classification_name": "Feeding Problem Or Underweight - Not Breastfeeding",
      "degree_of_applicability": "met",
      "non_urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Mother is using a bottle",
            "suggested_question": "Is the mother using a bottle to feed the infant?"
          },
          {
            "if_condition_qualifier": "Thrush",
            "suggested_question": "Does the infant have thrush?"
          }
        ],
        "explanation": "The logic block for classification 'FEEDING PROBLEM OR UNDERWEIGHT - NOT BREASTFEEDING' consists of an AND operator with several treatment steps and two IF conditions. \n\nTreatment steps 'Counsel on optimal replacement feeding' and 'Identify concerns of the mother and the family about feeding. Help the mother gradually withdraw other foods or fluids' are prescribed since they have no qualifiers.\n\nThe first IF condition checks 'Mother is using a bottle'. If this condition is met, then 'Teach cup feeding' is also prescribed. Otherwise, we need to ask the physician to confirm whether the mother is using a bottle.\n\nThe second IF condition checks 'Thrush'. If this condition is met, then 'Teach the mother to treat thrush at home' is also prescribed. Otherwise, we need to ask the physician to confirm whether the infant has thrush.\n\nTreatment steps 'Advise mother how to feed and keep the young infant warm at home', 'Follow-up any feeding problem or thrush in 2 days', and 'Follow-up underweight in 14 days' are prescribed since they have no qualifiers. However, these treatment steps can only be faithfully prescribed after the IF conditions have been accounted for.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Counsel on optimal replacement feeding",
            "treatment_order": 1,
            "treatment_step_id": 431,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "What milk are you giving?",
              "How is the milk being given? Cup or bottle?",
              "How many times during the day and night?",
              "How are you preparing the milk?\n\t- Let the mother demonstrate or explain how a feed is prepared, and how it is given to the infant",
              "Is there any difficulty in feeding?",
              "How are you cleaning the utensils?",
              "What foods or fluids in addition to the replacement feeding is given?",
              "How much is given at each feed?",
              "Are you giving any breast milk?"
            ]
          },
          {
            "treatment": "Identify concerns of the mother and the family about feeding. Help the mother gradually withdraw other foods or fluids",
            "treatment_order": 2,
            "treatment_step_id": 432,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "What foods or fluids in addition to the replacement feeding is given?"
            ]
          },
          {
            "treatment": "Teach cup feeding",
            "treatment_order": 3,
            "treatment_step_id": 435,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "How is the milk being given? Cup or bottle?"
            ]
          },
          {
            "treatment": "Teach the mother to treat thrush at home",
            "treatment_order": 4,
            "treatment_step_id": 437,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for mouth ulcers or white patches in the mouth (oral thrush)."
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother how to feed and keep the young infant warm at home",
            "treatment_order": 5,
            "treatment_step_id": 438,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up any feeding problem or thrush in 2 days",
            "treatment_order": 6,
            "treatment_step_id": 439,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for mouth ulcers or white patches in the mouth (oral thrush)."
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up underweight in 14 days",
            "treatment_order": 7,
            "treatment_step_id": 440,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Determine weight for age (WFA) (SEE FOOTNOTE A)\nFootnote A: For determining WFA, use WFA charts (see page 88 & 89) annexed at the end of the chart booklet."
            ],
            "suggested_questions": []
          }
        ]
      },
      "urgent": null
    },
    {
      "classification_id": "311",
      "classification_name": "Feeding Problem Or Underweight - Breastfeeding",
      "degree_of_applicability": "met",
      "non_urgent": {
        "additional_clarifications": [
          {
            "if_condition_qualifier": "Breastfeeding less than 8 times in 24 hours",
            "suggested_question": "How many times in 24 hours is the baby breastfeeding?"
          },
          {
            "if_condition_qualifier": "Receiving other foods or drinks",
            "suggested_question": "Is the baby receiving other foods or drinks?"
          },
          {
            "if_condition_qualifier": "Thrush (ulcers or white patches in mouth)",
            "suggested_question": "Does the baby have thrush (ulcers or white patches in the mouth)?"
          }
        ],
        "explanation": "The logic block for classification 'FEEDING PROBLEM OR UNDERWEIGHT - BREASTFEEDING' (Classification ID 311) is evaluated as follows:\n\n- 'Advise the mother to breastfeed as often and for as long as the infant wants, day and night' is prescribed.\n- The IF condition 'Baby not sucking' is TRUE because the observation 'Not suckling effectively' is satisfied. Therefore:\n    - 'Show her how to express breast milk' is prescribed.\n    - The IF condition 'Not well positioned, attached, or not suckling effectively' is TRUE because the observation 'Not suckling effectively' is satisfied. Therefore:\n        - 'Teach correct positioning and attachment' is prescribed.\n    - The IF condition 'Breastfeeding less than 8 times in 24 hours' is currently unknown. We need to ask the physician to confirm this.\n    - 'Empty one breast completely before switching to the other' is prescribed.\n    - 'Increase frequency of feeding during and after illness' is prescribed.\n- The IF condition 'Receiving other foods or drinks' is currently unknown. We need to ask the physician to confirm this.\n- The IF condition 'Not breastfeeding at all' is FALSE because the observation 'Not suckling effectively' indicates the baby is attempting to breastfeed. Therefore, the nested steps are skipped.\n- The IF condition 'Thrush (ulcers or white patches in mouth)' is currently unknown. We need to ask the physician to confirm this.\n- 'Advise mother to give home care for the young infant' is prescribed.\n- 'Ensure infant is tested for HIV' is prescribed.\n- 'Follow-up any feeding problem or thrush in 2 days' is prescribed.\n- 'Follow-up for underweight in 14 days' is prescribed.",
        "logical_errors": [],
        "treatment_steps": [
          {
            "treatment": "Advise the mother to breastfeed as often and for as long as the infant wants, day and night",
            "treatment_order": 1,
            "treatment_step_id": 368,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "Is the infant breastfed? If yes, how many times in 24 hours?"
            ]
          },
          {
            "treatment": "Show her how to express breast milk",
            "treatment_order": 2,
            "treatment_step_id": 371,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Teach correct positioning and attachment",
            "treatment_order": 3,
            "treatment_step_id": 374,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Is the infant well positioned?\n\tTo check the positioning, look for:\n\t\t- Infant's head and body straight\n\t\t- Facing her breast\n\t\t- Infant's body close to her body\n\t\t- Supporting the infant's whole body (all of these signs should be present if the positioning is good)",
              "Is the infant able to attach?\n\tTo check the attachment, look for:\n\t\t- Chin touching the breast\n\t\t- Mouth wide open\n\t\t- Lower lip turned outward\n\t\t- More areola visible above than below the mouth (all of these signs should be present if the attachment is good)"
            ],
            "suggested_questions": [
              "Is the infant breastfed? If yes, how many times in 24 hours?"
            ]
          },
          {
            "treatment": "Advise to increase frequency of feeding",
            "treatment_order": 4,
            "treatment_step_id": 377,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Empty one breast completely before switching to the other",
            "treatment_order": 5,
            "treatment_step_id": 378,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "Do you empty one breast before switching to the other?"
            ]
          },
          {
            "treatment": "Increase frequency of feeding during and after illness",
            "treatment_order": 6,
            "treatment_step_id": 379,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "Do you increase frequency of breastfeeding during illness?"
            ]
          },
          {
            "treatment": "Council mother on exclusive breast feeding",
            "treatment_order": 7,
            "treatment_step_id": 382,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": [
              "Does the infant receive any other foods or drinks?"
            ]
          },
          {
            "treatment": "Counsel on breastfeeding and relactation",
            "treatment_order": 8,
            "treatment_step_id": 385,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Advise about correct preparation of breast milk substitutes and using a cup",
            "treatment_order": 9,
            "treatment_step_id": 388,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Teach the mother to treat thrush at home",
            "treatment_order": 10,
            "treatment_step_id": 391,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [
              "Look for ulcers or white patches in the mouth (thrush)"
            ],
            "suggested_questions": []
          },
          {
            "treatment": "Advise mother to give home care for the young infant",
            "treatment_order": 11,
            "treatment_step_id": 392,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Ensure infant is tested for HIV",
            "treatment_order": 12,
            "treatment_step_id": 393,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up any feeding problem or thrush in 2 days",
            "treatment_order": 13,
            "treatment_step_id": 394,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          },
          {
            "treatment": "Follow-up for underweight in 14 days",
            "treatment_order": 14,
            "treatment_step_id": 395,
            "critical_information": [],
            "footnotes": [],
            "suggested_procedure_steps": [],
            "suggested_questions": []
          }
        ]
      },
      "urgent": null
    }
  ],
  "require_physician_input": true,
  "session_id": "-1905362772",
  "summary_for_physician": "**The IMNCI recommended treatment plans for each classification identified in the patient are shown below.**\n\nClick on a classification to view the steps for both ⚡ **urgent** and 🕒 **non-urgent** treatments.\n\nEach treatment plan may include:\n\n- ❓ **Conditions or questions** that must be clarified before certain steps can be prescribed\n- 💊 **Medications** to administer, if applicable\n- 🏥 **Referrals** that may be required\n- 👪 **Guidance** to offer caregivers\n\n---\n\nℹ️ **Tip:** If a treatment plan no longer seems relevant, you can remove it by clicking the **X** button on its card.\n\n---\n\n**Let me know how you'd like to proceed:**\n\n- 🔁 If these treatments don’t seem appropriate, you can restart the process by updating the patient’s symptoms.\n- 📝 If you'd like to refine the treatments further, please share any additional information about the patient or their condition.\n"
}

Wrap-Up

This flow simulates a full diagnostic session: from initial presentation through classification refinement and treatment recommendation. Each assistant responds intelligently to updated information, ensuring that recommendations are context-aware, explainable, and clinically aligned.

You can restart the flow at any time (by setting reset_chat_and_graph_state to True (but don't forget to set it back to False once the diagnosis gets going!) or modify individual steps to test different scenarios.