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

# AI Summaries

> Get a brief summary of the most relevant medical history you need to know about your patient

<iframe src="https://www.loom.com/embed/b8251151e4ac4f398e813359775fe005?sid=4a2e42b1-235e-42a7-a4d0-236be1533e55" width="100%" height="450px" />

This feature summarizes your lengthiest patient records into one cohesive paragraph consisting of the most relevant medical history you need to know about your patient - retrievable via the API or dashboard.

<Info>
  This is a premium feature - if you'd like access to it,
  contact us and let us know!
</Info>

## API

When using the API, you can access the AI brief by triggering a
[Consolidated Data Query](/medical-api/api-reference/fhir/consolidated-data-query-post) request.
Depending on the `conversionType` you choose, the AI brief will be included in the response in a
different format (see [FHIR Bundle](/medical-api/handling-data/ai-summaries#fhir-bundle) or
[Medical Record Summary](/medical-api/handling-data/ai-summaries#medical-record-summary) below).

<Tip>
  If you add a resource type filter to the `Consolidated
      Data Query`, make sure to include `Binary` as well in
  order to get the AI Brief in the results.
</Tip>

### FHIR Bundle

When triggering a consolidated query via the API with the `conversionType` query param set to `json`,
the AI brief will be included in the response under a
[Binary resource](/medical-api/fhir/resources/binary) with the following format:

<Info>
  The `data` field is a Base64 encoded string containing the
  AI brief text.
</Info>

```json theme={null}
{
  "resourceType": "Binary",
  "id": "1234",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2023-06-14T10:30:00Z",
    "source": "metriport:ai-generated-brief"
  },
  "contentType": "text/plain",
  "data": "VGhlIHBhdGllbnQgaXMgYSA0Mi15ZWFyLW9sZCBtYWxlIHdobyBpcyBjdXJyZW50bHkgb24g
           bXVsdGlwbGUgbWVkaWNhdGlvbnMgdG8gbWFuYWdlCnZhcmlvdXMgY29uZGl0aW9ucy4gSGlz
           IG1lZGljYXRpb24gcmVnaW1lbiBpbmNsdWRlcyB6b2xwaWRlbSAxMCBtZyBmb3Igc2xlZXAs
           IHNpbXZhc3RhdGluCjIwIG1nIGZvciBjaG9sZXN0ZXJvbCBtYW5hZ2VtZW50LCBsZXZvdGh5
           cm94aW5lIHNvZGl1bSAwLjA3NSBtZyAoU3ludGhyb2lkKSBmb3IgdGh5cm9pZApyZXBsYWNl
           bWVudCB0aGVyYXB5LCBhbmQgemFmaXJsdWthc3QgMjAgbWcgKEFjY29sYXRlKSBmb3IgYXN0
           aG1hIG1hbmFnZW1lbnQuIFRoZQpjb21iaW5hdGlvbiBvZiB0aGVzZSBtZWRpY2F0aW9ucyBz
           dWdnZXN0cyB0aGUgcGF0aWVudCBoYXMgY29uY3VycmVudCBjb25kaXRpb25zCmluY2x1ZGlu
           ZyBzbGVlcCBkaXN0dXJiYW5jZSwgaHlwZXJjaG9sZXN0ZXJvbGVtaWEsIGh5cG90aHlyb2lk
           aXNtLCBhbmQgYXN0aG1hIG9yIG90aGVyCnJlc3BpcmF0b3J5IGlzc3VlcyByZXF1aXJpbmcg
           YSBsZXVrb3RyaWVuZSBtb2RpZmllci4="
}
```

### Medical Record Summary

When triggering a consolidated query via the API with the `conversionType` query param set to
`html` or `pdf`, the AI brief appears
at the top of the Medical Record Summary document.

<Frame>
  <img src="https://mintcdn.com/metriport/01VxYc4hqAqnMppL/images/ai-brief-pdf.png?fit=max&auto=format&n=01VxYc4hqAqnMppL&q=85&s=4440d8a7a4b12ec7145d9d1fed4f3ad2" alt="AI Brief" width="1580" height="724" data-path="images/ai-brief-pdf.png" />
</Frame>

## Dashboard

Once a patient's data is loaded in the Metriport dashboard, you can view their AI brief at the
top of their medical record history.

<Frame>
  <img src="https://mintcdn.com/metriport/01VxYc4hqAqnMppL/images/ai-brief-dash.png?fit=max&auto=format&n=01VxYc4hqAqnMppL&q=85&s=b4449f462771ff6229946b996d4f9a10" alt="AI Brief in Dashboard" width="3456" height="1822" data-path="images/ai-brief-dash.png" />
</Frame>

## Data Warehouse

AI summaries are available in the data warehouse under the [`Binary`](/medical-api/handling-data/schema-v100/binary) resource table. The AI brief text is stored as Base64-encoded data in the `data` column, and can be identified by the `meta_source` field which contains `"metriport:ai-generated-brief"`.

<Info>
  The `data` field contains Base64-encoded text. You'll need
  to decode it to retrieve the AI brief content.
</Info>
