Mapping Drugs to FHIR Medications

Continuing on this thread here:

Currently, in the PIH EMR, we have a drug list, but do not utilize the drug ingredient table nor the dosage form and dosage strength fields on drug. For instacce, we have the following four drug formlaries in our drug table for different types of “Aciclovir”:

mysql> mysql> select uuid, name, concept_id, strength,dosage_form from drug where name like 'Aciclovir%';
+--------------------------------------+---------------------------------------------------------+------------+----------+-------------+
| uuid                                 | name                                                    | concept_id | strength | dosage_form |
+--------------------------------------+---------------------------------------------------------+------------+----------+-------------+
| 0962492b-295e-4f61-8d7b-717a61f43997 | Aciclovir, 200mg tablet                                 |       3678 | NULL     |        NULL |
| f1403640-6911-4758-bbdb-183329c65708 | Aciclovir, Eye ointment, 3%, 4.5 gram tube              |       3678 | NULL     |        NULL |
| 78fb8eaa-dfbe-11e9-8a34-2a2ae2dbcce4 | Aciclovir, Powder for solution for infusion, 500mg vial |       3678 | NULL     |        NULL |
| af8c4162-dfbe-11e9-8a34-2a2ae2dbcce4 | Aciclovir, Powder for solution for infusion, 250mg vial |       3678 | NULL     |        NULL |
+--------------------------------------+---------------------------------------------------------+------------+----------+-------------+
4 rows in set (0.00 sec)

The only thing that distinguishes them is “name”… note that dosage_form and strength are empty, and we don’t use drug_ingredients. Then accessing these drugs via FHIR they all basically return identical information, for example:

{
    "resourceType": "Medication",
    "id": "0962492b-295e-4f61-8d7b-717a61f43997",
    "meta": {
        "lastUpdated": "2021-05-24T09:51:20.000-04:00"
    },
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"hapiPropertyTable\"><tbody><tr><td>Id:</td><td>0962492b-295e-4f61-8d7b-717a61f43997</td></tr><tr><td>Code:</td><td> Acyclovir </td></tr><tr><td>Status:</td><td>ACTIVE</td></tr></tbody></table></div>"
    },
    "code": {
        "coding": [
      
                "code": "3cd3d4de-26fe-102b-80cb-0017a47871b2",
                "display": "Acyclovir"
            }
        ]
    },
    "status": "active"
}

and

{
    "resourceType": "Medication",
    "id": "f1403640-6911-4758-bbdb-183329c65708",
    "meta": {
        "lastUpdated": "2021-05-24T09:51:20.000-04:00"
    },
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"hapiPropertyTable\"><tbody><tr><td>Id:</td><td>f1403640-6911-4758-bbdb-183329c65708</td></tr><tr><td>Code:</td><td> Acyclovir </td></tr><tr><td>Status:</td><td>ACTIVE</td></tr></tbody></table></div>"
    },
    "code": {
        "coding": [
            {
                "code": "3cd3d4de-26fe-102b-80cb-0017a47871b2",
                "display": "Acyclovir"
            }
        ]
    },
    "status": "active"
}

Ideally, we’d like to get to a point where we populate all these fields, but, in the meanwhile, while we work toward that, is there a proper place to but the full drug display name in the FHIR resource? We were thinking of the “text” field, but it looks like it has a specific use case. There doesn’t seem to be any “display” field on Medication.

Thoughts on pursuing @ibacher 's suggest from the other thread:

Thoughts @ibacher @mksd @mksrom @burke ?

fyi @mseaton

Take care, Mark

Yeah, don’t use the text field. It’s part of the base FHIR resource model and is meant to contain a FHIR Narrative (basically an xhtml fragment that represents a “human-readable” version of the resource), so placing any computer-processable data there would be wrong.

The suggestion I was thinking of would be to have something like this:

{
    "resourceType": "Medication",
    "code": {
        "text": "Aciclovir, 200mg tablet" <--- This is a completely different field also named "text"
    },
    // ...
}

