The law specifically seeks to prevent these kinds of outcomes by giving the parties involved leeway in how they do their jobs. You need an asshole cop, a prosecutor looking to pad their performance stats, a judge that doesn't care and a lawyer not doing their job in order for someone to go to jail on a possession charge and in the rare event that does happen when the miscarriage is pointed out it can usually be corrected by downgrading the offense after the fact. At least four people need to do their jobs not only wrong but do them wrong in a specific way in order for someone to go to jail over drug possession.
Sure. But you'll need to figure out some way to model social acceptance. Going to jail for weed in 1990 was not considered a miscarriage of justice. Going to jail for weed in 2010 is.