I'm guessing it's a by-product of metabolised toxins and/or bacteria that act on certain (feel bad) receptors, yes they exist. Some chemicals have been isolated to produce affect, like agonize or block receptors in a broad spectrum way, like SSRI's and I still think this is a "dirty" way of treating mood problems like "caffeine" and "alcohol" have the side effects of jitteriness or worse. There are so many psych meds available that even experts given known quantities could foul it up.
But I see your aim, this is very complex organic chemistry, precursors, multiple variables to consider, chemical reactions are difficult to predict sometimes.
I sometimes wonder if we will look back on this golden age of pharmacology and feel very foolish, the way we are starting to learn about
sugar, aspartame, msg, flouride and the side effects/aftermath of what is was simply known as an "additive" or "sweetener."
Yes it would be great if we could identify the pathogens by simply isolating and identifying the toxins emitted by these pathogens into the bloodstream. After provoking a herxheimer reaction by ingesting certain bactericidal/antiviral/antifungal/antiparasitic substance that is.
It shouldn't be too difficult but nobody really does that.
That would make a fine PhD dissertation.