The present invention describes a novel system, drug delivery device, mobile App, drug specific drug dispensing algorithm, and method to improve medication safety and effectiveness via the utilization of drug specific algorithms to control drug dispensing, avoid drug mediated adverse events, ensure prescription persistence and promote prescription compliance on a cost- effective real-time basis.