Fhir put Service Request

I am trying to directly put the Service Request on openELIS 3.2.0 for adding incoming orders. But i am unable to post the requst from postman. I’m getting 500 error.

2025-03-12T08:44:26.672+0300 – WARN – Class: ModuleAuthenticationInterceptor, Method: hasPermissionForUrl(), Warning:This page has no modules assigned to it
2025-03-12T08:44:26.672+0300 – WARN – Class: UserModuleServiceImpl, Method: getUserLogin, Warning:security context is not of type Secu rityContext
2025-03-12T08:44:26.675+0300 – ERROR – Class: org.openelisglobal.login.daoimpl.UserModuleServiceImpl, Method: getUserLogin, Line: 173, Message: Cannot invoke "org.springframework.security.core.context.SecurityContext.getAuthentication()" because "sc" is null

1 Like

Currently OpenELIS does accept FHIR requests directly, we are in the pipeline of adding a FHIR facade layer. Currently all FHIR exchange is done through the co-resdend FHIR server that runs in paralle to OpenELIS

3 Likes

How does FHIR exchange work? I tried creating a new Patient resource in the co-resident FHIR server but OpenELIS doesn’t seem to be picking it up. I see in the settings (under Admin → Application Properties) that the

fhir.subscriber.resources key is set to

“Task,Patient,ServiceRequest,DiagnosticReport,Observation,Specimen,Practitioner,Encounter”

which suggests to me that OpenELIS should be pulling Patient resources from the FHIR server. Am I misreading this, and if so, is the intended flow documented somewhere?

Thanks!

edit: this is using the Docker setup from GitHub - DIGI-UW/openelis-docker: Docker Compose setup for OpenELIS-Global2 slightly modified so I have access to the FHIR server.

1 Like

Hello @TimM ,
Currently OpenELIS only supports a FHIR based EMR-LIS workflow through the co-resdent FHIR sever.
We are in the process of adding a FHIR facadde so that it can directly accept FHIR data ,outside the Lab workflow

3 Likes

Hi @Moses_Mutesasira,

Thank you for clarifying!

I’ve been trying to follow the linked workflow and not having much success (I also tried to get the iSantePlus docker image running to prove out the already-tested case, but it seems to have succumbed to bit rot in several places).

I’m PUT-ing the following objects to the co-resident FHIR server:

ServiceRequest (adapted from Lab Integration Workflow example):

{
  "resourceType": "ServiceRequest",
  "id": "7712ceec-ce9d-4bdb-bb89-ac6d7a7913fe",
  "status": "active",
  "intent": "order",
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "14682-9"
      }
    ]
  },
  "subject": {
    "reference": "Patient/bcc2e58e-29c1-4870-92cd-de5bb4b598c0",
    "type": "Patient"
  }
}

Task (adapted from Lab Integration Workflow example):

{
  "resourceType": "Task",
  "id": "42c542cb-bdc4-4e92-9b62-7dc574e6872c",
  "identifier": [
    {
      "system": "http://isanteplus.org/ext/task/identifier",
      "value": "42c542cb-bdc4-4e92-9b62-7dc574e6872c"
    }
  ],
  "basedOn": [
    {
      "reference": "ServiceRequest/7712ceec-ce9d-4bdb-bb89-ac6d7a7913fe",
      "type": "ServiceRequest"
    }
  ],
  "status": "requested",
  "intent": "order",
  "for": {
    "reference": "Patient/bcc2e58e-29c1-4870-92cd-de5bb4b598c0",
    "type": "Patient"
  },
  "owner": {
    "reference": "Practitioner/f9badd80-ab76-11e2-9e96-0800200c9a66",
    "type": "Practitioner"
  }
}

Practitioner (pulled from fhir.org examples):

{
  "resourceType": "Practitioner",
  "id": "f9badd80-ab76-11e2-9e96-0800200c9a66",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2025-05-19T14:56:08.196-04:00",
    "source": "#7RTTafhHuvO7OdL1"
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n      <p>Dr Adam Careful is a Referring Practitioner for Acme Hospital from 1-Jan 2012 to 31-Mar\n        2012</p>\n    </div>"
  },
  "identifier": [ {
    "system": "http://www.acme.org/practitioners",
    "value": "23"
  } ],
  "active": true,
  "name": [ {
    "family": "Careful",
    "given": [ "Adam" ],
    "prefix": [ "Dr" ]
  } ],
  "address": [ {
    "use": "home",
    "line": [ "534 Erewhon St" ],
    "city": "PleasantVille",
    "state": "Vic",
    "postalCode": "3999"
  } ],
  "qualification": [ {
    "identifier": [ {
      "system": "http://example.org/UniversityIdentifier",
      "value": "12345"
    } ],
    "code": {
      "coding": [ {
        "system": "http://terminology.hl7.org/CodeSystem/v2-0360/2.7",
        "code": "BS",
        "display": "Bachelor of Science"
      } ],
      "text": "Bachelor of Science"
    },
    "period": {
      "start": "1995"
    },
    "issuer": {
      "display": "Example University"
    }
  } ]
}

“Patient/bcc2e58e-29c1-4870-92cd-de5bb4b598c0” is a reference to a patient I manually created in the OpenELIS system.

Here are the relevant settings from Admin → Application Properties (as described here):

I’ve made sure that there is a test with the corresponding LOINC code, and that the “external orders” setting is set to “true”.

After all of that, nothing shows up in the Electronic Orders section of the OpenELIS UI.

Any insight as to what I might be doing wrong?

Thanks!

For OpenELIS to pull the orders, you need to set the property org.openelisglobal.remote.source.uri (in the properties file) to point to the fhir server where the orders reside. This could be the same co-resdent FHIR server or another FHIR server ie here

For testing purposes , here is complete docker setup for OpenMRS-3 AND OpenMELIS-3 Lab workflow you can run out of the box

1 Like

Oh i can see you seem to have the right properties in your ADMIN page ,
did you set those from the properties file or directly from the UI ??
For some reason Spring doesnt correctly pick up the changes set from the UI. you need to set them directly in the properties file and restart the webapp

1 Like

This was it. After setting the properties directly in common.properties and restarting, it works.

Thank you!