{
  "kind": "genhealth.workflow_definition",
  "schema_version": 1,
  "workflow": {
    "name": "Provider workflow: resolve an athenahealth chart",
    "description": "Read patient chart context for any specialty. Requires a configured athenahealth test connection and verified vendor patient ID.",
    "nodes": [
      {
        "id": "chart",
        "type": "integration",
        "name": "Resolve chart context",
        "error_strategy": "fail_branch",
        "config": {
          "_group": "athenahealth",
          "handler": "athena_resolve_patient_chart_context",
          "params": {
            "patient_id": "{{trigger.default.patient_id}}"
          }
        }
      },
      {
        "id": "ok",
        "type": "if",
        "name": "Chart resolved?",
        "config": {
          "condition": "{{chart.default.success}}"
        }
      },
      {
        "id": "resolved",
        "type": "comment",
        "name": "Chart resolved",
        "config": {
          "heading": "Resolved",
          "body": "Use chart.default.chart_id and chart.default.patient_id in a subsequent reviewed step."
        }
      },
      {
        "id": "review",
        "type": "comment",
        "name": "Review required",
        "config": {
          "heading": "Review",
          "body": "Annotation only; no external task or notification is created."
        }
      }
    ],
    "edges": [
      {
        "source_node_id": "chart",
        "source_output": "default",
        "target_node_id": "ok",
        "target_input": "default"
      },
      {
        "source_node_id": "chart",
        "source_output": "error",
        "target_node_id": "review",
        "target_input": "default"
      },
      {
        "source_node_id": "ok",
        "source_output": "true",
        "target_node_id": "resolved",
        "target_input": "default"
      },
      {
        "source_node_id": "ok",
        "source_output": "false",
        "target_node_id": "review",
        "target_input": "default"
      }
    ]
  }
}
