These recipes demonstrate HIPAA-compliant approval workflows designed for healthcare operations, with built-in audit trails and access controls.
- Patient Data Access
- Treatment Plans
- Medication Changes
- Remote Care
Patient Data Access
Secure patient record access with role-based approvals and automatic logging.const accessPatientRecords = needsHumanApproval({
type: 'sync',
title: 'Patient Record Access',
ask: (args) => `Approve access to records for patient #${args.patientId}?`,
// Auto-approve for attending physicians
autoApprove: async (args) => args.requestorRole === 'ATTENDING_PHYSICIAN'
})
const accessPatientRecords = needsHumanApproval({
type: 'sync',
title: 'Patient Record Access',
ask: (args) => {
const urgent = args.isEmergency ? '🚨 URGENT: ' : '';
return `${urgent}Approve access to ${args.recordType} records for patient #${args.patientId}?`;
},
// Route to appropriate approvers based on record type
approvers: (args) => {
if (args.recordType === 'MENTAL_HEALTH') {
return [{ name: 'Mental Health Director', email: 'mh-director@hospital.com' }];
}
return [{ name: 'Medical Records', email: 'records@hospital.com' }];
},
approvalArguments: {
requestReason: {
type: 'string',
value: args.reason,
label: 'Access Reason',
editable: true
},
accessDuration: {
type: 'number',
value: 30,
label: 'Access Duration (minutes)',
editable: true
},
recordType: {
type: 'string',
value: args.recordType,
label: 'Record Type',
editable: false
},
isEmergency: {
type: 'boolean',
value: args.isEmergency,
label: 'Emergency Access',
editable: true
}
},
// Log all access attempts for HIPAA compliance
onApprovedCallbackUrl: 'https://audit-log.hospital.com/record-access'
})
When to use this
When to use this
- Third-party provider requests
- Research data access
- Insurance company requests
- Emergency access situations
Best practices
Best practices
- Always document access reason
- Set appropriate time limits
- Maintain detailed audit logs
- Consider emergency protocols
Treatment Plan Modifications
Handle treatment plan changes with appropriate clinical oversight.const modifyTreatmentPlan = needsHumanApproval({
type: 'async',
title: 'Treatment Plan Update',
ask: (args) => {
const priority = args.urgency === 'HIGH' ? '🔔 HIGH PRIORITY: ' : '';
return `${priority}Review treatment plan changes for patient #${args.patientId}`;
},
approvers: (args) => {
const approvers = [{
name: 'Primary Physician',
email: `dr-${args.primaryPhysicianId}@hospital.com`
}];
// Add specialist approval if needed
if (args.requiresSpecialist) {
approvers.push({
name: 'Specialist',
email: `dr-${args.specialistId}@hospital.com`
});
}
return approvers;
},
approvalArguments: {
currentPlan: {
type: 'longString',
value: args.currentPlan,
label: 'Current Treatment Plan',
editable: false
},
proposedChanges: {
type: 'longString',
value: args.changes,
label: 'Proposed Changes',
editable: true
},
clinicalReason: {
type: 'string',
value: args.reason,
label: 'Clinical Justification',
editable: true
}
}
})
Approval Routing
Approval Routing
- Primary physician review
- Specialist consultation
- Care team coordination
- Insurance pre-authorization
Medication Changes
Manage medication changes with pharmacy oversight and interaction checking.const updateMedication = needsHumanApproval({
type: 'sync',
title: 'Medication Change',
ask: (args) => `Approve change in medication for patient #${args.patientId}?`,
autoApprove: async (args) => !args.hasInteractions
})
const updateMedication = needsHumanApproval({
type: 'sync',
title: 'Medication Change',
ask: (args) => {
const warning = args.hasInteractions ? '⚠️ INTERACTION ALERT: ' : '';
return `${warning}Review medication change for patient #${args.patientId}`;
},
approvalArguments: {
currentMeds: {
type: 'longString',
value: args.currentMedications.join('\n'),
label: 'Current Medications',
editable: false
},
proposedMed: {
type: 'string',
value: args.newMedication,
label: 'Proposed Medication',
editable: true
},
dosage: {
type: 'string',
value: args.dosage,
label: 'Proposed Dosage',
editable: true
},
interactions: {
type: 'longString',
value: args.interactionWarnings || 'None detected',
label: 'Potential Interactions',
editable: false
}
},
// Require pharmacy approval for certain medications
shouldSeekApprovals: async (args) => {
return args.hasInteractions || args.isControlledSubstance;
}
})
All medication changes automatically check for drug interactions and require pharmacy approval if interactions are detected.
Remote Care Authorization
Handle remote care and telehealth approvals with licensing verification.const authorizeRemoteCare = needsHumanApproval({
type: 'sync',
title: 'Remote Care Authorization',
ask: (args) => `Authorize remote care session for patient #${args.patientId}?`,
approvalArguments: {
serviceType: {
type: 'string',
value: args.serviceType,
label: 'Service Type',
editable: true
},
patientLocation: {
type: 'string',
value: args.location,
label: 'Patient Location',
editable: false
},
crossState: {
type: 'boolean',
value: args.isCrossState,
label: 'Cross-state Care',
editable: false
},
providerLicense: {
type: 'string',
value: args.providerLicenses.join(', '),
label: 'Provider Licenses',
editable: false
}
},
// Check licensing for cross-state care
shouldSeekApprovals: async (args) => {
return args.isCrossState || args.serviceType === 'CONTROLLED_SUBSTANCE';
},
// Require medical director approval for certain cases
approvers: (args) => {
if (args.isCrossState || args.serviceType === 'CONTROLLED_SUBSTANCE') {
return [{ name: 'Medical Director', email: 'medical-director@hospital.com' }];
}
return [{ name: 'Care Coordinator', email: 'care@hospital.com' }];
}
})
Compliance Checks
Compliance Checks
- State licensing verification
- Patient location validation
- Service type restrictions
- Provider credentials
Next Steps
Compliance Integration
Explore legal approval workflows