I don’t remember what the test is, but there’s genetic tests for common medication that show how likely it is to have a weird side effect. I once had a psychotic episode after taking Wellbutrin, despite having no history of psychosis (before or since!) My daughter got a genetic screen and a baseline interaction is a 1, with 10 being way off, I suppose. My daughter got a 9 for Wellbutrin. I assume I gave her that. Something about my chemistry just doesn’t interact with that drug the way other people do.
There is this: https://www.labqualitydays.fi/en/news/pharmacogenetics-do-yo... just the first thing I found.
As an anecdotal data point, I'm a redhead with a periodic liver condition and a fast metabolism, and I don't metabolize medications normally. I take an antispasmodic for pain relief in doses that leave some people catatonic and it has little to no negative effects on me, over a decade of use. I've tried low doses of muscle relaxants that leave me reeling drunk for hours. Had two awful experiences on SSRIs, I will never try those again should I ever have the need of an antidepressant. I suspect there are sub-populations of people like me who are statistical outliers.