Artificial Intelligence: Will Machine Learning Revolutionize Retail Pharmacy?

When you think of artificial intelligence, what comes to mind? A killer cyborg from the future? A Pixar robot saving humanity from itself? A virtual assistant who can fall in love?

Although artificial intelligence (AI) is still in its early stages, it is no longer just the projection of Hollywood and science fiction. “Because of all the advances in computing, artificial intelligence is not pie in the sky,” said Ken Perez, vice president at Omnicell, a multinational healthcare technology company. “It’s something that is already occurring.”

Artificial intelligence is nearly everywhere in life, though it isn’t the kind of thing that will destroy or save all of humanity. Its application is more mundane, powering many of the daily conveniences we now take for granted: search suggestions, autocorrect, face recognition, chatbots, ridesharing apps, social media recommendations, Spotify playlists. Machine learning powers Apple’s Siri, Amazon’s Echo, and Google’s Assistant. Likewise, you might not recognize AI even though it powers familiar pharmacy technology. “For the most part, AI is under the hood of various solutions,” Perez said.

AI solutions in retail pharmacy can offload laborious, menial, and time-intensive tasks so pharmacists can center their time around patient care. “The technology is going to aid in reducing the pharmacist’s load so that they can actually practice at the top of their training,” said Ram Subramanian, PhD, chief technology officer at InterLinkAI, an automated pharmacy management system that uses machine learning.

Although it may sound counterintuitive, leveraging more technology will enable independent pharmacies to become more human, and more personal, than they have been since the soda fountain days. “AI holds the potential to enable community pharmacies to be even more proactive and personalized in how they understand and serve their patients,” Perez said. “AI is the engine that empowers them to do even better personalization.”

AI defined

Most simply, artificial intelligence describes computer systems that mimic the brains of humans. Perez puts it this way: “How can a computer simulate the intelligence of the human being?”

Humans can input new information (learning) and change their output (behavior) based on what they learned. They can make judgments based on context and situation. They can identify patterns and adapt. They can recognize things visually. The goal of AI is for a machine to imitate those kinds of abilities.

Most of the time, the phrase artificial intelligence really refers to “machine learning,” a subset of AI. As the name indicates, machine learning systems process information and change their output organically as they learn new things. The machine identifies patterns over time, building an increasingly complex database that enables it to respond more specifically to any given situation and to more scenarios it hasn’t encountered.

“We’re using a lot of data in order to develop a decision-making system that then tells us what to do next. Given an input, what should we do?” Subramanian explained.

“AI holds the potential to enable community pharmacies to be even more proactive and personalized in how they understand and serve their patients.”

To illustrate, Subramanian gave the example of a GPS. On a regular computing model, the program will tell you when to turn to reach the chosen destination. With AI, the program will not only tell you which path to take but will adjust the route in real-time based on changes in the environment, such as a pedestrian crossing the street or a red light. “It’s not just blindly taking a right or left. It’s actually sampling some information from the environment, and then based on known examples that we’ve used in the past, it’s going to make the best decision possible.”

This isn’t the result of humans inputting a bunch of formulas and the computer choosing one of them depending on the circumstance. Instead, it’s the result of the machine mimicking brain neurons by organically reconfiguring connections as it learns new data. Gideon Lewis-Kraus, in New York Times Magazine, explains it like this: “With life experience, depending on a particular person’s trials and errors, the synaptic connections among pairs of neurons get stronger or weaker. An artificial neural network could do something similar …. It wouldn’t need to be preprogrammed with fixed rules. It would, instead, rewire itself to reflect patterns in the data it absorbed.”

That means you can give massive amounts of data to a computer and it can come up with all kinds of insights on its own, even ones humans would not have expected. “With big data you can extract information automatically,” Perez said. “You can sort it. You can analyze it. You can apply algorithms to it. And you can actually learn and draw conclusions and derive insights.”

This unique capacity for data analysis and application unlocks unprecedented potential. Because there is no limit to the amount of data an AI machine can absorb, it can not only copy advanced human abilities but surpass them. “Computers can do some amazing things that would take smart people with PhDs literally decades,” Perez said. “The algorithms draw conclusions that are way beyond what a lot of humans can do.”

AI in the pharmacy

With its unique ability to mine and track tons of data, machine learning can make calculations and predictions more quickly and accurately than humans. This predictive prowess can drive all sorts of optimizations in inventory management, workflow, patient treatments, patient interactions, and customer service.

“There’s a huge variety of things that pharmacists can use,” said Scott Nelson, PharmD, assistant professor of Biomedical Informatics and director of the MS Applied Clinical Informatics (MS-ACI) program at Vanderbilt University. “Some of those will help the business in terms of workflow and in terms of having better quality control and better adherence for patients.”

