Skip to main content

Integrating LabXpert Automation with FHIR-based Systems (beta)

LabXpert Automation can integrate with any clinical system that supports the HL7® FHIR® standard. This allows lab results and test orders to be exchanged with electronic medical records (EMRs), national health registries, or other FHIR-compliant platforms.

This guide outlines how to connect Automation to a FHIR server, map resources, and handle basic workflows.

🔗 Supported FHIR Resources

ResourcePurpose
PatientUsed to match or create lab patients
ServiceRequestRepresents incoming test requests
ObservationTransmits individual lab results
DiagnosticReportSummary document referencing observations

🌐 Setting Up the Integration

To begin, go to the Systems section in Automation and click ➕ Add.

  1. Select: FHIR-Compatible System
  2. Enter Base URL: e.g., https://fhir.myemr.org/fhir
  3. Authentication: Provide Bearer token, basic auth, or client credentials (depending on server configuration)
  4. Test Connection: Confirm that Automation can reach the /metadata endpoint

✅ A successful ping to /metadata confirms a valid FHIR server.

🧩 Resource Mapping

Before Automation can send or retrieve data, resource mapping must be configured:

Patient Matching

  • Automation Source: Patient name, ID, sex, DOB
  • FHIR Matching: Uses /Patient?identifier=... or /Patient?name=...&birthdate=...

If no match is found, Automation can optionally create a Patient resource using the supplied data.

Order Retrieval (ServiceRequest)

  • Automation periodically queries:

    GET /ServiceRequest?status=active&performer=AutomationOrg
  • Mapped fields:

    • subject → Patient
    • code → test type or panel
    • identifier → internal request ID

Sending Results (Observation + DiagnosticReport)

After a test completes:

  1. Create Observations for each result:

    {
    "resourceType": "Observation",
    "status": "final",
    "code": { "coding": [{ "system": "http://loinc.org", "code": "718-7", "display": "Hemoglobin" }] },
    "valueQuantity": { "value": 13.5, "unit": "g/dL" },
    "subject": { "reference": "Patient/123" },
    "effectiveDateTime": "2024-01-02T12:00:00Z"
    }
  2. Bundle Observations into a DiagnosticReport:

    {
    "resourceType": "DiagnosticReport",
    "status": "final",
    "subject": { "reference": "Patient/123" },
    "result": [
    { "reference": "Observation/ob1" },
    { "reference": "Observation/ob2" }
    ],
    "code": { "text": "CBC Panel" }
    }
  3. POST to:

    POST /DiagnosticReport

🔐 Security & Authentication

Automation supports:

  • Bearer Tokens (preferred)
  • Basic Auth
  • Mutual TLS (on request)

For systems using OAuth2, you must obtain a token externally and configure it under the system settings.

🧪 Testing the Integration

To test the FHIR setup:

  • Use sample patients and requests in the FHIR server
  • Run a simulated test in Automation and verify that:
    • Observations are created
    • DiagnosticReport is submitted
    • The order status can be updated (e.g., from active to completed)

✅ Best Practices

  • Prefer LOINC codes for lab tests
  • Ensure timezone consistency (UTC preferred)
  • Configure retry logic for network outages
  • Regularly validate FHIR responses for changes in server behavior

🛠️ Custom Mappings & Extensions

You may define custom extensions if needed. For example, to link to a lab sample barcode:

{
"resourceType": "Observation",
"extension": [{
"url": "http://labxpert.com/fhir/StructureDefinition/sample-id",
"valueString": "SMP-000123"
}]
}

Contact support for help registering or validating custom extensions.