# Ingesting FHIR orders with sample collection appointment date/time for phlebotomy workflow

**URL:** <https://talk.openelis-global.org/t/ingesting-fhir-orders-with-sample-collection-appointment-date-time-for-phlebotomy-workflow/2405>\
**Category:** Integration\
**Created:** [September 1, 2026, 5:58am UTC](https://talk.openelis-global.org/t/ingesting-fhir-orders-with-sample-collection-appointment-date-time-for-phlebotomy-workflow/2405 "2026-09-01T05:58:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhupesh\_Gupta](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/bhupesh_gupta/32/1273_2.png) [@Bhupesh\_Gupta](https://talk.openelis-global.org/u/Bhupesh_Gupta)\
**Post date:** [September 1, 2026, 5:58am UTC](https://talk.openelis-global.org/t/ingesting-fhir-orders-with-sample-collection-appointment-date-time-for-phlebotomy-workflow/2405/1 "2026-09-01T05:58:18Z")

</div>

We are using FHIR to send test orders placed in our EMR over to OpenELIS. We have a workflow where clinicians schedule sample collection appointments, and we would like phlebotomists to manage sample collection directly in OpenELIS.

However, we haven’t found a way to ingest external test orders in an `AwaitingSpecimen` status alongside a scheduled sample collection appointment timestamp. Our goal is for phlebotomists to see incoming external orders sorted by appointment date and time to organize their sample collections efficiently.

We need to create orders with an `AwaitingSpecimen` status that include a sample collection appointment date/time. Because the FHIR `Appointment` resource is not supported in the OpenELIS FHIR configuration, how can we pass collection schedule details with external orders so phlebotomists can view them sorted by appointment time?

---

<div class="post-metadata">

**Author:** ![Agaba\_Derrick\_Junior](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/agaba_derrick_junior/32/503_2.png) [@Agaba\_Derrick\_Junior](https://talk.openelis-global.org/u/Agaba_Derrick_Junior)\
**Post date:** [September 7, 2026, 8:24pm UTC](https://talk.openelis-global.org/t/ingesting-fhir-orders-with-sample-collection-appointment-date-time-for-phlebotomy-workflow/2405/2 "2026-09-07T20:24:30Z")

</div>

Hi [@Bhupesh\_Gupta](https://talk.openelis-global.org/u/bhupesh_gupta),

This is a great use case, but unfortunately this workflow isn’t natively supported out of the box in the current OpenELIS FHIR configuration.

Here’s a breakdown of why, based on the current FHIR ingestion logic:

1. **How `AwaitingSpecimen` is triggered:** OpenELIS places an external order into the `AwaitingSpecimen` queue specifically when a `ServiceRequest` is received _without_ a `Specimen` resource (and the LOINC code is specimen-ambiguous). If a `Specimen` resource is included, OpenELIS assumes the sample type is resolved and queues the order normally as `Entered`.
2. **The catch-22 for collection dates:** OpenELIS currently only extracts collection dates from `Specimen.collection.collectedDateTime`. But since an order must _omit_ the `Specimen` resource to trigger `AwaitingSpecimen`, there’s no `Specimen` object to extract a date from.
3. **Ignored FHIR fields:** The OpenELIS FHIR ingestion engine currently doesn’t parse `ServiceRequest.occurrenceDateTime` or `Task.executionPeriod` which would otherwise be the standard FHIR fields for scheduled service times.

**How to achieve this goal**

Supporting your phlebotomy workflow would require a code change to the OpenELIS FHIR processing layer.

- **Option A: Parse `ServiceRequest.occurrenceDateTime` (Recommended)** Update the ingestion logic in `TaskInterpreterImpl.java` to extract `ServiceRequest.occurrenceDateTime` (or `occurrencePeriod.start`) when processing an order. If the order is flagged as `AwaitingSpecimen`, this timestamp could be mapped to a scheduled date field or `Sample.collectionDate` for display and sorting in the phlebotomy queue.
- **Option B: Support “proposed” specimens** Update the FHIR parser so that if a `ServiceRequest` includes a `Specimen` resource with status `unavailable` (or a custom extension indicating a “proposed/scheduled” collection), OpenELIS still queues the order as `AwaitingSpecimen` while extracting `Specimen.collection.collectedDateTime` to use as the appointment time.

Until one of these FHIR mapping enhancements is implemented in the core codebase, there isn’t a way to pass an appointment time for an `AwaitingSpecimen` order using the existing FHIR API.

CC: @caseyi @Moses_Mutesasira

---

<div class="post-metadata">

**Author:** ![Bhupesh\_Gupta](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/bhupesh_gupta/32/1273_2.png) [@Bhupesh\_Gupta](https://talk.openelis-global.org/u/Bhupesh_Gupta)\
**Post date:** [September 18, 2026, 8:11am UTC](https://talk.openelis-global.org/t/ingesting-fhir-orders-with-sample-collection-appointment-date-time-for-phlebotomy-workflow/2405/3 "2026-09-18T08:11:11Z")

</div>

We’ve decided to manage appointment scheduling for sample pickup in our EMR, while the actual sample processing happens in OpenELIS. The flow looks like this:

- Clinician places a test order in the EMR.

- The EMR creates a corresponding test order in OpenELIS and generates an accession number.

- During collection, the phlebotomist generates the barcode in the EMR (with barcode creation handled in OpenELIS via the EMR–OpenELIS integration).

- The phlebotomist collects the sample and marks it as _Sample Collected_ in the EMR.

- The sample is then sent to the Lab Unit, where the Lab Receptionist marks it as _Received_. From there, the rest of the lab workflow continues.
