Turn a positive health-related social needs screening into a tracked, consented referral to a community-based organization and bring the outcome back to the chart — Z codes proposed for clinician confirmation, HSDS resource directory search, a consent gate and minimum-necessary allowlist that excludes Part 2 and other sensitive data, Gravity Project ServiceRequest and Task exchange directly or through a coordination platform, idempotent status webhooks, and completed services recorded as Procedures.
Tags: healthcare, provider, sdoh, social-care, gravity-project, closed-loop-referral, community-organizations, consent, hsds, care-coordination, api-led, process-api, experience-api, fhir, epic, salesforce
Closed-Loop Social Care Referrals: Screening to Community Organizations and Back
Review the regulatory requirements before implementing. The regulatory details in this blueprint are general guidance, not legal or compliance advice — rules change, and many vary by state, payer, or contract. Before you build, have the privacy officer and the social work lead confirm:
- Step 3: whether sharing with community organizations that are not HIPAA covered entities requires patient consent under your policy and state law — this blueprint assumes it does.
- Step 3: the 42 CFR Part 2 exclusion and the other sensitive categories kept out of referrals.
- Step 1: AHC HRSN LOINC 96777-8, Z59.41 for food insecurity, and each instrument's published positive-screen rules.
- Steps 4 and 5: the Gravity SDOH Clinical Care IG version in use — ServiceRequest and Task pattern,
Task.partOf for platform child Tasks, the Task status list, and Procedure as the output.
Deliverable: A social care referral Process API that takes a positive health-related social needs screening from the EHR, proposes Z codes for clinician confirmation, finds services in a resource directory, sends a consented, minimum-necessary referral to a community-based organization directly or through a coordination platform, and brings the outcome back to the chart — modeled on the Gravity Project SDOH Clinical Care FHIR implementation guide.
Objective: Screening for food, housing, transportation, and utility needs is now routine in primary care and required by several quality programs, but a screening only helps if something happens after it. Today a social worker prints a list of phone numbers, or faxes a form to a food pantry that has no way to reply, and the chart never learns whether the patient got help. Community organizations get referrals with too little information to act on — or far more than they should hold. Working looks like a positive screen that becomes a tracked referral in minutes, a community organization that receives only what it needs with the patient's consent, a status the care team can see without calling, and a completed service that shows up in the chart as a coded intervention.
What's Getting Built
- Screening intake (System API) — reads completed screenings and item answers from the EHR ·
GET /QuestionnaireResponse?patient=&questionnaire=, GET /Observation?category=sdoh
- Needs and conditions (Process API) — derives needs from answers, proposes Z codes, and writes confirmed conditions and goals ·
POST /social-needs/assess, POST /Condition, POST /Goal
- Resource directory (System API) — searches services by need, location, eligibility, language, and hours in an HSDS-compatible directory ·
GET /services?need=&near=&language=, GET /services/{id}
- Consent (Process API) — records and checks the patient's consent to share with a named organization or program ·
POST /Consent, GET /consents/check?patient=&recipient=
- Referral orchestration (Process API) — creates the ServiceRequest and Task, routes to the organization or platform, and tracks status ·
POST /social-referrals, GET /social-referrals/{id}, PATCH /social-referrals/{id}
- Coordination platform (System API) — exchanges referrals and status with
{coordination_platform} · POST /ServiceRequest, POST /Task, POST /webhooks/task-status
- Organization portal (Experience API) — lets a community organization without its own system accept, update, and close referrals ·
GET /partner/referrals, PATCH /partner/referrals/{id}
- Care team worklist (Experience API) — open referrals, overdue follow-ups, and outcomes in the EHR or a Health Cloud console ·
GET /worklists/social-care?team=
Prerequisites
- Anypoint Platform org and EHR FHIR R4 access scoped to Patient, QuestionnaireResponse, Observation, Condition, Goal, ServiceRequest, Task, Consent, and Procedure; write access agreed with the EHR team.
- A validated screening instrument in the EHR (
{screening_instrument} — for example the AHC HRSN tool, PRAPARE, or the Hunger Vital Sign) captured as coded answers, not free text.
- A resource directory —
{resource_directory}, ideally exposing the Open Referral Human Services Data Specification (HSDS) — with a named owner responsible for keeping listings current.
- Either
{coordination_platform} API access, or a list of partner community organizations willing to use the organization portal.
- A consent model and a data-sharing policy signed by privacy and compliance: what may be shared with organizations that are not HIPAA covered entities, and under what consent.
- Named owners: the social work or care management lead for workflow, and privacy for the data-sharing allowlist.
Choose your path
- Coordination platform — Choose when the community already runs a shared referral network. The orchestration layer sends one referral to the platform, which creates its own order and child Tasks for each organization and reports status back.
- Direct to organization — Choose when a handful of partners handle most referrals and there is no shared platform. Referrals go to the organization portal, and the orchestration layer is the system of record for status.
Both paths use the same Gravity ServiceRequest and Task model, so moving from direct to platform later changes routing, not the chart.
Architecture
1. Screening to coded needs
- Read the completed screening as a QuestionnaireResponse and derive needs from item answers using the instrument's published positive-screen rules, not a total score.
- Propose Z codes (Z55–Z65) for each positive domain — food insecurity is Z59.41 — and let the clinician confirm them. Never file a code the clinician hasn't accepted; it lands on the problem list and on claims.
- Record the patient's priority: a patient who screens positive for three needs may want help with one. The referral follows the patient's choice.
2. Directory search
- Search the directory by need category, distance from the patient's address, language, hours, and eligibility — age, income, county, documentation requirements.
- Return a short, ranked list with the reason each service matched, and let the patient or care team choose. A service marked as not accepting referrals never appears.
- Flag stale listings (not verified in
{listing_verify_days}) to the directory owner rather than silently hiding them.
3. Consent and minimum necessary
- Check consent for the chosen recipient before creating the referral. No consent returns
403 and a prompt to collect it; the referral is not queued.
- Build the outbound payload from an allowlist: name, contact method, preferred language, need category, and a short reason the patient approved. Diagnoses, medications, and notes are not on the list.
- Exclude sensitive categories entirely — substance use disorder records under 42 CFR Part 2, HIV status, and reproductive and mental health detail — even if a clinician types them into the reason field. Scan the reason text and hold the referral for review if it matches.
- Offer a self-referral path: the patient receives the service's contact details and a tracking link, and no personal data leaves the organization.
4. Referral and routing
- Create a ServiceRequest (the order) and a Task (the fulfillment request) per the Gravity pattern; the Task's owner is the organization or the platform.
- With a platform, send one referral; the platform creates its own filler ServiceRequest and child Tasks linked by
Task.partOf, and reports each child's status back.
- Direct referrals notify the organization through its portal with a link and no personal data in the message body.
- Pre-screen for
{local_coverage_program} eligibility when the need is financial or coverage-related, so the organization receives a referral it can act on.
5. Status and closing the loop
- Accept Task status updates by webhook — received, accepted, rejected, in-progress, on-hold, completed, cancelled — idempotently, ordered by the Task's last-modified time so a late delivery never moves a referral backward.
- Put rejected referrals, and referrals with no status after
{referral_followup_days}, on the care team worklist with the organization's reason.
- When a Task completes, record the delivered service as a Procedure referencing the ServiceRequest, update the Goal, and show the outcome in the chart.
6. Measurement
- Report the funnel per need and per organization: screened, positive, referred, accepted, completed, and median days to completion.
- Rescreen at the next visit and link the result to the referral, so the program can see whether the need actually resolved.
7. Security and compliance
- Encrypt PHI in transit and at rest; the organization portal uses per-organization credentials and sees only referrals addressed to that organization.
- Log every disclosure to a community organization with the consent it relied on, to support accounting of disclosures.
- Honor consent revocation immediately: open Tasks for that recipient are cancelled and the organization is notified to stop using the data.
- Complete the shared Healthcare integration configuration checklist.
Configure with your own values: {screening_instrument}, {resource_directory}, {coordination_platform}, {local_coverage_program}, {referral_followup_days}, {referral_sla_days}, {listing_verify_days}.
Sample payload — referral with outcome
{
"referralId": "SCR-2026-004417",
"patient": { "mrn": "E3301882", "preferredLanguage": "es" },
"screening": {
"instrument": "AHC_HRSN",
"loinc": "96777-8",
"completedAt": "2026-04-14T15:02:11Z",
"positiveDomains": ["FOOD", "TRANSPORTATION"]
},
"conditions": [
{ "code": "Z59.41", "display": "Food insecurity", "status": "CONFIRMED", "confirmedBy": "practitioner/88120" }
],
"patientPriority": "FOOD",
"consent": { "id": "consent/55012", "recipient": "organization/cbo-0142", "scope": "SOCIAL_CARE_REFERRAL" },
"serviceRequest": { "id": "ServiceRequest/sr-7781", "category": "food-insecurity", "code": "food-pantry-program" },
"task": {
"id": "Task/t-9910",
"owner": "organization/cbo-0142",
"status": "completed",
"lastModified": "2026-04-19T18:40:02Z",
"output": [{ "type": "resulting-activity", "valueReference": "Procedure/pr-3304" }]
},
"sharedFields": ["name", "phone", "preferredLanguage", "needCategory", "patientReason"]
}
Deterministic checks
POST /social-referrals without a matching consent returns 403 and creates no ServiceRequest or Task.
- The outbound payload contains only allowlisted fields; a test that adds a diagnosis or medication to the source record produces an identical payload.
- Z codes are never written as confirmed Conditions without a clinician reference.
- Task status updates are idempotent on Task ID plus last-modified time; a delayed
in-progress after completed leaves the referral completed.
- A consent revocation cancels every open Task for that recipient in one transaction.
- MUnit suites cover positive-screen rules per instrument, the sensitive-content hold, and the status state machine.
Testing and validation
- Run 100 historical screenings through the needs rules and compare to social work's own determination.
- Send a referral whose reason mentions a substance use treatment program; confirm it holds for review.
- With a platform, create one referral that fans out to two organizations and confirm both child Tasks report back to the same referral.
- Revoke consent mid-referral and confirm the organization sees the cancellation.
- Walk three partner organizations through the portal before go-live; if they can't close a referral in under a minute, they won't.
Phased rollout
Phase 1 — Connect
- Read screenings, propose Z codes, and search the directory; referrals stay manual while the needs rules are validated.
Phase 2 — Map and validate
- Turn on consented referrals to two or three partners through the portal or platform, and prove status flows back.
Phase 3 — Production
- Expand to all clinics and partners, publish the funnel, and add rescreen linkage.
Success metrics
- Share of positive screens with a referral or documented patient decline within
{referral_sla_days}.
- Closed-loop rate: referrals with a final status (completed, rejected, cancelled) versus no status.
- Need resolved at rescreen, per need and per organization.
- Partner adoption: organizations updating status without a phone call.
- Platform: webhook delivery lag and consent-check latency.
Troubleshooting
- Organizations reject referrals as ineligible — Likely cause: directory eligibility out of date. Fix: route rejection reasons back to the directory owner and flag the listing.
- Referral status stuck at requested — Likely cause: the organization never logged in to the portal. Fix: send the portal link through the organization's preferred channel and escalate after
{referral_followup_days}.
- Status moves backward — Likely cause: webhooks applied in arrival order. Fix: order by the Task's last-modified time and ignore older updates.
- Privacy review blocks go-live — Likely cause: free-text reasons carry clinical detail. Fix: keep the allowlist strict, add the sensitive-content hold, and default the reason to a coded need.
- Z codes flood the problem list — Likely cause: codes filed automatically from screening. Fix: propose only, and require clinician confirmation.