OpenMRS – OpenELIS: Required FHIR Resources

OpenMRS – OpenELIS: Required FHIR Resources

Part of the OpenMRS – OpenELIS guide. This page lists the FHIR R4 resources that OpenMRS and OpenELIS exchange through the shared FHIR server, and the fields each side reads. Setup, configuration and troubleshooting are on the parent page. Checked against the OpenELIS source code and the Lab on FHIR 1.5.3 source.

Exchange at a glance

Step

Written by

Resources

Task status after the step

Step

Written by

Resources

Task status after the step

1. Order placed

OpenMRS (Lab on FHIR)

A FHIR transaction Bundle of PUTs that keep the OpenMRS ids: Task, ServiceRequest, Patient, Practitioner, Encounter, Location

requested

2. Order imported

OpenELIS

Reads the Task and the resources it references, copies them to its local FHIR store and creates an electronic order. Writes the new status back to the Task when org.openelisglobal.remote.source.updateStatus=true.

accepted or rejected

3. Results validated

OpenELIS

DiagnosticReport and Observation per test, and the OpenMRS Task with output. Sent by the data export to org.openelisglobal.fhir.subscriber.

completed

4. Results imported

OpenMRS (Lab on FHIR)

Reads the completed Task, its DiagnosticReports and their Observations, and saves the results in the patient's encounter.

unchanged

Order resources (OpenMRS to OpenELIS)

Resource

Key fields

How OpenELIS uses it

Resource

Key fields

How OpenELIS uses it

Task

id = OpenMRS task UUID. identifier with system http://fhir.openmrs.org/ext/task/identifier and the same UUID. status = requested, intent = order. basedOn = the ServiceRequest(s). for = Patient. owner = the lab Practitioner (labonfhir.lisUserUuid). encounter, location, authoredOn. requester is usually not set.

Polls for Tasks with status requested whose owner is listed in org.openelisglobal.remote.source.identifier. Keeps the Task id, so later updates land on the same Task.

ServiceRequest

id = OpenMRS order UUID. code with a coding of system http://loinc.org. subject, requester, encounter. Optional: priority, specimen, identifier.

One per ordered test or panel. The LOINC code is matched to an OpenELIS test, or else to a panel. priority asap and stat are kept, anything else is routine. The first identifier becomes the external order ID. OpenMRS sends none, so this is the ServiceRequest id, which OpenELIS adds as an identifier on import. If the LOINC code matches tests on more than one sample type and there is no Specimen, the order waits for the lab to choose the sample type.

Patient

identifier, name, gender, birthDate, telecom, address.

Reads identifiers by system: http://openelis-global.org/pat_nationalId, http://openelis-global.org/pat_guid, http://openelis-global.org/pat_stNumber, http://openelis-global.org/pat_subjectNumber. The OpenMRS patient UUID is stored as the external ID. Family and given name, gender (male or female), birth date (a partial date is accepted), email, SMS and phone numbers, and address lines are copied to the patient.

Practitioner

Referenced from Task.owner (the lab), Task.requester if set, and ServiceRequest.requester (the ordering clinician).

The Task requester, or else the owner, is created or updated as an OpenELIS provider. The ServiceRequest requesters are copied to the local FHIR store.

Location

Referenced from Task.location (the encounter location). name.

Created as a referring site (organization) with the Location id and name, if no organization has that FHIR id yet.

Encounter

Referenced from Task and ServiceRequest.

Not read by OpenELIS. OpenMRS uses it to attach the results.

Specimen (optional)

Referenced from ServiceRequest.specimen.

Copied with the order when present. Lab on FHIR does not send one.

Result resources (OpenELIS to OpenMRS)

Resource

Key fields

How OpenMRS uses it

Resource

Key fields

How OpenMRS uses it

Task (the OpenMRS Task)

Same id and first identifier as sent by OpenMRS. status = completed once every test of the order is validated. One output per test: type coding http://openelis-global.org/task_output | DiagnosticReport, valueReference = DiagnosticReport/<id>.

Lab on FHIR searches Tasks with the OpenMRS identifier system and the lab owner, and finds its own Task by the value of the first identifier. It then follows each output.

DiagnosticReport

One per test. status: final when validated (also preliminary, partial, registered). code = the test's codings, including its LOINC code. subject, specimen, basedOn, result = the Observations. Identifier http://openelis-global.org/analysisResult_uuid.

Imported only when the first coding of code has the system http://loinc.org. A LOINC code already present on the order's Task is skipped, so a result is not saved twice.

Observation

One per result. status final when validated. code = the test's codings (and the result component's codings, if any). Value: valueQuantity for numeric results (with unit, and comparator such as <), valueCodeableConcept for select-list results, valueString for text results. issued = release date, performer = validator, subject, specimen. Identifier http://openelis-global.org/result_uuid.

Saved as an obs in the order's encounter. The concept is found by its LOINC mapping. A numeric concept accepts only a valueQuantity.

OpenELIS also sends its own order resources, as listed in org.openelisglobal.fhir.subscriber.resources: a Task with the OpenELIS order UUID as id, partOf the OpenMRS Task and identifiers order_uuid and order_accessionNumber; one ServiceRequest per test (the basedOn of the DiagnosticReport and Observations); one Specimen per sample; the Patient; and the Practitioner. Lab on FHIR does not read them.

Task status

Status

Set by

Meaning

Effect in OpenMRS

Status

Set by

Meaning

Effect in OpenMRS

requested

OpenMRS

New order, waiting for the lab.

Order is active.

accepted

OpenELIS

At least one test or panel of the order was recognised.

Order fulfiller status In progress.

rejected

OpenELIS

No LOINC code of the order matched an OpenELIS test or panel.

Order fulfiller status Exception.

completed

OpenELIS

All tests of the order are validated. output lists the DiagnosticReports.

Results imported, order Completed.

cancelled

Not set on this Task by OpenELIS

Order cancelled.

Order fulfiller status Exception.

References