Actually, though, the more I think about it, the less I like this. However, if this is how most people’s drug tables look, then I suppose this is the “best” option. The other alternative would be to attach this as an OpenMRS-specific extension, e.g.,

{
    "resourceType": "Medication",
    "extension": {
        "url": "http://fhir.openmrs.org/ext/DrugName"
        "valueString": "Aciclovir, 200mg tablet"
    },
    // ...
}

This is probably cleaner than my first suggestion, since it guarantees that no existing FHIR client will do the wrong thing with the data.

The real problem here is determining how we should display things, since this has a real impact on, e.g., how we build both the order and dispensing apps, so I think the key point is to have some agreement (as a community) on how we expect drugs to be modelled and if it’s like this, then we can look into one of these two options.

That said, I feel that modelling drugs this way is likely to come back to bite us…

The fact is, all drugs are configured with names in OpenMRS. They may also have coded dosage forms, strengths, and a well-defined ingredient list, and one could presumably ignore “name” and just present “concept” + strength + form, but I do think we want to be in a position to use “name” if and where appropriate, or if these additional fields are not populated on the drug table. I’m surprised that FHIR doesn’t have a property on all resources for “displayName” or something, similar to what we have in our REST API. I had hoped this is what “text” could be on the top level. Is this really supposed to be xhtml content?

Yeah. It has a very specific purpose and history. HL7 has been dealing for years with the complaint that the messages aren’t human-readable. The text property on FHIR DomainResources exists to address this by having a human-readable version of the whole resource. That’s really the only purpose of that field.

We are specifically adding this functionality so that we can build the dispensing app, so, yeah, we should really come to a consensus around this as soon as possible.

It seems possible that FHIR is intentionally opinionated about wanting drug formularies represented in a coded format, and not just as a name?

@mseaton since @ibacher has written a custom extension for supporting the dose strength field, we should be able to support this with just the dosage_form and dosage strength field, but that does come back to what we were discussion this morning about bringing in the pharmacy team to determine what the correct “dosage_forms” are for all our drugs.

The Medication resources are developed by HL7’s Pharmacy group who are quite concerned about ensuring that all medication data exchanged are done so (by default) in a structured way for patient safety reasons. Basically, having structured data makes automated medication checks possible :grin:.

Make sense… @ibacher what would you think of supporting a OpenMRS-specific extension like “DrugName” as you describe above, with the thought that any tools we build should also support the coded dose form and strength if present?

Seems like a pragmatic compromise.

When we talked about adding a drug_reference_map link we could attach the drug RxNORM code to its ingredient and its coded strength and form. I think the UK break down as to prescribable versus dispensable drug documentation is quite interesting and I hope we’d be able to transform one into the other… What do you think about leveraging RxNORM and potentially a CIEL extension (for non US drugs) to manage some of these conversions?

I think that would be quite nice to have!

Since I rarely work with the latest data model (hopefully, soon that will be remedied), I currently don’t believe it supports drug_reference_term_map between the drug table and a reference term (RxNORM). We currently do provide IN and PIN RxNORM maps to concept in the concept_reference_term_map table. If we had the drug_reference_term_map, and I mapped the drugs to the SCD or BCD RxNORM codes, then you’d be able to derive dose form, but still would not be able to get strength or strength units. I’d be willing to consider providing more detailed parsing in CIEL, but this would put a burden on implementations since I can’t do every drug and formulation.

I just realized the other day that OpenMRS does have a DrugReferenceMap object and drug_reference_map table that allows one to link a Drug to a Concept Reference Term + Type (eg. SAME-AS RxNorm XYZ). It seems this has been in the data model since OpenMRS 1.10 (added in 2013). I’m not sure how I missed that development…

Do other groups actively use this feature?

Mike

Wow, that’s awesome. I’d have to figure out how I’d maintain and map those rows, but first step might be to expand OCL to handle the drug table. If we did create a specific source for drugs (as opposed to concepts) then I can map them to RxNORM and we’d just need a way to export those tables. For now, though, I don’t see a direct reason to have those RxNORM codes.