Dev Reference

Referrals

Outbound referral creation, specialist directory lookup, Direct/TEFCA messaging, standing referrals, and closed-loop status tracking.

Data Classification: All entities are org-scoped (partitioned by OrganizationID). See Data Model for ownership rules and IC Reference for isolation constraints.

Referral

Org-scoped. Trust Tier: T1 (PHI + clinical summary).

Schema

FieldTypeRequiredPKFKNotes
ReferralIDUUIDYesYesPrimary key
PatientIDUUIDYesPatient
FromProviderIDUUIDYesProviderReferring provider
ToProviderIDUUIDNoProviderTarget specialist (if known internally)
ToOrganizationIDUUIDNoOrganizationExternal receiving org
ReferralReasonString(200)Yes
ClinicalSummaryTextNo
UrgencyString(50)YesRoutine / Urgent / Emergent
StatusString(50)YesCreated / Sent / Acknowledged / Scheduled / Completed / ReportReceived / Cancelled
ReferralTypeString(50)YesConsultation / Transfer / SecondOpinion
NpiTargetString(50)NoTarget specialist NPI
DirectAddressString(200)NoDirect Messaging address
FhirServiceRequestIDString(50)NoFHIR R4 ServiceRequest reference
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Patient (10)T1Read own referral status via portal
Front Desk (20)T1Read status; schedule follow-up
RN / MA (30)T1Process referral queue; update status
Referral Coordinator (40)T1Full worklist access; manage referral lifecycle
Provider (60)T1Create / read / sign referrals
PA / NP (60)T1Draft referrals; co-sign required
Org Admin (70)T1Read / write all referrals
SuperAdmin (100)T1Full CRUD

ReferralResponse

Org-scoped. Trust Tier: T1.

Schema

FieldTypeRequiredPKFKNotes
ReferralResponseIDUUIDYesYesPrimary key
ReferralIDUUIDYesReferral
RespondingProviderIDUUIDYesProvider
ResponseTypeString(50)YesAccepted / Declined / NeedsMoreInfo
ResponseNoteTextNo
AppointmentDateTimeDateTime (UTC)No
ReportReceivedBoolYesConsultation report returned
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Referral Coordinator (40)T1Read responses; update status
Provider (60)T1Read / create responses
Org Admin (70)T1Read all
SuperAdmin (100)T1Full CRUD

ReferralStatusHistory

Org-scoped. Trust Tier: T2 (status metadata).

Schema

FieldTypeRequiredPKFKNotes
ReferralStatusHistoryIDUUIDYesYesPrimary key
ReferralIDUUIDYesReferral
ChangedByUserIDUUIDYesUser
StatusString(50)YesStatus value at this point in time
ChangedDateTimeDateTime (UTC)Yes
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Referral Coordinator (40)T2Read history
Provider (60)T2Read history
Org Admin (70)T2Read all
SuperAdmin (100)T2Full CRUD

SpecialistDirectory

Org-scoped. Trust Tier: T3 (public provider directory data).

Schema

FieldTypeRequiredPKFKNotes
SpecialistDirectoryIDUUIDYesYesPrimary key
NpiString(50)YesNational Provider Identifier
ProviderNameString(100)Yes
SpecialtyString(200)Yes
DirectAddressString(200)NoDirect Messaging address
TefcaEndpointUrlStringNoTEFCA network endpoint
AcceptingNewPatientsBoolYes
InsuranceNetworksTextNoJSON array of accepted networks
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Front Desk (20)T3Read directory
Referral Coordinator (40)T3Read / write directory entries
Provider (60)T3Read directory
Org Admin (70)T3Read / write all
SuperAdmin (100)T3Full CRUD

StandingReferral

Org-scoped. Trust Tier: T1 (PHI).

Schema

FieldTypeRequiredPKFKNotes
StandingReferralIDUUIDYesYesPrimary key
PatientIDUUIDYesPatient
FromProviderIDUUIDYesProvider
ToProviderIDUUIDYesProvider
ReferralReasonString(200)Yes
VisitCountAllowedIntYes
VisitCountUsedIntYes
ExpirationDateTimeDateTime (UTC)Yes
IsActiveBoolYes
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Patient (10)T1Read own standing referral status
Front Desk (20)T1Read; check remaining visits
Referral Coordinator (40)T1Read / write; increment VisitCountUsed
Provider (60)T1Create / read / sign
Org Admin (70)T1Read / write all
SuperAdmin (100)T1Full CRUD

Trust tier roll-up

EntityTierSource of truth
Referral1 — Internal canonicalAuthored by a credentialed provider in this system; Direct Trust / FHIR transmission confirms delivery
ReferralResponse2 — External inboundResponse from an external specialist via Direct Trust or TEFCA
ReferralStatusHistory2 — Audit trail, operationalSystem-generated audit rows recording state-machine transitions
SpecialistDirectory2 — External inboundCurated from NPPES and payer Provider Directory APIs; verified and augmented by the practice
StandingReferral1 — Internal canonicalStanding order authored by a credentialed provider in this system

