AI Transparency on FHIR
1.0.0-current - STU1 Ballot International flag

AI Transparency on FHIR, published by HL7 International / Electronic Health Records. This guide is not an authorized publication; it is the continuous build for version 1.0.0-current built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/aitransparency-ig/ and changes regularly. See the Directory of published versions

Requirements

Page standards status: Normative

The goal of this implementation guide is to provide observability of the use of AI in the production or manipulation of health data. To the end user, this means that in some way they can determine first that AI was involved and then discover more information about the AI and its usage. From this, we can understand that there are two levels of observability and multiple factors that can be observed within the second level.

  • 1st Level Observability: Labeling - this provides the indication that AI was involved in some way with the data. It provides no details about AI's involvement, but gives an indication that the end user may wish to investigate further. This level is intended to be lightweight, not adding significant bloat to the payload or requiring additional lookups on the part of the client system. For this, this guide details the use of Security Labels (see Labeling below).
  • 2nd Level Observability: Provenance - there are a number of details that may be of interest to the end user about what and how AI was used, the AI Observability Factors would be recorded using Provenance, Device, and DocumentReference.

Note: that both Security Labels and Provenance can be applied at the whole Resource level or at the Element level within a resource.

The use of labeling to achieve 1st level observability provides the end user or client system with a useful indicator of AI involvement without resulting in significant bloat in the payload. The presence of a label can tell the user or system that they may want to look for a Provenance resource that will provide more details.

Technical Actors

The Technical Actors defined in this IG are abstract technical roles that have responsibility defined in this IG. These abstract Technical Actors would be implemented in a variety of systems. The AI is important to the overall use-case but is outside the scope of constraints in this IG. The FHIR resources (clinical content) and Patient are also outside the scope of this IG, but are important to the overall use-case. The Technical Actors are:

  • Transparency Creator: The actor that adds the label or creates the Provenance. The labeling and Provenance are compliant with the requirements of this IG.
  • Transparency Consumer: The actor that reads the label or uses the Provenance defined in this IG. This actor expects the labeling and Provenance to be compliant with the requirements of this IG, but it should be robust to reasonable deviations.
TransparencyCreatorTransparencyConsumerFHIR InfrastructureAI Transparency evidenceAI Transparency evidence
Figure: Actor Diagram


AI Observability Factors

Beyond 1st level observability, there are a number of factors that the end user or client system may be interested in knowing about. These factors can be broken down into 3 categories:

  1. AI Model(s) - definition of the AI(s) used (see Defining the AI)
    • Name and version of the AI system
  2. Model-Card - details about the AI algorithm / model (see The Model-Card)
    • Organization that produced the model
    • Data set used in training the model(s)
  3. Context - input data provided to the AI to produce or manipulate outputs (see Context of AI Usage)
    • Prompts, including system and user prompts
    • Patient data, such as health records
    • Reference input, such as clinical practice guidelines
  4. Oversight - the interactions between AI(s), human(s), and system(s)
    • Human reviews (human-in-the-loop)

Discovering that AI was used

Data conforming to this guide carries a label, so inspecting .meta.security is the primary method of determining that AI was involved. Where Provenance has been recorded, it also shows AI involvement and explains how the AI was used. Provenance is not necessarily recorded for every AI-influenced Resource or element. A profile may require that it be recorded, and it may also be recorded where nothing requires it.

Labeling is used

For a given FHIR Resource, if Labeling is used, then a FHIR Resource that has been influenced by AI will have the .meta.security element populated with one of the codes from the AI Transparency Provenance ValueSet. See details below

Provenance is used

For a given FHIR Resource (e.g. Observation with id of 1234), if Provenance is used, then a search on Provenance.target for the value of your FHIR Resource will indicate all Provenance. Further refine that search to only those Provenance with a .reason code of AIReason.

GET [base]/Provenance?target=Observation/1234&reason=AIAST

If no results are returned then AI was not used, else the Provenance returned will explain how AI was used. See details below.

Labeling

A label identifies the Resource or element that AI produced or manipulated. It does not convey the level of that influence, or any details about how the AI was used. Labeling is very light weight and does not add significant bloat to the payload or require additional lookups. A client system that needs more than the fact of AI involvement may fetch the Resource's Provenance.

💡 Tip

Use when one needs to quickly and easily identify Resources or elements inside a Resource that have been produced or manipulated by AI.

Labeling (also called Security Labels) uses the FHIR Resource definition .meta.security element that is at the top of all Resources, and as such can be found without Resource type specific processing. The use of security labeling follows the purpose for security labeling, as the domain of security covers protections against risks to Confidentiality, Availability, and Integrity (see Healthcare Privacy and Security Classification System (HCS) vocabulary). In this case focusing on Integrity is defined as completeness, veracity, reliability, trustworthiness, and provenance. In the case of AI Transparency we want to mark the AI participation to convey reliability, trustworthiness, and provenance.

Within the Integrity Security Tags Vocabulary is AIAST - Artificial Intelligence Asserted as a broad concept of any influence by any kind of artificial intelligence. Note: There is also DICTAST - Dictation asserted for when dictation, which might be AI driven, has been involved in translating dictation to data; DICTAST is not included in this IG.

