Send results or vitals via the Redox FHIR API

Last updated: Aug 7, 2024
DEVELOPER
HEALTH TECH VENDOR

If you haven’t already, check out these high-level best practices for:

If you'd like to send a generic file to your connection instead, learn how to send a file. Otherwise, you can send results and vitals information with these operations:

This article contains instructions for how to save vitals or diagnostic results with either of these FHIR® operations.

Embed a file

Hypothetically, you may embed a file in any FHIR® resource that contains a FHIR® Attachment datatype. Learn more about FHIR® Attachment.

For results and vitals, you can embed a PDF directly in the DiagnosticReport or Observation resources.

To embed a file, you may send a file less than 10 MB in one writeback message. 

  1. Encode the file as a base64 encoded string.
  2. Use DiagnosticReport$diagnosticreport-create for a collection of results or observations. Or use Observation$observation-create for individual vitals or results.
  3. In the headers:
    • Replace {environmentFlag} with Development, Staging, or Production.
    • Replace {API_TOKEN} with your access token.
    • Replace {destinationSlug} with the human-readable safe name for the intended destination.
  4. Populate the entry.resource.presentedForm fields to include the encoded file: 
  5. Populate the rest of the message as needed, then send to your connection’s EHR system.
  6. To check if the embedded file sent successfully, log in to the Redox dashboard and check the log for the request. The embedded file displays in the log payload.

Upload and reference a file

For larger files, you must first upload them to Redox using the FHIR® Binary resource. Then, you can refer to the file in either the DiagnosticReport or Observation resources.

  1. Locate the file you want to upload.
  2. Upload your file to the Redox upload endpoint using the FHIR® Binary resource.
    • Replace {environmentFlag} with Development, Staging, or Production.
    • Replace {API_TOKEN} with your access token.
    • Keep redox in the slug. That portion routes the request to the appropriate Redox upload endpoint.
      Example: Upload a file to Redox with the Binary resource
      bash
      1
      curl --location
      2
      --request POST 'https://api.redoxengine.com/fhir/R4/redox/{environmentFlag}/Binary' \
      3
      --header 'Authorization: Bearer ${API_TOKEN}' \
      4
      --data-binary 'file.pdf'
  3. If the upload is successful, you receive a 201 Created status. The reference URL is in the location header of the Binary response.
    Example: Binary response with the reference URL
    json
    1
    {
    2
    "location": "https://blob.redoxengine.com/123456789"
    3
    }
  4. Use the correct FHIR® operation for either DiagnosticReport or Observation.
  5. Include the required Attachment fields with the URL reference to the file you already uploaded: 
    • In the url field, enter the URL reference from the Binary response. 
    • In the contentType field, enter a valid MIME typeLearn more about MIME types for files.
    • (Optional) In the title field, enter the name of the file.
  6. Populate the rest of the message as needed, then send to your connection’s EHR system.
  7. To check if the file uploaded successfully, log in to the Redox dashboard and check the log for the request. The uploaded file displays under the Process tab of the log.