Send a file via Redox Data Model API

If you haven’t already, check out our high-level summary and best practices for sending a file to an integrated system. The details below get into the specific “how-to” but it’s best to have a general idea before getting started. 

Embedding a file

With the Data Model API, you can use the Notes or Results data model to send a file to your integrated system. This depends on the context of the file: 

  • Use the Notes data model if you want to send clinical notes that a provider wrote about a patient or a general file related to the patient (e.g., a consent form signed by the patient or a JPG related to a patient’s chart).

    What to send with a Notes file

    To add a file to a patient's chart with the Notes data model, most EHR systems require that you provide the patient identifier and basic demographic information (e.g., name, date of birth). They may also require relevant provider information like the note type, unique note ID, and whether or not the note has been authenticated by a physician and is authorized to be shared in the patient’s chart.  

    To associate a note with a specific visit or area in the EHR system, you may also need to provide a visit number.

    Another possible alternative

    You can also use the Media data model for sending a general file, but we recommend sticking with the Notes data model.

    Notes can send files as plain or rich text, so the content is subject to the rendering capabilities of each individual EHR system. Notes may also offer superior searchability and usability (if the EHR system has search or natural language processing [NLP] capabilities). Media can typically used for files like PDFs, images, or audio files. For images, though, most EHR systems don't use the Media data model to receive diagnostic quality images, and DICOM files are above the size limits for Media.

  • Use the Results data model if you want to send a file with test results or related to a patient’s labs. 

Each data model has their own supported fields and requirements. Below, we only highlight the fields you need to include for sending files. 

Reference: Data model docs

Learn more about data models we support, including fields, requirements, and details for each one.

With the Notes data model

  1. Encode the file as a base64 encoded string.
  2. Populate the required document fields to include the encoded file in your request: 
    • In the Note.ContentType field, enter Base64 Encoded (as one of the supported values from the valueset).
    • In the Note.FileContents field, insert the base64 encoded string for the file.
    • In the Note.FileName field, enter the name of the file.
    • In the Note.DocumentType field, enter the type of document that should be associated with the file (e.g., consent form, treatment plan).
    • In the Note.DocumentID field, enter the unique identifier for this document.
    • In the Note.Provider.ID field, enter the ID of the provider responsible for the document.
  3. Populate any of the other fields of the request with relevant data. Learn more about the available fields in the Notes data model.

With the Results data model

  1. Encode the file as a base64 encoded string.
  2. Populate the required document fields to include the encoded file in your request: 
    • In the Orders[].Results[].Value field, insert the base64 encoded string for the file.
    • In the Orders[].Results[].ValueType field, enter Encapsulated Data (as one of the supported values from the valueset).
    • In the Orders[].Results[].FileType field, enter a valid file type.
  3. Populate any of the other fields of the request with relevant data. Learn more about the available fields in the Results data model.

With the Media data model

  1. Encode the file as a base64 encoded string.
  2. Populate the required document fields to include the encoded file in your request:
    • In the Media.FileType field, enter a valid file type.
    • In the Media.FileName field, enter the name of the file.
    • In the Media.FileContents field, insert the base64 encoded string for the file
    • In the Media.DocumentType field, enter the type of document that should be associated with the file (e.g., consent form, treatment plan).
    • In the Media.DocumentID field, enter the unique identifier for this document.
    • In the Media.Provider.ID field, enter the ID of the provider responsible for the document
    • In the Media.Availability field, enter the relevant value from the supported valueset (i.e., Available, Unavailable, Obsolete, Deleted, Cancelled).
  3. Populate any of the other fields of the request with relevant data. Learn more about the available fields in the Media data model.

Uploading and referencing a file

For larger files, you must first upload them to Redox. Then, you can refer to the file in your requests.

  1. Locate the file you want to upload.
  2. Send your file to the Redox upload endpoint: 
    You must authenticate the API key as for a typical Data Model API request. Learn how to authenticate and initiate a request
  3. If the upload is successful, you receive a 201 Created status with the URI reference to your file in the body of the response:
  4. Send the uploaded file via the same process for embedding a file. You only need to include the URI from the previous step instead of the base64 encoded file within the request.