> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Lab Results

> Event payload details and trigger documentation for Lab Results data from Butterfly Labs

<img src="https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/butterfly_labs.svg?fit=max&auto=format&n=EU2WCxuXGIUQcziR&q=85&s=d8df90f1ab43f8a78a7ae6a4446e8923" alt="images/butterfly_labs.svg" width="40" height="40" data-path="images/butterfly_labs.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Lab Results event payload from Butterfly Labs.

* `Butterfly Labs Lab Order Results Update`

<RequestExample>
  ```json Example theme={null}
  {
    "order_definition_code": "BFLY-21H1XI",
    "order_id": "ord_dV7RMiCP1Paz0NyxHFWrpF",
    "patient_id": "pt_G2d42kA1JrNppciYEE",
    "report_generated_date": "2023-06-09T14:08:00+00:00",
    "results": [
      {
        "lab_comments": "Prediabetes: 5.7 - 6.4\nDiabetes: >6.4",
        "name": "AST (SGOT)",
        "range": null,
        "reference_range_high": null,
        "reference_range_low": null,
        "result_interpretation": "High",
        "unit": "IU/L",
        "value": null
      }
    ]
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "order_definition_code": "Code identifying the type of lab order",
    "order_id": "ID of the order these results belong to",
    "patient_id": "ID of the patient these results are for",
    "report_generated_date": "When these lab results were generated",
    "results": {
      "lab_comments": "Additional comments from the lab about this result",
      "name": "Name of the test result",
      "range": "The range of the test result (in the given units)",
      "reference_range_high": "High end of the reference range for this test (in the given units)",
      "reference_range_low": "Low end of the reference range for this test (in the given units)",
      "result_interpretation": "Interpretation of the result (e.g., High, Low, Ok)",
      "unit": "Unit of measurement for the result",
      "value": "The value of the test result (in the given units)"
    }
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Lab Results" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="order_id" type="string" required>
      ID of the order these results belong to

      ```json CEL theme={null}
      order_id
      ```

      ```json Example theme={null}
      "ord_dV7RMiCP1Paz0NyxHFWrpF"
      ```
    </ResponseField>

    <ResponseField name="patient_id" type="string" required>
      ID of the patient these results are for

      ```json CEL theme={null}
      patient_id
      ```

      ```json Example theme={null}
      "pt_G2d42kA1JrNppciYEE"
      ```
    </ResponseField>

    <ResponseField name="order_definition_code" type="string" required>
      Code identifying the type of lab order

      ```json CEL theme={null}
      order_definition_code
      ```

      ```json Example theme={null}
      "BFLY-21H1XI"
      ```
    </ResponseField>

    <ResponseField name="report_generated_date" type="timing.v1.Timestamp" required>
      When these lab results were generated

      ```json CEL theme={null}
      report_generated_date
      ```

      ```json Example theme={null}
      "2023-06-09T14:08:00+00:00"
      ```
    </ResponseField>

    <ResponseField name="results" type="[]object" required>
      *Description coming soon*

      ```json CEL theme={null}
      results
      ```

      ```json Example theme={null}
      [
      {
      "lab_comments": "Prediabetes: 5.7 - 6.4\nDiabetes: >6.4",
      "name": "AST (SGOT)",
      "range": null,
      "reference_range_high": null,
      "reference_range_low": null,
      "result_interpretation": "High",
      "unit": "IU/L",
      "value": null
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.name)" type="[]string" required>
      Mapped array of: Name of the test result

      ```json CEL theme={null}
      results.map(x, x.name)
      ```

      ```json Example theme={null}
      [
      "AST (SGOT)"
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.range)" type="[]any" required>
      Mapped array of: The range of the test result (in the given units)

      ```json CEL theme={null}
      results.map(x, x.range)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.value)" type="[]any" required>
      Mapped array of: The value of the test result (in the given units)

      ```json CEL theme={null}
      results.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.unit)" type="[]string" required>
      Mapped array of: Unit of measurement for the result

      ```json CEL theme={null}
      results.map(x, x.unit)
      ```

      ```json Example theme={null}
      [
      "IU/L"
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.lab_comments)" type="[]string" required>
      Mapped array of: Additional comments from the lab about this result

      ```json CEL theme={null}
      results.map(x, x.lab_comments)
      ```

      ```json Example theme={null}
      [
      "Prediabetes: 5.7 - 6.4\nDiabetes: >6.4"
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.result_interpretation)" type="[]string" required>
      Mapped array of: Interpretation of the result (e.g., High, Low, Ok)

      ```json CEL theme={null}
      results.map(x, x.result_interpretation)
      ```

      ```json Example theme={null}
      [
      "High"
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.reference_range_low)" type="[]any" required>
      Mapped array of: Low end of the reference range for this test (in the given units)

      ```json CEL theme={null}
      results.map(x, x.reference_range_low)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="results.map(x, x.reference_range_high)" type="[]any" required>
      Mapped array of: High end of the reference range for this test (in the given units)

      ```json CEL theme={null}
      results.map(x, x.reference_range_high)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
