port the drug grouper to ruby