For workflow, AI can streamline operations by optimizing staff levels to match expected traffic, reducing the time to fill with automatic pill counters, and minimizing wait times with more accurate timing for prescription pick up.

“Think of a pharmacy getting 50 orders within the hour. AI can determine which order has a higher priority because the patient is more likely to pick it up within the hour versus picking it up after an hour,” Subramanian explained. “So now you can prioritize which prescriptions you’re going to package first. There are nuances that will ease any sort of bottlenecks in the workflow for the pharmacy.”

Technology exists to translate e-prescriptions, saving at least 10 seconds per prescription while improving accuracy from 40 percent to 90 percent compared with manually transcribing, according to one company. AI populates all the necessary fields, flags missing information, and substitutes NDCs based on current inventory stock—all automatically.

AI can help pharmacies master inventory control with greater precision, helping them order the right items in right quantity at the right time. It does this in several ways: predicts demand by mining historical and real-time purchasing data and other factors; reduces costs by finding the best prices and tracking contract incentives to maximize rebates; minimizes spoilage by monitoring individual SKUs in real time; minimizes holding costs through precise forecasting; syncs inventory purchases more closely to the time of pickup; and more.


AI enables more precise and personalized care by learning a lot about your patients: who is unlikely to adhere, who might need a consultation, who needs medication reviews, who needs delivery, who will respond to what type of intervention.

“Predictive and prescriptive models can identify individuals who would benefit from patient communications or medication therapy management, or who would be more likely than not to respond well to these actions,” Perez said. “Understanding who will respond to which interventions is as important as understanding who needs those treatments.”

Perez described a company that is already using AI to segment its patients into very specific categories with common behaviors, allowing the company to tailor its service to better meet needs.

“At first they say we’re talking about women who live in rural areas in the Northeast who are between the ages of 30 and 40 who have two children,” Perez explained. “They discover these women don’t pick up medications from retail pharmacies. Why is that? Because it’s hard to get daycare. They’ve got two kids, not one. It’s a hassle to put them in the car and it’s treacherous driving. There’s ice and snow. And during these months from, let’s say November through February, the retail pharmacy should ask if they would like their medications mailed or delivered.”

“Computers can do some amazing things that would take smart people with PhDs literally decades.”


Artificial intelligence is especially suited to improving safety in the pharmacy. It can reduce adverse events and errors by noticing immediate problems, like the wrong number or kind of pill, and by foreseeing potential problems, like who may experience serious side effects.

“It could identify weird outlier medications, like wrong dosage or wrong patient, and it would flag those errors,” Nelson said. With fully adopted AI applications, perennial issues related to polypharmacy and drug-drug interactions could almost disappear.

But AI can go beyond noticing outliers through information alone—it can recognize objects visually as we do. In a sense, it has eyes. Just as a pharmacist would notice a pill is blue instead of red, artificial intelligence can spot errors by “looking” at it through a photo lens.

Subramanian referenced technology by InterLinkAI that not only counts pills but also scans them visually. If a clonidine accidentally mixes in with clonazepam, for example, the machine will recognize the difference in the lettering and send an alert even though the pill count is accurate.

“From a safety standpoint, not only are we recording an image of every code being dispensed, but every code is also using AI to identify the pills, so there’s no chance of a wrong medication getting to the patient,” Subramanian explained.

With this technology, pharmacists can verify prescriptions virtually, which means a single pharmacist can work at multiple locations without leaving a computer. A remote pharmacist can, among other benefits, provide extra support during peak hours but simply be on call during regular hours. This not only enhances operational efficiency but also provides a safer environment by allowing pharmacists more breaks and preventing long shifts that lead to errors.

Because of AI’s ability to quickly identify patterns among different data sources, it is effective at preventing controlled substance diversion, Nelson said. AI can continuously analyze prescription information with a patient’s entire history in view and spot predictors of opioid abuse the instant a prescription comes in.

Future of pharmacy

Although artificial intelligence offers much promise, its practical application will be limited until there are more robust and universal data-sharing solutions among all the stakeholders in healthcare.

“One of the key challenges is the gap between pharmacists who understand the problems and workflows, the developers and data scientists who create the model, and the administrators who make decisions about which AI solutions to client,” Nelson said. “There’s a gap that needs to be crossed to bring together the leading science and the clinical practice.”

And no matter how enthusiastic pharmacies are about AI technology, they are at the whim of companies to provide the solutions. “They need vendors to aggregate the data and apply algorithms to build the models and to produce the analytics and generate recommendations, and those need to be integrated into work,” Perez said.

AI will continue to grow and transform retail pharmacy in ways even unforeseeable right now. There was a time when it was inconceivable that a computer could translate language on its own or that cars could drive themselves. What will AI be capable of in ten years from here? And how could that transform pharmacy profession?

