Machine learning can identify patients who are at risk for persistent opioid use after surgery, according to a study.