classDiagram
    class Resource {
        <<FHIR Resource>>
        id
        meta.security = AIAST
        ...
    }

Resource label

A Resource label indicates that at least some part of the Resource was produced or manipulated by AI. It does not indicate how much of the Resource was affected, or which parts of it.

A Resource that conforms to this guide and that has been influenced by AI in any way SHALL carry the appropriate label in .meta.security. This applies whether the AI produced the entire Resource or only a single element within it. Applying the label consistently in this way means that all AI-influenced Resources are identifiable by the same lightweight method.

The key portion of that Resource is the following meta.security element holding the AIAST code. AIAST is an HL7 Observation value for metadata that indicates that AI was involved in producing or manipulating the data or information.

The AIAST code does not provide contextual indications, like for example if a clinician was involved in the use of the AI, or reviewed the output of the AI. Neither does it indicate the extent of the AI involvement. When it is useful to show exactly which elements the AI produced or manipulated, the Resource label is combined with element level labeling (see Element label within a Resource).

{
  "resourceType" : "Observation",
  "id" : "glasgow",
  "meta" : {
    "security" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationValue",
        "code" : "AIAST",
        "display" : "Artificial Intelligence asserted"
      }
    ]
  },
  "text" : {
    ...

Element label within a Resource

An Element label will indicate that an element or a few elements within a Resource were produced or manipulated by AI, but not the whole Resource. Use when components of an example were authored by AI, but not the whole Resource.

meta.security holds a code defined in DS4P Inline Security Labels - PROCESSINLINE, and the inline-sec-label extension is on each element that was produced or manipulated by AI to indicate it is an AI asserted value. The AIAST code will be in the .meta.security element of the Resource also.

One of the key portions of that Resource is

  "conclusionCode" : [
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/uv/security-label-ds4p/StructureDefinition/extension-inline-sec-label",
          "valueCoding" : {
            "system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationValue",
            "code" : "AIAST",
            "display" : "Artificial Intelligence asserted"
          }
        }
      ],
      "coding" : [
        {
          "system" : "http://snomed.info/sct",
          "code" : "428763004",
          "display" : "Staphylococcus aureus bacteraemia"
        }
      ]
    }
  ]

Provenance

There are a number of observability factors beyond simple labeling that are of interest to end users and downstream systems. Chief among these is the nature of the AI itself. The user would like to understand what algorithm / model was used, who developed it, how it was trained, any certifications it has, and so on… To do this, the guide outlines the use of the Provenance resource, which can then be linked to Device and DocumentReference to point to a Model-Card.

The overall Provenance model is shown below:

classDiagram
    direction LR
    class Resource {
        <<FHIR Resource>>
        id
        meta.security = AIAST
        ...
    }

    class Provenance {
        <<FHIR Resource>>
        target : Reference resource created/updated
        occurred : When
        reason : `AIAST`
        agent : Reference to AI Device
        agent : Reference to human-in-the-loop
        agent : References to other agents involved
        entity : References to Input-Prompt DocumentReference
        entity : References to Model-Card DocumentReference
        entity : References to other data used
    }

    class Device {
        <<FHIR Resource>>
        id
        identifier
        type = "Artificial-Intelligence"
        extension : Specific kind of AI
        modelNumber
        manufacturer
        manufactureDate
        deviceName
        version
        owner
        contact
        url
        safety
        extension : model-card
    }

    class DocumentReferenceModelCard {
        <<FHIR Resource>>
        id
        type = AImodelCard
        category = AIModelCardMarkdownFormat  | AImodelCardCHAIformat
        description
        version
        data / url = codeable model-card details
    }

    class DocumentReferenceInputPrompt {
        <<FHIR Resource>>
        id
        type = AIInputPrompt
        description
        version
        data / url = codeable Input-Prompt details
    }

    Resource "1..*" <-- Provenance : "Provenance.target"
    Provenance --> Device : "Provenance.agent.who"
    Device --> DocumentReferenceModelCard : "Device.extension.model-card"
    Provenance --> DocumentReferenceInputPrompt : "Provenance.entity.what"

Further described below…

Provenance Profile

The Provenance profile provides clear ways to define:

  • The AI System details - Provenance.agent described with a Device conforming to the AIDevice profile identified with the role of Artificial-Intelligence
  • The Model-Card details - Provenance.entity with a role of derivation pointing to a DocumentReference conforming to the AIModelCard profile
  • The Prompts - Provenance.entity with a role of derivation pointing to a DocumentReference conforming to the AIInputPrompt profile
  • The FHIR Resources that were provided to the AI - all the other Provenance.entity
  • When the AI was used - Provenance.occurred
  • Who else was involved, such as human overseers, other systems, and so on - Provenance.agent
  • The FHIR Resources that were created or updated by the AI - Provenance.target
Resource-level

As with labeling, a Provenance can point at a whole Resource. In this way one can carry details in the Provenance, such as what AI was used and how.

Element-level

