{
  "name": "Financial Counselling: Intake & Assessment",
  "version": "1.0.0",
  "description": "Standalone intake parser with empathetic extraction and risk assessment - can be used independently or as part of the full Crisis-to-Action pipeline",
  "category": "solutions",
  "tags": ["financial-counselling", "gambling-harm", "intake", "assessment"],
  "input_schema": {
    "type": "object",
    "properties": {
      "contact_content": {
        "type": "string",
        "description": "The client's initial message, form submission, or counsellor notes"
      },
      "contact_method": {
        "type": "string",
        "enum": ["email", "form", "phone_transcript", "in_person_notes"]
      }
    },
    "required": ["contact_content"]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "structured_intake": { "type": "object" },
      "crisis_assessment": { "type": "object" },
      "risk_score": { "type": "object" },
      "recommended_next_steps": { "type": "array" }
    }
  },
  "stages": [
    {
      "id": "parse-intake",
      "name": "Empathetic Intake Parser",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.3,
        "system_prompt": "You are supporting a financial counsellor helping someone affected by gambling harm. Approach this with deep compassion - seeking help takes enormous courage.\n\nGuidelines:\n- Use person-first language (\"person experiencing gambling harm\")\n- Extract information without judgment\n- Note strengths and supports alongside challenges\n- Acknowledge the difficulty of this situation\n- If you detect crisis indicators (self-harm, suicidal thoughts, domestic violence), flag immediately\n\nNever:\n- Use shame-based language\n- Make assumptions about character\n- Minimize the person's experience\n\nExtract and return as JSON:\n{\n  \"client_situation\": {\n    \"summary\": \"2-3 sentence empathetic summary\",\n    \"strengths_noted\": [\"Things going well or resources available\"],\n    \"support_systems\": [\"Family, friends, services already engaged\"]\n  },\n  \"financial_snapshot\": {\n    \"debts_mentioned\": [{\"type\": \"\", \"amount_if_known\": \"\", \"creditor\": \"\"}],\n    \"income_sources\": [],\n    \"dependents\": 0,\n    \"housing_status\": \"owns|rents|at_risk|unknown\"\n  },\n  \"gambling_context\": {\n    \"pattern_indicators\": \"What gambling behavior is mentioned\",\n    \"duration_mentioned\": \"How long this has been happening\",\n    \"seeking_help_motivation\": \"What prompted them to reach out\"\n  },\n  \"immediate_concerns\": {\n    \"threats\": [\"Eviction notice\", \"Disconnection\", etc.],\n    \"urgency_indicators\": [\"Dates mentioned\", \"Deadlines\"]\n  },\n  \"crisis_indicators\": {\n    \"detected\": false,\n    \"type\": null,\n    \"details\": null\n  }\n}",
        "prompt": "Please carefully read this client contact and extract relevant information with empathy:\n\nContact Method: {{input.contact_method | default('unknown')}}\n\nClient Message:\n{{input.contact_content}}\n\nRemember: This person has shown courage in reaching out."
      },
      "depends_on": [],
      "position": { "x": 100, "y": 100 }
    },
    {
      "id": "assess-crisis",
      "name": "Crisis Assessment",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.1,
        "system_prompt": "You are a crisis detection specialist. Identify if immediate human intervention is needed.\n\nCRISIS indicators requiring IMMEDIATE escalation:\n- Suicidal ideation or self-harm\n- Domestic violence or safety concerns\n- Homelessness within 24-48 hours\n- Children at immediate risk\n- Severe mental health crisis\n\nReturn JSON:\n{\n  \"crisis_detected\": boolean,\n  \"crisis_type\": \"suicide_risk\" | \"domestic_violence\" | \"child_safety\" | \"imminent_homelessness\" | \"mental_health_crisis\" | null,\n  \"severity\": \"immediate\" | \"urgent\" | \"elevated\" | \"standard\",\n  \"escalation_required\": boolean,\n  \"escalation_action\": \"Description of what should happen\" | null,\n  \"safe_to_proceed\": boolean\n}",
        "prompt": "Review this intake for crisis indicators:\n\n{{upstream.parse-intake.result}}\n\nDetermine if immediate human intervention is required."
      },
      "depends_on": ["parse-intake"],
      "position": { "x": 100, "y": 250 }
    },
    {
      "id": "calculate-risk",
      "name": "Financial Risk Score",
      "component_type": "generator",
      "config": {
        "provider": "openai",
        "model": "gpt-4o",
        "temperature": 0.2,
        "system_prompt": "Calculate a financial distress risk score (0-10).\n\nScoring:\n- 0-2: Stable\n- 3-4: Moderate concern\n- 5-6: Elevated\n- 7-8: High\n- 9-10: Critical\n\nFactors: debt-to-income, housing security, dependents, utility threats, employment stability, support systems.\n\nReturn JSON:\n{\n  \"risk_score\": number,\n  \"risk_level\": \"stable\" | \"moderate\" | \"elevated\" | \"high\" | \"critical\",\n  \"primary_concerns\": [\"top 3 concerns\"],\n  \"protective_factors\": [\"strengths identified\"],\n  \"priority_areas\": [\"housing\", \"utilities\", \"income\", \"debts\"],\n  \"recommended_urgency\": \"standard\" | \"priority\" | \"urgent\"\n}",
        "prompt": "Assess financial distress risk:\n\n{{upstream.parse-intake.result}}"
      },
      "depends_on": ["parse-intake"],
      "position": { "x": 350, "y": 250 }
    },
    {
      "id": "determine-next-steps",
      "name": "Recommend Next Steps",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.3,
        "system_prompt": "Based on the intake and assessment, recommend next steps for the counsellor.\n\nReturn JSON:\n{\n  \"recommended_actions\": [\n    {\n      \"action\": \"What to do\",\n      \"priority\": \"immediate\" | \"high\" | \"medium\" | \"low\",\n      \"reason\": \"Why this matters\"\n    }\n  ],\n  \"research_needed\": [\"Topics to research for this client\"],\n  \"appointment_urgency\": \"within_24h\" | \"within_week\" | \"standard\",\n  \"specialist_referrals\": [\"Any specialist services to consider\"]\n}",
        "prompt": "Based on this assessment, what should happen next?\n\nIntake:\n{{upstream.parse-intake.result}}\n\nCrisis Assessment:\n{{upstream.assess-crisis.result}}\n\nRisk Score:\n{{upstream.calculate-risk.result}}"
      },
      "depends_on": ["assess-crisis", "calculate-risk"],
      "position": { "x": 225, "y": 400 }
    },
    {
      "id": "compile-output",
      "name": "Compile Assessment Report",
      "component_type": "json_transform",
      "config": {
        "data": {
          "structured_intake": "{{upstream.parse-intake.result}}",
          "crisis_assessment": "{{upstream.assess-crisis.result}}",
          "risk_score": "{{upstream.calculate-risk.result}}",
          "recommended_next_steps": "{{upstream.determine-next-steps.result}}"
        },
        "jmespath_expression": "@"
      },
      "depends_on": ["determine-next-steps"],
      "position": { "x": 225, "y": 550 }
    }
  ],
  "output_stage_id": "compile-output"
}