Since its inception, the prospect of artificial intelligence has made humans apprehensive. What if they replace us? What if they render essential human jobs extinct? Nelson suggests using the phrase “augmented intelligence” instead of artificial intelligence to emphasize AI’s true role in improvement rather than replacement.

“It’s here to help us with mundane tasks that we as humans typically don’t like doing, which then frees us up to do more human things faster and better, thereby allowing us to do more complex higher-level thinking,” Nelson said. “It allows us more time for compassion and empathy with our patient. No matter how good an AI model is, it’s never going to be there to hold the patient’s hand when they’re going through a hard time or to listen to their concerns. We’re the only ones who can do that.”

AI in the Front End

Machine learning can enhance numerous areas in front of the counter to improve the customer experience and increase retail sales. Here are some of the most important retail applications in artificial intelligence.


With machine learning, AI can mine sales data, market data, seasonal trends, local events, individual customer data, and more to determine what to stock and when to stock it to meet the precise needs of your customers and fluctuating supply and demand. That translates to having the right items in the right quantity at the right time.

Sentiment analysis

AI can search the web for references of your pharmacy and evaluate the comments to determine how people feel about you, whether positive, negative, or neutral. The data can be segmented into various categories—like wait time, item availability, or pricing—so you can focus on improving specific areas that customers may feel negative toward.


The depth of AI analytics makes loyalty programs more effective by enabling an intricate understanding of individual customers—so you have a better idea of what exactly will keep them engaged with and committed to your pharmacy.


Predictive analytics can be disturbingly precise. Even 10 years ago, Target’s machine learning was able to identify women who were pregnant based on their shopping data. The technology can help you segment customers to create more effective promotions—like sending a diaper coupon to an expectant mother.

In-store insights

Cameras powered by AI can analyze traffic patterns in your store to learn how shoppers navigate. What path do people take? Where do they spend the most time? When is the store busiest? The data can be segmented by different criteria, like demographics and seasons. Some of this technology is sophisticated enough to track facial gestures and physical interactions with products, such as picking up an item and putting it back. These insights enable you to optimize your store layout, product placement, and in-store marketing.


With access to the right data, AI can determine the best price for any given item. It can base its recommendation on your priorities, too. Do you want a certain profit margin? Do you want to turn them quickly to prevent spoilage? Do you want volume? Do you want to match the competitor?

Shelf checks

With cameras homed in on the shelving units, AI can prevent many problems that human employees can’t keep a constant eye on—stockouts, label mishaps, and inconsistencies in inventory arrangement.


AI can quickly spot deviances from the norm that could indicate theft. While you might assume that DayQuil is disappearing because it’s winter, AI notices that the demand is irregular even for the season. Its understanding is based on vast amounts of historical and real-time data, so it can be more precise in its awareness.


Self-checkout machines are prevalent at the national chain and big box stores, but AI provides an even more convenient way to check out. In 2016, Amazon introduced its first brick-and-mortar grocery store. The truly groundbreaking feature was that there were no cashiers. Shoppers simply put the items in their bag and walked out. Cameras and sensors automatically recorded the purchases and charged them to a credit card. Though this technology may be out of reach for community pharmacies now, it may become more accessible in the future.

Customer support

Chatbots serve as the first line of response to questions customers might have about logistical or technical issues that don’t need an actual human to resolve, such as how to return a product or even the side effects of medications. In addition to reducing staff workload, chatbots improve the customer experience because they are available 24 hours a day and respond to questions immediately.

From the Magazine

This article was published in our quarterly print magazine, which covers relevant topics in greater depth featuring leading experts in the industry. Subscribe to receive the quarterly print issue in your mailbox. All registered independent pharmacies in the U.S. are eligible to receive a free subscription.

More articles from the December 2021 issue:

A Member-Owned Company Serving Independent Pharmacies

PBA Health is dedicated to helping independent pharmacies reach their full potential on the buy-side of their business. Founded and run by pharmacists, PBA Health serves independent pharmacies with group purchasing services, wholesaler contract negotiations, proprietary purchasing tools, and more.

An HDA member, PBA Health operates its own NABP-accredited warehouse with more than 6,000 SKUs, including brands, generics, narcotics CII-CV, cold-storage products, and over-the-counter (OTC) products — offering the lowest prices in the secondary market.


Editor’s Picks


Elements is written and produced by PBA Health, a buy-side solutions company.

Sign up for a FREE subscription to Elements magazine!


Sign up to receive PBA Health’s e-newsletter to get the latest Elements web articles in your inbox every other week, along with industry news, supply chain insights, and exclusive offers.

Related Articles

Popular Articles