# Referral Intake Coordination
Log incoming patient referrals, chase down missing records from referring offices, and confirm scheduling on both ends — all administrative, no clinical judgment.

## When to use
- A new referral arrives (fax, portal, or email) and needs to be logged and tracked to completion.
- Required records (referral letter, insurance card, prior imaging) are missing and the referring office needs a nudge.
- A referral has been scheduled and both the patient and the referring office need confirmation.
- A referral has stalled past its expected turnaround and a human needs to be looped in.

## Tools
- `http-get` — read referral status, patient record IDs, or scheduling slots from the practice management (PM) system or referral portal.
- `http-post` — create a new referral record or log a status update in the PM system.
- `send-email` — send org-approved template emails to referring offices or patients (confirmations, record requests).
- `create-task` — open a tracked task on the board for a human to review missing records or stalled referrals.
- `schedule-task` — set a follow-up check (e.g., 48 hours) to re-check whether requested records have arrived.

## Playbook
1. When a new referral notification comes in, `http-get` the referral queue endpoint (e.g. GET https://api.practicepm.example.com/v1/referrals?status=new) to pull the record ID and required-document checklist. Never copy names, dates of birth, or condition details out of this call into anything outside the PM system itself.
2. `http-post` a new intake entry (e.g. POST https://api.practicepm.example.com/v1/referrals/{id}/intake) to log that intake has started, using only the opaque referral record ID.
3. Check the checklist for missing items (referral letter, insurance card, prior imaging). If anything is missing, `send-email` the referring office using the org-approved "records request" template, referencing the record ID only — never patient name or condition.
4. `schedule-task` a follow-up in 48 hours to re-check whether the referring office has sent the missing documents.
5. On the follow-up run, `http-get` the referral's document status (e.g. GET https://api.practicepm.example.com/v1/referrals/{id}/documents) to confirm completeness.
6. Once records are complete, `http-post` a scheduling confirmation entry (e.g. POST https://api.practicepm.example.com/v1/referrals/{id}/confirm) and `send-email` the patient an appointment-confirmation template — using only the approved template text, no added clinical commentary.
7. `send-email` the referring office a matching confirmation so both sides show the same appointment status.
8. If a patient message contains any mention of symptoms, worsening condition, or requests for medical advice, stop immediately — do not reply with clinical content. `create-task` to hand the message to a human clinician or care coordinator, citing the record ID only.
9. If records remain missing after two follow-up cycles, or the referral has passed its expected turnaround window, `create-task` to escalate to a human for direct outreach, referencing the record ID only.

## Failure modes
- Referring office ignores the records-request email — repeated `schedule-task` follow-ups with no response should trigger a human escalation via `create-task`, not further automated emails.
- A patient reply contains a symptom description or asks "what does this mean" — treat as an immediate hard stop and human handoff, never attempt to interpret or respond clinically.
- The PM system returns a 401/403 or no matching Integration row is configured for the host — stop and use `send-email` (or the org's designated channel) to notify a human, naming the service and required scopes, without retrying with guessed credentials.
- A record update needs a field correction, not a full recreation — that requires PATCH/PUT capability, which is out of scope for `http-post`; route as a human handoff via `create-task` instead of forcing a workaround.

## Done when
- The referral record shows complete required documents, a confirmed appointment on both the patient and referring-office side, and matching confirmation emails sent.
- Any symptom mention or stalled referral has been routed to a human via `create-task`, with no clinical content ever sent from this skill.