RBAC matrix (IC 0–100 scale)

RoleLevelReferralReferralResponseReferralStatusHistorySpecialistDirectoryStandingReferral
Patient (self)10Read own referral status (via Patient Portal)Read ownNo accessNo accessRead own active standing referrals
FrontDesk (Jordan)20Read status only; schedule appointments from referralRead accept/declineNo accessSearch onlyRead active
RN / MA (Tasha)30Process coordinator queue; update status; no create/signUpdate ReportReceivedBoolReadSearchRead; increment visit count
ReferralCoordinator40Full worklist access; update status; chase acknowledgementsRead / WriteReadSearchRead
Provider (Dr. M)60Create outbound; read inbound; sign referralReadReadRead / searchCreate / sign
PA / NP (Maria)60Draft outbound; co-sign requiredReadReadRead / searchDraft; co-sign required
OrgAdmin (Sam)70Read/write all; override stalled referral alertsRead / WriteReadRead / Write / curateRead / Write
SuperAdmin100Full CRUD all entities

Referral signing hard rule: Only providers (level ≥ 60) can sign an outbound referral. PA/NP (level 60) can draft but require a co-signing physician. RN/MA and ReferralCoordinator can update status and chase acknowledgements but cannot create or sign referrals. FrontDesk can schedule appointments from a referral but cannot modify referral data.

FK Relationship Diagram

