25.2.6.4.2 Predicting Patient Onboarding Outcome
Invoke a machine learning model to predict patient onboarding outcomes and route the workflow.
The Patient Onboarding workflow uses the machine learning model in two
different Invoke API activities. First, the Evaluate Insurance Risk calls
the EVALUATE_RISK function to detect if historically a patient with a
similar request to the current one was automatically rejected. Office staff tells you
that this automatic rejection was due to the patient's insurance not reimbursing the
procedure.
Figure 25-88 Two Combinations of Invoke API and Switch Using Machine Learning
The code for EVALUATE_RISK appears below. Predicting the outcome of the onboarding patient approval using the Neural Network machine learning model that won the AutoML experiment is a single SQL statement using the PREDICTION function. Its USING clause feeds the model the values of the current patient's insurance provider and initial procedure. Recall that these were the two columns that most strongly predicted the outcome. If the model predicts the STATUS to be "AutoRejected", then the function returns the outcome "Risky", otherwise it returns "Low Risk". The Evaluate Insurance Risk activity returns the Function Result into the V_RESULT workflow variable, and the subsequent Risk Level? Switch activity uses that variable containing the outcome value to decide the path to follow.
-- Result = 'Low Risk' or 'Risky'
function evaluate_risk(p_patient_id number)
return varchar2 is
l_result varchar2(30);
begin
/*
| Machine Learning Model NN_CE379F672F was the winning model
| automatically identified by using AutoML.
*/
select
prediction (NN_CE379F672F
using
pat.insurance_provider as insurance_provider,
pat.initial_procedure as initial_procedure
)
into l_result
from frc_patients pat
where pat.id = p_patient_id;
if l_result = 'AutoRejected' then
return 'Risky';
else
return 'Low Risk';
end if;
end; The Predict Approval activity uses Invoke API again to call a similar PREDICT_APPROVAL function. It accepts the previous prediction as a parameter. If that prediction was "AutoApproved" then it returns the outcome string "Auto-Approved", otherwise it returns the string "Manual. The Predict Approval activity returns the Function Result into the V_RESULT workflow variable, and the subsequent Auto‑Approve? Switch activity uses that variable containing the outcome value to decide the path to follow.
Parent topic: Predicting Results with Machine Learning