Provenance can be just about some elements within a Resource. This is a supported use of Provenance, but it is especially important for AI use-cases. The support comes from extensions added to the extension-registry and explained in later versions of FHIR. The Provenance.target SHALL point at a specific element(s) within the targeted resource using the target element extension or target path extension.

Defining the AI System

The AI system is described in a FHIR Device resource, which is profiled. The Device.type MUST be Artificial-Intelligence. There is an extension to hold more specific kinds of AI. There is an extension to point at a Model-Card if this Device is always used with that Model-Card. The Device resource referenced in a Provenance resource that describes the AI involvement in the creation or manipulation of the data.

The Model-Card

The Model-Card encoding is defined by other standards organizations, and have distinct mime-type. To encode a Model-Card the DocumentReference resource is used. To make this more clear and searchable we define a codeSystem that has some codes to be used to identify that the DocumentReference is specifically an AI Model-Card or an AI Input Prompt

The industry is converging around standards for providing AI instructions and settings, generally called Model-Cards. Several different standards are emerging, including Hugging Face and CHAI Model Cards. This guide does not enforce any particular Model-Card, but does show how to encode any Model-Card in a AI Model-Card profiled DocumentReference, and these would be referenced in a AI profiled Device or within the Provenance.

This specification supports two model-card standards at this time, but recognize that there may be updates and new standards in the future. The choice of which model-card standard to use is up to the implementer, and this guide does not enforce any particular model-card standard.

Hugging Face Markdown

The Hugging Face Model-Card is a combination of YAML that defines in codeable terms the details, and a Markdown that describes it in narrative. Given that Markdown can carry YAML, the overall object is Markdown.

Example Model-Card from https://github.com/huggingface/huggingface_hub/tree/main/tests/fixtures/cards

Here is an example given:

---
language:
- en
license:
- bsd-3-clause
annotations_creators:
- crowdsourced
- expert-generated
language_creators:
- found
multilinguality:
- monolingual
size_categories:
- n<1K
task_categories:
- image-segmentation
task_ids:
- semantic-segmentation
pretty_name: Sample Segmentation
---

The example above is encoded in a DocumentReference with Model-Card encoded inside

CHAI Applied Model-Cards XML

The Coalition for Health AI (CHAI) Applied Model Card utilizes XML encoding and PDF rendering.

An example from the CHAI Github Examples is included here in multiple DocumentReference formats:

Note that these are all the same example Model-Card, just encoded different ways depending on the needs. These three encoding methods are available for the HuggingFace format as well. Note that in the case of CHAI format, these examples include both the XML and the PDF rendering of the same as different .content entries.

Context of AI Usage

When using an AI it is necessary to supply it with certain inputs. These inputs very based on the AI involved, but the industry generally refers to these inputs as the "prompt" (especially in the case of Generative AI).

💡 Tip

Use when the record needs to show the data inputs, such as to understand what data the AI had to inference on, vs what data was not provided.

There are different kinds of prompts supplied, including but not limited to:

  • System Prompt: Instructions to the AI on what to do and how to handle user inputs. These can also include reference information, such as clinical practice guidelines, drug interaction databases, treatment protocols, and evidence-based medicine resources that will enhance the AI decision-making.
  • User Prompt: Input from the user. This often includes the question to answer or problem to solve. In many cases this is a templated text that allows for the inserting of additional data (note some systems allow other prompt types to include files as additional data). This additional data can include patient demographics, clinical notes, laboratory results, imaging data, and other health data that will be useful to the AI decision-making.

In general, inputs should be captured using a Input-Prompt DocumentReference linked through the Provenance, but when specific clinical data is involved those Resources would be indicated as additional Provenance.entity elements.

Note

There is significant variation in what and how AI systems inputs are supplied, however capturing those inputs should remain relatively consistent.

Context Examples

The context documents all inputs involved in AI processing.

One useful thing to record is the prompt(s) given to the AI. This prompt(s) can be very important to the output, and the interpretation of the output. The prompt(s) is recorded as an attachment, using the Input-Prompt DocumentReference, and using a code as defined above

The first example is just showing the encapsulating mechanism. The Second example is a prompt that might be used to have the AI create a given Patient resource that meets the input requirements.

Full Provenance example

This is a full example of how to capture the AI process in FHIR.

  • Two outputs that this Provenance resource is documenting:
    • an Observation resource (e.g., lab result)
      • with Observation.interpretation being attributed to this Provenance
    • a CarePlan resource (e.g., follow-up care plan)
  • Two agents
    • a verifier (human) who verifies the AI output
    • an author (AI system) who generated the output
  • Two entities that were clinical resources provided to the AI system
    • a DocumentReference resource (e.g., patient summary)
    • an Observation resource (e.g., lab result)
  • One entity that is a PlanDefinition resource (e.g., care plan definition)
  • One entity that is the AI Input Prompt
    • Where the Input Prompt is a DocumentReference resource that contains the input prompt provided to the AI system.
    • Where the Input Prompt is a contained resource in the Provenance resource.
    • Where the Input Prompt is associated with the clinician which provided it

Security and Privacy Considerations

  • The Input Prompt and Context may contain sensitive information, such as patient data, and should be protected accordingly.
  • The Model-Card if it contains sensitive information about the AI model that should not be public.