erDiagram
    Patient ||--o{ Referral : "subject"
    Provider ||--o{ Referral : "FromProviderID"
    Provider ||--o{ Referral : "ToProviderID"
    Organization ||--o{ Referral : "ToOrganizationID"
    Referral ||--o{ ReferralResponse : "receives"
    Provider ||--o{ ReferralResponse : "RespondingProviderID"
    Referral ||--o{ ReferralStatusHistory : "tracks"
    User ||--o{ ReferralStatusHistory : "ChangedByUserID"
    Patient ||--o{ StandingReferral : "has"
    Provider ||--o{ StandingReferral : "FromProviderID"
    Provider ||--o{ StandingReferral : "ToProviderID"
    

Referral State Machine

stateDiagram-v2
    [*] --> Created
    Created --> Sent : Send via Direct / TEFCA
    Sent --> Acknowledged : Specialist confirms receipt
    Acknowledged --> Scheduled : Appointment booked
    Scheduled --> Completed : Visit completed
    Completed --> ReportReceived : Consultation report returned
    ReportReceived --> [*]
    Created --> Cancelled : Cancel before send
    Sent --> Cancelled : Cancel after send
    Acknowledged --> Cancelled : Cancel after acknowledgment
    Scheduled --> Cancelled : Cancel appointment
    

Functional Requirements

  1. P0 The system SHALL allow providers to create outbound referrals with patient demographics, clinical summary, and urgency level.
  2. P0 The system SHALL transmit referrals via Direct Messaging or TEFCA endpoints when a DirectAddress or TefcaEndpointUrl is available.
  3. P0 The system SHALL track referral status through the full lifecycle (Created through ReportReceived or Cancelled) with immutable history.
  4. P0 The system SHALL map referrals to FHIR R4 ServiceRequest resources for interoperability.
  5. P1 The system SHALL provide a specialist directory searchable by NPI, specialty, insurance network, and accepting-new-patients status.
  6. P1 The system SHALL support standing referrals with configurable visit count limits and expiration dates.
  7. P1 The system SHALL auto-decrement VisitCountUsed on StandingReferral when a visit is completed, and alert when approaching the limit.
  8. P1 The system SHALL require co-sign from supervising physician when PA/NP drafts a referral.
  9. P1 The system SHALL support referral responses (Accepted / Declined / NeedsMoreInfo) from the receiving specialist.
  10. P1 The system SHALL notify the referring provider when a consultation report is received.
  11. P2 The system SHALL provide a referral coordinator worklist with filtering by urgency, status, and age of referral.
  12. P2 The system SHALL allow patients to view their referral status and upcoming specialist appointments via the patient portal.
  13. P2 The system SHALL support bulk referral status updates for coordinator efficiency.
  14. P2 The system SHALL auto-flag referrals that have been in Sent status for more than 7 days without acknowledgment.

Non-Functional Requirements

icApplication Overrides

How the five Referrals AMI schemas turn into a live application: module-specific stack additions (Direct Trust transport, TEFCA participation, NPI registry, payer directories), override component bindings, a versioning worked example, environment cascade, and RBAC enforcement.

Shared generation map. The IC platform code-gen flow, default bindings, environment cascade, RBAC model, and CLI commands are identical across all modules. See the IC Reference for the canonical shared reference. This section covers only Referrals-specific content.

Technology stack P0

The shared platform stack (Cosmos DB, Redis, IC-generated API, Angular 21, SQS+SNS, OpenTelemetry, etc.) is documented in the IC Reference. Module-specific additions:

LayerTechnologyNotes
Direct Trust transportKno2 / Updox (HISP)BUY — Direct Trust messaging for outbound and inbound referral exchange.
TEFCA participationQHIN sub-participant (Kno2 / eHealth Exchange)Fallback when specialist has no Direct address. Sub-participant only; not a QHIN.
NPI registryNPPES NPI registry APISource of truth for specialist directory; cached per org.
Payer directoriesPayer Provider Directory APIs (CMS-0057-F)Insurance-aware specialist filtering.
FHIR profilesServiceRequest, Task, Practitioner, OrganizationR4 baseline; USCDI v3 alignment.
USCDI bundlerBUILD (internal)Assembles USCDI v3 clinical data bundle from global patient record.

Referrals-specific override bindings P0

These overrides are declared in rules/*.rules.json and replace the default for the matching field name pattern.

FieldDefault would renderOverride componentWhy
Referral.ClinicalSummaryTextplain textareaic-ng21-referral-1-bundle-previewUSCDI bundle preview with expandable sections; renders clinical data from the global patient record rather than free-text entry.
Referral.NpiTargetString50plain text inputic-ng21-referral-1-specialist-pickerNPI-aware search with Direct address, specialty, and insurance filters; validates against NPPES registry and payer directories.
Referral.StatusString50plain text displayic-ng21-referral-1-status-pillColor-coded dark pill for referral status (Draft / Sent / Accepted / Declined / Completed / Cancelled).
Referral.UrgencyString50plain text inputic-ng21-core-1-selectDropdown: Routine / Urgent / Emergent. Prevents free-text urgency entry; standardizes triage categorization.
Referral.ReferralTypeString50plain text inputic-ng21-core-1-radio-groupOutbound / inbound toggle. Determines message routing: outbound sends via Direct Trust; inbound receives and parses.
(synthetic) referral composern/aic-ng21-referral-1-composerOne-screen referral creation flow: specialist picker + clinical summary bundle + urgency + Direct address resolution + send gate.
(synthetic) coordinator worklistn/aic-ng21-referral-1-worklistStalled/overdue referral queue for care coordinators; sortable by urgency, days outstanding, specialist.
(synthetic) response cardn/aic-ng21-referral-1-response-cardAccept/decline/modify with appointment slot; renders inbound specialist response from Direct Trust message.
(synthetic) standing referral managern/aic-ng21-referral-1-standing-referral-managerVisit count tracking, expiration management, auto-renewal flags for standing referrals.
(synthetic) PA flagn/aic-ng21-referral-1-pa-flagRoutes to Payer Optimization when prior authorization is required for the referred service.

Versioning — worked example P0

All referral artifacts are versioned break.feature.bug.buildtimestamp per IC hard rule #9. The example below traces a feature bump on ReferralStatusHistory.

ReferralStatusHistory 1.0.0.20260301T120000Z — Initial schema with StatusString50 and ChangedDateTimeUTC. Component ic-ng21-referral-1-status-pill binds to referral-status-history@1.0.0.* via the DI manifest.

ReferralStatusHistory 1.1.0.20260515T093000Z — feature bump — Adds a single optional field, ChangedByProviderNameString100, to capture the denormalized display name for the provider who changed the referral status. Per the IC change matrix:

ChangeVersion impactApproval neededMin permission
Add optional field ChangedByProviderNameString100feature bump (1.0.0 → 1.1.0)NoWrite (60)

Because the change is backward-compatible (optional field addition with no type change to existing fields), the component tag stays ic-ng21-referral-1-status-pill. Existing UI consumers continue to bind referral-status-history@1.x.* and ignore the new field. New UI surfaces that need the provider display name bind referral-status-history@^1.1.0. No new database is required (IC rule #13 only applies to break bumps).

ReferralStatusHistory 2.0.0 — break bump (illustrative) — An illustrative future break bump: StatusString50 splits into StatusCodeString50 + StatusDisplayString100 with multi-language support. Per the IC change matrix this is change field type + add required fields — break bump, EditAMI (90) approval, and per IC rule #13 a new database is provisioned with ETL from the old one. The component tag becomes ic-ng21-referral-2-status-pill; consumers must re-bind. The old database stays live for the configured grace period (default 90 days) for rollback.

Illustrative. The 2.0.0 example is illustrative of the change matrix and IC rule #13; it is not a committed roadmap item.

Referrals environment details

EnvDirect TrustNPPESTEFCA
DevKno2 sandboxNPPES testDirect Trust test
QAKno2 sandboxNPPES testExpanded test partner set
UATKno2 stagingNPPES liveTEFCA staging
ProdKno2 productionNPPES liveTEFCA production, QHIN sub-participant

Referrals RBAC notes

Cross-Module Dependencies

See also: Referrals walkthrough · IC Reference