Just ask them. This algo uses survey results for its input anyway, so why not just ask people directly? I find the notion of "predicting suicidal thoughts" to be overreaching and struggle to stay off of the slippery slope of thinking how dangerous such a thing could be institutionally.
There's a normed and valid survey that asks the question already. OQ Measures' YOQ 2.0 Youth Questionnaire is widely used in behavioral health programs. Answers to these questions are combined to form a sub scale score that a professional may use in implementing feedback informed treatment.
Q21. I have hurt myself on purpose (for example, cut, scratched, or attempted suicide). Q41. I think about suicide or feel I would be better off dead.