this, to be working effectively, is not as easy as just writing a script.
We need to get samples of user records, usually at least thousands of them, to train a ML model. Then we use this model to do the prediction and recommendation work. That's how AI works.
But depending on your request, there might be easier way. Please talk to me for more details.
Thanks