Drug mapped to concept source not returning code in FHIR request

Reference Application v2.12.2

Question: Hello, everyone. I am new to using OpenMRS and I am developing CDS for OpenMRS using FHIR R4 and CQL rules. One of the rules requires a drug: metformin.

Here are my steps: I added a concept for metformin in OpenMRS and mapped it to RxNorm Code 6809 using OpenMRS admin Ui.

However, when I request the drug with the FHIR endpoint (GET http://localhost:8081/openmrs-standalone/ws/fhir2/R4/Medication/{metformin id}), I do not get the RxNorm code for metformin. Instead, I get the internal code for metformin (see below).

Results from calling GET http://localhost:8081/openmrs-standalone/ws/fhir2/R4/Medication/ef21e81f-58b4-4229-a7bf-3dea06200b45

{
  "resourceType": "Medication",
  "id": "ef21e81f-58b4-4229-a7bf-3dea06200b45",
  "meta": {
    "versionId": "1696646761000",
    "lastUpdated": "2023-10-06T22:46:01.000-04:00"
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"hapiPropertyTable\"><tbody><tr><td>Id:</td><td>ef21e81f-58b4-4229-a7bf-3dea06200b45</td></tr><tr><td>Code:</td><td>Metformin</td></tr><tr><td>Status:</td><td>ACTIVE</td></tr></tbody></table></div>"
  },
  "extension": [
    {
      "url": "http://fhir.openmrs.org/ext/medicine",
      "extension": [
        {
          "url": "http://fhir.openmrs.org/ext/medicine#drugName",
          "valueString": "Metformin"
        }
      ]
    }
  ],
  "code": {
    "coding": [
      {
        "code": "43d37f2e-f98b-4017-b667-05fe720485ee",
        "display": "Metformin"
      }
    ],
    "text": "Metformin"
  },
  "status": "active"
}

Unless I am misunderstanding something, this should return the RxNorm code for metformin in the code.coding part of the FHIR resource. However, it is not. Is this the correct behavior?

In the fhir_concept_source database table, add a row for RxNorm.

Here is an example of an an entry for another source called ANCDAK: https://github.com/openmrs/openmrs-module-cql/blob/main/api/src/test/resources/org/openmrs/module/cql/ANCDT17.xml#L41

1 Like

I would strongly recommend using Initializer over Liquibase changes for this for production deployments.

And of course, the CIEL concept dictionary contains all the drug concepts (including non-US drugs) mapped to RxNORM and SNOMED which can be used by Open Concept Lab (OCL) to manage OpenMRS concept dictionaries…https://app.openconceptlab.org/#/orgs/CIEL/sources/CIEL

Thank you all for your suggestions. I followed @dkayiwa suggestion and it solved my problem.