1:1 Allergy/Rx should trigger warning

Hello, my name’s Jacob. I saw that “1:1 Allergy/Rx should trigger warning” hasn’t been claimed yet, just want to verify that no one is working on this before I start. A few questions I do have-

It looks like allergies can be coded (UUID) or free-text. I assume the 1:1 match should only work for coded allergies, but what should happen for the free text ones? Maybe it should fuzzy match with a levenshtein distance formula?

Should the warning render in the order basket as you type or just on save?

Any other thoughts/ advice? The documentation in Jira didn’t have a ton of details, so just want to double check. Thanks, I’m excited to be apart of this community!

Here are my thoughts, and I’d love @akanter to chime in.

Let’s use Penicillin as an example. If a patient is allergic to Penicillins, ordering something like Amoxicillin or Ampicillin should warn the clinician - clinically, both drugs are penicillins.

So the real check isn’t drug concept equals allergen concept; it should be: does the ordered drug, or any of its ingredients, belong to the same drug class as the recorded allergen? This is still a deterministic UUID equality check — no fuzzy matching needed, just done against a set of related concepts rather than one.

For the amoxicillin/penicillin case, possibly we could have an inline warning on the order line in the basket, with something like: “Patient has a Severe allergy to Penicillins (reaction: Hepatotoxicity). Amoxicillin contains a penicillin.” It should appear as soon as the drug is added to the basket, not only on save.

One important caveat on the example I just gave: the set members for the Penicillins concept (CIEL 162297), and I believe for the others as well, don’t actually exist on dev3 currently - I added those manually for illustration. So, for the matcher to actually catch the Amoxicillin/Penicillins case, that set membership needs to be populated somewhere - either upstream in CIEL or via the refapp’s Initializer CSVs.

1 Like

I think it would be better to think about this as both an ingredient and a class allergy. Sometimes class is important, and sometimes the allergy is to a particular ingredient (although the warning probably needs to be both). Although I think we started this with using convenience sets to manage relationships between class and drug, this is not sustainable and leads to medical-legal problems is the knowledgebase is not kept up to date. It would be better to base this on reference maps. I believe that Bahmni did this using SNOMED, or it can be done with RxNORM and class relationships. It would require beefing up the back-end of OpenMRS to use the concept_reference_term_map table.

1 Like

The point of this ticket, though, was to avoid precisely these sort of issues and focus on something that would at least warn when the drug concept and allergen exactly match. It’s not sufficient as an allergy warning system, but it would be a start.

What do you have in mind here?

Thanks for the input @veronica and @akanter . I’ve been playing around with this and sketched it out as a CDS-Hooks service that bridges allergens to drugs through SNOMED’s Causative agent and Has active ingredient relationships, https://github.com/jajjer/openmrs-module-cdshooks. Let me know your thoughts.

Are you testing with existing CIEL data? We typically map to both SNOMED and RxNORM from the drugs. We use the more specific SNOMED code for product containing ONLY the ingredient(s) as opposed to parent term drug-containing product (unless there is no specific child map). Getting from the drugs to the classes is where I think we need clarity. There is an RxClass relationship between the NUI and the RxNORM CUI. These could be loaded into the concept_reference_term_map table which is intended to capture hierarchies and other relationships between reference codes. We would then have to have a service which can use that knowledge to provide the parent-child links. I don’t remember how Bahmni uses SNOMED, but you can use the SNOMED model as Jacob says getting from findings to drugs… but I think most people are expecting to use the drug allergen list and not necessarily findings/conditions… but to be complete that would be a good long term goal.