FHIR R4 handler for claims and insurance

Hi @dkayiwa @ibacher I’m trying to consume and make the fhir r4 bundles of claims and insurance available at NDHM.IN\NHCX Profiles - FHIR v4.0.1 . Is the fhir2 module capable of doing that?

The FHIR2 module translates OpenMRS concepts into FHIR and vice-versa. There are no standardised model for storing the data in those insurance resource in the OpenMRS data model, so there is no pre-built functionality that will do that. However, the FHIR2 module is extensible, so if you define how to store those FHIR resources in an OpenMRS-like data model, you should be able to add those capabilities to the FHIR2 module via a separate module.

1 Like

Hi @ibacher Thank you for the information.

However, the module GitHub - openmrs/openmrs-module-insuranceclaims: For checking patient insurance enrolment on registration (in external Insurance Management Information System) status and submitting claims (managing patient billing), I’m trying to use this for the claims but it supports only dstu3. Is there any other module available for the fhir R4 versions or can it be changed to support R4?

It could be update to support both DSTU3 and R4; there’s no reason that it can only support one module. However, that module is designed to work the the old FHIR module and is likely not compatible with FHIR2 at least without further modifications.

Hi @ibacher ,

I’ve been trying to modify the insurance claims module for my requirements. There is a function - BaseOpenMRSDataUtil.readBaseExtensionFields(BaseOpenmrsData openmrsData, DomainResource fhirResource);

It is available in fhir module and used to initialise base openmrs data in the object. Is there a similar function available in fhir2 module which I can use?

No. In general, in FHIR2, we haven’t yet found a need to communicate the properties that that writes in general and where we have (e.g., for observations), we map them to appropriate fields in the standard FHIR data model, that is, we don’t use those extensions in FHIR2 at all, so there’s no method to create them.

There is a utility method to help populate the meta.lastUpdated property for each resource which we use like this: https://github.com/openmrs/openmrs-module-fhir2/blob/f3f33567f9da236d6738b347c7176516bb8631c5/api/src/main/java/org/openmrs/module/fhir2/api/translators/impl/MedicationRequestTranslatorImpl.java#L124C1-L125C69

Hi @ibacher , Thank you for the above information.

I’m currently stuck at the updation of openmrs fhir to fhir2 module in openmrs-module-insuranceclaims at the FHIRRequestClient file. I’ve tried to update every other file and did it successfully. However, while trying to update FHIRRequestClient.java (https://github.com/openmrs/openmrs-module-insuranceclaims/blob/master/api/src/main/java/org/openmrs/module/insuranceclaims/api/client/impl/FhirRequestClient.java) , I’m not able to get a replacement of these classes in fhir2 -

import org.openmrs.module.fhir.api.client.ClientHttpEntity;
import org.openmrs.module.fhir.api.client.ClientHttpRequestInterceptor;
import org.openmrs.module.fhir.api.helper.ClientHelper;
import org.openmrs.module.fhir.api.helper.FHIRClientHelper;

I can see the importance of this as it is used to handle the post and get requests from the module. Cna you please help me in making this file compatible with fhir2 module and r4?

We don’t have a precise equivalent to that, but the FHIR2 module does provide a FhirClientService (injectable via Spring), which provides a way to use HAPI’s GenericClient API with the same FHIR context we have configured in the module.

This probably requires some light re-writing, but you can then use:

IGenericClient client = fhirClientService.getClientForR4(<base url>);

And then replace getObject() with something like:

public <T extends IBaseResource> T getObject(String id, Class<T> objectClass)  {
    return client.read().resource(objectClass).withId(id);

You’d likely need to use an Interceptor for authentication.

Hi @ibacher ,

Thank you for the information.

I tried to convert the module to R4 and did these changes GitHub - chughrahul/openmrs-module-insuranceclaims-R4 . With the insights provided by you, I was able to resolve most of the errors I was facing. However, I’m still getting one or two errors while building it, which I’m trying to resolve. I request you to have a look at this and suggest any further changes required for better compatibility. I hope the changes will help the integrators for insurance-claims R4 implementation in near future.