https://www.healthit.gov/test-method/drug-drug-drug-allergy-...
The problem is that the patient's chart may be erroneous or incomplete. So the system can only detect harmful interactions on entries that are fully populated with RxNorm (or NDC) concept codes. Human doctors are expected to manually reconcile the medication list before writing a new prescription. But sometimes they skip that step, or patients don't even remember what other drugs they're taking. In some cases it's possible to query the patient's current medication list from a service like Surescripts but even that won't necessarily be complete and some level of manual reconciliation is still needed.
The other issue with drug interaction warnings is alert fatigue. For certain drugs there are a lot of known interactions, but those are considered minor acceptable risks due to lack of a better alternative. So clinicians get into a habit of ignoring all warnings and miss the ones that are actually serious. From a UX perspective there's no good way to solve this problem in a way that satisfies both the clinicians and the lawyers.