> ## Documentation Index
> Fetch the complete documentation index at: https://docs.claritycare.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Process Tree

> Update the criteria tree and rationale for a processing request

# Update Process Tree

Update the criteria tree and rationale for a processing request.

## API Request

<ParamField path="run_id" type="string" required>
  The unique identifier for the processing request
</ParamField>

<ParamField body="only_save_nurse_decision" type="boolean" optional>
  If true, only the input criteria tree and rationale will be saved and new tree coloring or rationale will not be generated.
</ParamField>

<ParamField body="updated_criteria_tree" type="string" required>
  JSON string representing the updated criteria tree
</ParamField>

<ParamField body="updated_rationale" type="string" optional>
  Updated rationale for the decision
</ParamField>

## Response

<ResponseField name="case_file_presigned_url" type="string">
  Presigned URL for the case file
</ResponseField>

<ResponseField name="final_results" type="object">
  Final results of the processing
</ResponseField>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url 'https://prior-auth-api.claritycare.ai/v1/process/update_tree' \
    --header 'Authorization: Bearer {cognito_login_token}' \
    --form 'run_id=proc_123abc' \
    --form 'only_save_nurse_decision=true' \
    --form 'updated_criteria_tree={"decision": "approved", "criteria": {...}}' \
    --form 'updated_rationale="Updated rationale for the decision"'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "case_file_presigned_url": "https://s3.amazonaws.com/bucket/case_123abc.pdf",
    "final_results": {
    "criteria": {
      "criteria_tree": {
        "criteria_id": "1",
        "description": "Procedure is indicated for ALL of the following:",
        "operator": "AND",
        "criteria": [
          {
            "criteria_id": "1.1",
            "description": "Intractable pain (eg. secondary to malignancy)",
            "parent_description": "Procedure is indicated for ALL of the following:",
            "color": "green",
            "clinical_decisioning": [
              {
                "bounding_box": [
                  {
                    "x": 107.0,
                    "y": 249.6,
                    "width": 423.2,
                    "height": 11.6,
                    "page": 0
                  }
                ],
                "id": "71b41cbe-3060-4aab-949c-ec05596ab1ba"
              }
            ]
          },
          {
            "criteria_id": "1.2",
            "description": "Pain believed to be amenable to percutaneous cordotomy",
            "parent_description": "Procedure is indicated for ALL of the following:",
            "color": "green",
            "clinical_decisioning": [
              {
                "exact_text_sentence_relevant_to_criteria": "Given the location and nature of the pain, the physician believes it may be amenable to percutaneous cordotomy, targeting specific pain pathways in the spinal cord for potential relief.",
                "bounding_box": [
                  {
                    "x": 258.1,
                    "y": 337.9,
                    "width": 231.4,
                    "height": 11.3,
                    "page": 3
                  }
                ],
                "id": "9eb3eac3-f867-4d73-bf07-22a416e64ab0"
              }
            ]
          },
          {
            "criteria_id": "1.3",
            "description": "Failure of nonoperative measures",
            "parent_description": "Procedure is indicated for ALL of the following:",
            "color": "green",
            "clinical_decisioning": [
              {
                "exact_text_sentence_relevant_to_criteria": "Standard interventions, including analgesics, neuropathic pain modulators, and percutaneous nerve blocks, have been attempted without success.",
                "bounding_box": [
                  {
                    "x": 236.9,
                    "y": 410.7,
                    "width": 296.9,
                    "height": 11.7,
                    "page": 0
                  }
                ],
                "id": "9fd6b7fe-fa7a-4523-9de0-b5108b16ae7d"
              }
            ]
          }
        ],
        "color": "green"
      },
      "clinical_rationale": "The procedure is certified as medically necessary based on intractable pain secondary to malignancy, amenability to percutaneous cordotomy, and failure of nonoperative measures.",
      "root_decision": "Certified",
      "ccm_trigger_detection": {
        "recent_visit_date": "11/18/2024",
        "ccm_status": "Yes",
        "trigger": "Cancer diagnosis",
        "trigger_details": [
          {
            "exact_evidence_text": "Diagnosed with metastatic pancreatic cancer, contributing to severe neuropathic pain.",
            "evidence_relevance": "Direct mention of a metastatic cancer diagnosis.",
            "page_number": 0
          }
        ],
        "reasoning": "The patient has metastatic pancreatic cancer causing severe, refractory neuropathic pain.",
        "intensity": "high"
      },
      "clinical_summary": {
        "patient_background": {
          "summary_content": "72 years old, female, metastatic pancreatic cancer, hypertension, osteoarthritis, type 2 diabetes, major depressive disorder",
          "evidence_content": [
            {
              "text": "Age: 72, Gender: Female, Diagnosed with metastatic pancreatic cancer",
              "page_index": 0
            }
          ]
        },
        "diagnosis": {
          "summary_content": "Metastatic pancreatic cancer, intractable neuropathic pain",
          "evidence_content": [
            {
              "text": "Diagnosed with metastatic pancreatic cancer, contributing to severe neuropathic pain",
              "page_index": 0
            }
          ]
        },
        "reason_for_request": {
          "summary_content": "Percutaneous cordotomy to alleviate intractable neuropathic pain",
          "evidence_content": [
            {
              "text": "Percutaneous cordotomy proposed to alleviate neuropathic pain",
              "page_index": 3
            }
          ]
        },
        "key_test_results": {
          "summary_content": "MRI and CT scans show stable pancreatic tumor with nerve involvement",
          "evidence_content": [
            {
              "text": "MRI (05/2024): Stable tumor in pancreas with nerve involvement",
              "page_index": 1
            }
          ]
        },
        "current_treatment": {
          "summary_content": "Opioid and non-opioid analgesics, neuropathic pain modulators with limited efficacy",
          "evidence_content": [
            {
              "text": "Combination of opioid and non-opioid analgesics with limited success",
              "page_index": 1
            }
          ]
        }
      }
    }
  }
  }
  ```
</ResponseExample>
