---
# System prepended metadata

title: Understanding FHIR Data Lineage for Lab Results
tags: [RWE, CDISC, FHIR]

---

# Understanding FHIR Data Lineage for Lab Results

*A More Beginner-Friendly Guide*


This guide walks you through how lab results (like a WBC count) move through systems, from raw lab messages to structured clinical data formats. It’s meant for readers who are new to FHIR and need to understand how lab data is represented, transformed, and tracked **before it is collected and represented in SDTM**. 



* **User Story (Human):**
  *"As a data engineer, I need to parse HL7 V2 lab messages into FHIR Observations so I can transform them into SDTM datasets with traceable lineage."*

* **System Workflow (Machine):**
  *System receives HL7 V2 → stores as DocumentReference → parses into Observation → connects with [Provenance](https://hackmd.io/@explore/fhir-prov-rwd-lineage) → maps fields to Define-XML.*




---

[toc]

---

## Terms and Concepts

| **Term**                 | **What It Means**                                                                                     |
| ------------------------ | ----------------------------------------------------------------------------------------------------- |
| **FHIR Resource**        | A modular data structure in FHIR (e.g., Observation, Provenance). JSON objects for healthcare. |
| **DocumentReference**    | A FHIR Resource. Stores original documents or messages. In this example, the raw HL7 V2 lab message.                               |
| **Observation**          | A FHIR Resource. Represents structured clinical measurements (like a WBC count).                                       |
| **[Provenance](https://hackmd.io/@explore/fhir-prov-rwd-lineage)**           | A FHIR Resource. Tracks how a resource was created—what it came from, who did it, and when.                            |
| **LOINC**                | Standard codes for lab tests. E.g., `26464-8` = White Blood Cell (WBC) count.                         |
| **SDTM LBORRES**         | CDISC variable for storing lab result values in clinical study datasets.                              |
| **Define-XML / ODM 2.0** | Standards for metadata, transformations, and audit trail in clinical submissions.                     |

---

## Motivating Example: Tracing a WBC Count

Let’s follow a **white blood cell (WBC) count of 5.4 × 10⁹/L** from a lab system into a structured clinical data format.

### Data Path:

```
Lab System → HL7 V2 Message → FHIR DocumentReference → FHIR Observation → Define-XML (ODM 2.0)
```

### Step-by-Step:

1. **Lab System (e.g., Abbott Alinity)**

   * Produces an **HL7 V2 ORU^R01 message** with lab result.
   * Standard: HL7 V2.9

2. **FHIR DocumentReference**

   * Stores the original HL7 message (e.g., as Base64-encoded text).
   * Why? Keeps the source message available for traceability.

3. **FHIR Observation**

   * Represents the parsed, structured result.
   * Stores:

     * `valueQuantity.value = 5.4`
     * `valueQuantity.unit = 10^9/L`
     * `code = 26464-8` (LOINC for WBC count)
     * `effectiveDateTime = time of blood draw`

4. **FHIR [Provenance](https://hackmd.io/@explore/fhir-prov-rwd-lineage) Resources**

   * Track the lineage at each transformation step:

     * **Provenance A**: Links lab system to DocumentReference.
     * **Provenance B**: Links parsing system to Observation (derived from DocumentReference).

5. **Define-XML / ODM 2.0**

   * Final clinical representation:

     * `<Origin>`, `<SourceItem>` for data source
     * `<Coding>` for LOINC
     * `<AuditTrail>` for who/when/what
     * Maps Observation values to SDTM variables like `LBORRES`

---

## End-to-End Lineage Flow

```text
Lab System Output (HL7 V2 Message)
    └──> DocumentReference
           └── (Base64-encoded HL7 message)
           └── Provenance A
                 ├── target: DocumentReference
                 ├── agent: Lab System
                 └── entity: HL7 message
               ↓
    └──> Observation
           ├── valueQuantity.value = 5.4
           ├── valueQuantity.unit = 10^9/L
           ├── code = 26464-8
           ├── effectiveDateTime = draw time
           └── subject.reference = patient
           └── Provenance B
                 ├── target: Observation
                 ├── agent: ETL system
                 └── entity: DocumentReference
               ↓
    └──> Define-XML (ODM 2.0)
           ├── Origin, SourceItem, Coding
           ├── MethodRef, MethodDef
           └── AuditTrail, User
```

---

## Ref Table: FHIR Attributes

| **FHIR Resource** | **Attribute**             | **What It Holds**                     |
| ----------------- | ------------------------- | ------------------------------------- |
| DocumentReference | `content.attachment.data` | Raw HL7 V2 message (Base64)           |
| Observation       | `valueQuantity.value`     | Lab result value (e.g., 5.4)          |
| Observation       | `valueQuantity.unit`      | Measurement unit (e.g., 10^9/L)       |
| Observation       | `effectiveDateTime`       | Time of measurement                   |
| Observation       | `subject.reference`       | Patient the test result belongs to    |
| Provenance        | `target.reference`        | The resource being traced             |
| Provenance        | `entity.what.reference`   | The source resource it's derived from |
| Provenance        | `agent.who`               | Who performed the transformation      |

---


### Example FHIR DocumentReference
- The HL7 message is wrapped in a DocumentReference for storage.

    #### Purpose:
    - Keep the raw data intact.
    - Facilitate reference in provenance.

```json
{
  "resourceType": "DocumentReference",
  "id": "docref123",
  "content": [
    {
      "attachment": {
        "contentType": "text/hl7-v2",
        "data": "BASE64ENCODEDHl7V2MESSAGE=="
      }
    }
  ]
}
```

---

### Example FHIR Observation
A derived structured resource.
#### Stores:
- `valueQuantity.value`=5.4
- `valueQuantity.unit`=10^9/L
- `code.coding.code`=26464-8 (LOINC)
- `effectiveDateTime`: date/time of measurement

```json
{
  "resourceType": "Observation",
  "id": "obs12345",
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "26464-8",
        "display": "White blood cells [#/volume] in Blood"
      }
    ]
  },
  "valueQuantity": {
    "value": 5.4,
    "unit": "10^9/L"
  },
  "subject": {
    "reference": "Patient/12345"
  },
  "effectiveDateTime": "2025-05-10T10:00:00Z"
}
```

---


### Example FHIR Provenance A (HL7 V2 → DocumentReference)
- Declares that the DocumentReference originated from the lab system.
    #### Attributes:
    - `agent`: lab system
    - `entity`: the HL7 V2 message

```json
{
  "resourceType": "Provenance",
  "target": [
    { "reference": "DocumentReference/docref123" }
  ],
  "recorded": "2025-05-10T09:55:00Z",
  "agent": [
    { "who": { "display": "Lab System A" } }
  ],
  "entity": [
    { "role": "source", "what": { "display": "HL7 V2 message" } }
  ]
}
```

### Example FHIR Provenance B (DocumentReference → Observation)

```json
{
  "resourceType": "Provenance",
  "target": [
    { "reference": "Observation/obs12345" }
  ],
  "recorded": "2025-05-10T10:00:00Z",
  "agent": [
    { "who": { "display": "ETL System 1" } }
  ],
  "entity": [
    { "role": "source", "what": { "reference": "DocumentReference/docref123" } }
  ]
}
```

---

### Example ODM 2.0 Define-XML

<!---
```xml
<ODM xmlns="http://www.cdisc.org/ns/odm/v2.0" FileOID="ODM.LBORRES.Example" ODMVersion="2.0" FileType="Snapshot" Granularity="Metadata" AsOfDateTime="2025-06-02T00:00:00">
  <Study OID="S.Study123">
    <MetaDataVersion OID="MDV.001" Name="FHIR2SDTM Example" Description="Example lineage mapping for LBORRES">
      <ItemDef OID="IT.LBORRES" Name="LBORRES" DataType="text" Length="200">
        <Description>
          <TranslatedText xml:lang="en">Lab Test Result</TranslatedText>
        </Description>
        <Origin Type="Collected">
          <SourceItem>
            <Resource>Observation</Resource>
            <Attribute>valueQuantity.value</Attribute>
            <Coding Dictionary="LOINC" Code="26464-8"/>
          </SourceItem>
          <MethodRef MethodOID="MT.ExtractFHIRValue"/>
        </Origin>
      </ItemDef>
      <MethodDef OID="MT.ExtractFHIRValue" Name="ExtractFHIRValue" Type="Computation">
        <Description>
          <TranslatedText xml:lang="en">
            Extracted from FHIR Observation.valueQuantity.value using FHIR2SDTM Mapper v1.2
          </TranslatedText>
        </Description>
      </MethodDef>
      <AuditTrail OID="AT.LBORRES.12345">
        <UserRef UserOID="USR.DataEngineer1"/>
        <Location>FHIR2SDTM Mapper</Location>
        <DateTimeStamp>2025-05-10T12:00:00</DateTimeStamp>
        <ReasonForChange>FHIR to SDTM conversion for LBORRES</ReasonForChange>
      </AuditTrail>
      <User OID="USR.DataEngineer1">
        <LoginName>DataEngineer1</LoginName>
        <DisplayName>Data Engineer 1</DisplayName>
        <Organization>RWD Integration Unit</Organization>
      </User>
    </MetaDataVersion>
  </Study>
</ODM>
```
--->

```xml
<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v2.0"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     ODMVersion="2.0"
     FileOID="FHIR-WBC-Lineage-Study"
     FileType="Snapshot"
     CreationDateTime="2025-06-19T12:00:00"
     Originator="Clinical Data Integration System"
     SourceSystem="FHIR-ODM Integration Platform"
     SourceSystemVersion="1.0">

    <Study OID="WBC.LINEAGE.STUDY" StudyName="WBC Lineage Tracking Study" ProtocolName="WBC-FHIR-Lineage-01">
        <Description>
            <TranslatedText xml:lang="en" Type="text/plain">Study demonstrating complete lineage tracking from HL7 V2 messages through FHIR resources to SDTM</TranslatedText>
        </Description>

        <MetaDataVersion OID="MDV.WBC.LINEAGE.v1" Name="WBC Lineage MetaData Version 1.0">

            <!-- Common demographics form -->
            <ItemGroupDef OID="IG.DM" Name="Demographics" Repeating="No" Type="Form">
                <ItemRef ItemOID="IT.STUDYID" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.USUBJID" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.SUBJID" Mandatory="Yes"/>
            </ItemGroupDef>

            <!-- Lab results form with complete lineage -->
            <ItemGroupDef OID="IG.LB" Name="Laboratory Results" Repeating="No" Type="Form">
                <ItemRef ItemOID="IT.LB.LBDTC" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.LB.WBC.LBORRES" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.LB.WBC.LBORRESU" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.LB.LBTEST" Mandatory="Yes"/>
                <ItemRef ItemOID="IT.LB.LBTESTCD" Mandatory="Yes"/>

                <!-- Origin tracking complete lineage chain -->
                <Origin Type="EHR" Source="Investigator">
                    <Description>
                        <TranslatedText xml:lang="en" Type="text/plain">Lab values with complete provenance from HL7 V2 through FHIR to SDTM</TranslatedText>
                    </Description>
                    <SourceItems>
                        <!-- Primary FHIR Observation source -->
                        <SourceItem>
                            <Resource Type="HL7-FHIR" Name="Observation" Attribute="valueQuantity.value" Label="wbc_value">
                                <Selection Path="Observation[code.coding.code='26464-8' and code.coding.system='http://loinc.org']"/>
                            </Resource>
                        </SourceItem>
                        <SourceItem>
                            <Resource Type="HL7-FHIR" Name="Observation" Attribute="valueQuantity.unit" Label="wbc_unit">
                                <Selection Path="Observation[code.coding.code='26464-8' and code.coding.system='http://loinc.org']"/>
                            </Resource>
                        </SourceItem>
                        <!-- DocumentReference lineage -->
                        <SourceItem>
                            <Resource Type="HL7-FHIR" Name="DocumentReference" Attribute="content.attachment.data" Label="hl7v2_message">
                                <Selection Path="DocumentReference[content.attachment.contentType='text/hl7-v2']"/>
                            </Resource>
                        </SourceItem>
                        <!-- Provenance chain -->
                        <SourceItem>
                            <Resource Type="HL7-FHIR" Name="Provenance" Attribute="target.reference" Label="provenance_target">
                                <Selection Path="Provenance[target.reference='Observation/obs12345']"/>
                            </Resource>
                        </SourceItem>
                        <SourceItem>
                            <Resource Type="HL7-FHIR" Name="Provenance" Attribute="entity.what.reference" Label="provenance_source">
                                <Selection Path="Provenance[target.reference='Observation/obs12345']"/>
                            </Resource>
                        </SourceItem>
                        <Coding Code="26464-8" System="http://loinc.org" SystemName="LOINC" SystemVersion="2.72" Label="wbc_loinc"/>
                    </SourceItems>
                </Origin>
            </ItemGroupDef>

            <!-- Item definitions -->
            <ItemDef OID="IT.STUDYID" Name="Study Identifier" DataType="text" Length="32">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Study Identifier</TranslatedText>
                </Question>
            </ItemDef>

            <ItemDef OID="IT.USUBJID" Name="Unique Subject Identifier" DataType="text" Length="32">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Unique Subject Identifier</TranslatedText>
                </Question>
            </ItemDef>

            <ItemDef OID="IT.SUBJID" Name="Subject Identifier" DataType="text" Length="16">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Subject Identifier for this Study</TranslatedText>
                </Question>
            </ItemDef>

            <ItemDef OID="IT.LB.LBDTC" Name="Date/Time of Specimen Collection" DataType="datetime">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Date/Time of Specimen Collection</TranslatedText>
                </Question>
                <Alias Context="SDTM" Name="LBDTC"/>
            </ItemDef>

            <ItemDef OID="IT.LB.WBC.LBORRES" Name="WBC Result" DataType="float" Length="8">
                <Description>
                    <TranslatedText xml:lang="en" Type="text/plain">White Blood Cell count result as originally received</TranslatedText>
                </Description>
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">WBC Count Result</TranslatedText>
                </Question>
                <Coding Code="26464-8" System="http://loinc.org" SystemName="LOINC" SystemVersion="2.72"/>
                <Alias Context="SDTM" Name="LBORRES"/>
            </ItemDef>

            <ItemDef OID="IT.LB.WBC.LBORRESU" Name="WBC Result Unit" DataType="text" Length="10">
                <Description>
                    <TranslatedText xml:lang="en" Type="text/plain">Unit for WBC count result</TranslatedText>
                </Description>
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">WBC Count Unit</TranslatedText>
                </Question>
                <CodeListRef CodeListOID="CL.WBC.UNIT"/>
                <Alias Context="SDTM" Name="LBORRESU"/>
            </ItemDef>

            <ItemDef OID="IT.LB.LBTEST" Name="Lab Test Name" DataType="text" Length="40">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Laboratory Test Name</TranslatedText>
                </Question>
                <CodeListRef CodeListOID="CL.LBTEST"/>
                <Alias Context="SDTM" Name="LBTEST"/>
            </ItemDef>

            <ItemDef OID="IT.LB.LBTESTCD" Name="Lab Test Code" DataType="text" Length="8">
                <Question>
                    <TranslatedText xml:lang="en" Type="text/plain">Laboratory Test Short Name</TranslatedText>
                </Question>
                <CodeListRef CodeListOID="CL.LBTESTCD"/>
                <Alias Context="SDTM" Name="LBTESTCD"/>
            </ItemDef>

            <!-- Code Lists -->
            <CodeList OID="CL.WBC.UNIT" Name="WBC Unit" DataType="text">
                <CodeListItem CodedValue="10^9/L">
                    <Decode>
                        <TranslatedText xml:lang="en" Type="text/plain">10^9/L</TranslatedText>
                    </Decode>
                </CodeListItem>
                <CodeListItem CodedValue="K/uL">
                    <Decode>
                        <TranslatedText xml:lang="en" Type="text/plain">K/uL</TranslatedText>
                    </Decode>
                </CodeListItem>
            </CodeList>

            <CodeList OID="CL.LBTEST" Name="Laboratory Test Name" DataType="text">
                <CodeListItem CodedValue="White Blood Cells">
                    <Decode>
                        <TranslatedText xml:lang="en" Type="text/plain">White Blood Cells</TranslatedText>
                    </Decode>
                    <Coding Code="26464-8" System="http://loinc.org" SystemName="LOINC" SystemVersion="2.72"/>
                </CodeListItem>
            </CodeList>

            <CodeList OID="CL.LBTESTCD" Name="Laboratory Test Code" DataType="text">
                <CodeListItem CodedValue="WBC">
                    <Decode>
                        <TranslatedText xml:lang="en" Type="text/plain">WBC</TranslatedText>
                    </Decode>
                    <Coding Code="26464-8" System="http://loinc.org" SystemName="LOINC" SystemVersion="2.72"/>
                </CodeListItem>
            </CodeList>

            <!-- Method definition for FHIR lineage retrieval -->
            <MethodDef OID="MT.FHIR.LINEAGE.RETRIEVAL" Name="FHIR Lineage Retrieval Method" Type="Computation">
                <Description>
                    <TranslatedText xml:lang="en" Type="text/plain">Method to retrieve lab results with complete lineage tracking from FHIR ecosystem</TranslatedText>
                </Description>
                <MethodSignature>
                    <Parameter Name="patient_id" Definition="FHIR Patient ID" DataType="text"/>
                    <Parameter Name="loinc_code" Definition="LOINC test code" DataType="text"/>
                    <Parameter Name="effective_date" Definition="Test effective date" DataType="datetime"/>
                    <ReturnValue Name="wbc_value" Definition="WBC count value" DataType="float"/>
                    <ReturnValue Name="wbc_unit" Definition="WBC count unit" DataType="text"/>
                    <ReturnValue Name="provenance_chain" Definition="Complete provenance chain" DataType="text"/>
                </MethodSignature>
                <FormalExpression Context="Python 3.9">
                    <Code>
# Add your code here
                    </Code>
                </FormalExpression>
            </MethodDef>
        </MetaDataVersion>
    </Study>
</ODM>
```

---

#### `<ODM>` 

```xml
<ODM xmlns="http://www.cdisc.org/ns/odm/v2.0" FileOID="ODM.LBORRES.Example" ODMVersion="2.0" FileType="Snapshot" Granularity="Metadata" AsOfDateTime="2025-06-02T00:00:00">
```

Top-level container for the entire metadata file.

* `FileOID` = unique ID for this file
* `ODMVersion` = specifies ODM 2.0 standard
* `FileType` = this is a snapshot of metadata
* `Granularity=Metadata` = describes metadata, not subject data
* `AsOfDateTime` = when the file was generated

---

#### `<Study>`

```xml
<Study OID="S.Study123">
```

Represents the study context (placeholder ID here: `Study123`).
All metadata is scoped within this study.

---

#### `<MetaDataVersion>`

```xml
<MetaDataVersion OID="MDV.001" Name="FHIR2SDTM Example" Description="Example lineage mapping for LBORRES">
```

Groups together the definitions of items, methods, audit trails, etc.

* `OID` = unique ID for this version of metadata
* `Name` and `Description` explain purpose

---

#### `<ItemDef>`

```xml
<ItemDef OID="IT.LBORRES" Name="LBORRES" DataType="text" Length="200">
```

Defines SDTM variable `LBORRES`.

* `OID` = unique ID for this item
* `Name` = LBORRES
* `DataType` = text
* `Length` = max length 200

---

#### `<Description>`

```xml
<Description>
  <TranslatedText xml:lang="en">Lab Test Result</TranslatedText>
</Description>
```

Human-readable label or description of `LBORRES`.

---

#### `<Origin>` + `<SourceItem>` + `<Coding>`

```xml
<Origin Type="Collected">
  <SourceItem>
    <Resource>Observation</Resource>
    <Attribute>valueQuantity.value</Attribute>
    <Coding Dictionary="LOINC" Code="26464-8"/>
  </SourceItem>
  <MethodRef MethodOID="MT.ExtractFHIRValue"/>
</Origin>
```

Specifies where the value came from:

* `Type="Collected"` = this value was collected data
* `Resource=Observation`, `Attribute=valueQuantity.value` = points to the FHIR source
* `Coding` = identifies test type via LOINC
* `MethodRef` = links to method used to process this data

---

#### `<MethodDef>`

Defines the method used to transform the data from FHIR into SDTM.
```xml
<MethodDef OID="MT.ExtractFHIRValue" Name="ExtractFHIRValue" Type="Computation">
  <Description>
    <TranslatedText xml:lang="en">
      Extracted from FHIR Observation.valueQuantity.value using FHIR2SDTM Mapper v1.2
    </TranslatedText>
  </Description>
</MethodDef>
```


* Describes extraction and tool (FHIR2SDTM Mapper v1.2)

---

#### `<AuditTrail>`
Captures who, where, when, and why this mapping/transformation was done.

```xml
<AuditTrail OID="AT.LBORRES.12345">
  <UserRef UserOID="USR.DataEngineer1"/>
  <Location>FHIR2SDTM Mapper</Location>
  <DateTimeStamp>2025-05-10T12:00:00</DateTimeStamp>
  <ReasonForChange>FHIR to SDTM conversion for LBORRES</ReasonForChange>
</AuditTrail>
```


* Points to the user
* Records tool location
* Records time and reason

---

#### `<User>`

Defines the person who did the work for the audit trail.
```xml
<User OID="USR.DataEngineer1">
  <LoginName>DataEngineer1</LoginName>
  <DisplayName>Data Engineer 1</DisplayName>
  <Organization>RWD Integration Unit</Organization>
</User>
```


---

## **Summary**



To ensure **traceable, auditable patient-level lineage** from FHIR through to SDTM, this model includes:  
- Multiple FHIR resources and Provenance chaining (DocumentReference + Observation)
- Full documentation of data origin and transformations
- Define-XML mapping that captures final step traceability:
    * The SDTM variable definition (`ItemDef`)
    * Where its value came from (FHIR resource + attribute + LOINC code)
    * How it was processed (`MethodDef`)
    * Who did it, when, and why (`AuditTrail`, `User`)



Model represents **FHIR-based patient-level lineage** because:

* **Every data point is linked via FHIR resource references** (`DocumentReference`, `Observation`, `Provenance`).
* **Provenance chains show the path** of data from source (`HL7 V2 / lab system`) → FHIR resource creation → transformation → mapping.
* **Patient-level traceability is achieved** via:
    * `Observation.subject.reference` = points to the patient
    * `Provenance.target` = points to specific data related to that patient
    * ODM/Define-XML links this to the regulatory submission layer


✅ **Patient-level lineage**

* The path of **a specific patient's data** is captured (e.g., Patient/12345’s WBC result).
* The **origin, agent, and transformation of that data** are recorded.
* The final data point in SDTM (`LBORRES`) can be traced back to the FHIR resources and systems that generated it.



⚠ **Room for improvement**

* Make sure `Observation.status` is present (FHIR requires it).
* Make sure Provenance agents are concrete references (`who.reference` to actual system/org, not just display).
* Ensure the chain explicitly links to `Patient/12345` at each step (if appropriate).



---

## **Mermaid diagrams**

### **Lineage Flow with Provenance and Define-XML Mapping**

```mermaid
flowchart TD
  A[Source System<br>ODM: external origin<br>Value: HL7 V2 Message Lab Output]
  B[FHIR Resource<br>Type: DocumentReference]
  C[Provenance Agent<br>FHIR: agent.who<br>Value: Lab System]
  D[FHIR Resource<br>Type: Observation<br>Code: LOINC 26464 8]
  E[Provenance Agent<br>FHIR: agent.who<br>Value: ETL System]
  F[Metadata Container<br>ODM: Define XML ODM 2 0]
  G[SourceItem<br>ODM: Attribute Observation valueQuantity value]
  H[MethodDef<br>ODM: Method Name ExtractFHIRValue<br>Tool: Mapper V1 2]
  I[AuditTrail<br>ODM: UserRef DataEngineer1<br>User Display Data Engineer 1<br>Org RWD Integration]

  A --> B
  B --> C
  C --> D
  D --> E
  E --> F
  F --> G
  F --> H
  F --> I

```

---

### **ODM Define-XML Structure**

```mermaid
flowchart TD
  X[ItemDef: LBORRES]
  Y[Origin: Collected]
  Y1[SourceItem: Observation.valueQuantity.value]
  Y2[Coding: LOINC 26464-8]
  Y3[MethodRef: MT.ExtractFHIRValue]
  Z[MethodDef: ExtractFHIRValue]
  W[AuditTrail: AT.LBORRES.12345]
  U[User: Data Engineer 1]

  X --> Y
  Y --> Y1
  Y --> Y2
  Y --> Y3
  X --> Z
  X --> W
  W --> U
```

---

### **Provenance Chaining**

```
mermaid
flowchart TD
  P1[HL7 V2 Message]
  P2[DocumentReference]
  P3[Observation]
  P1 -->|source for| P2
  P2 -->|Provenance A: agent=Lab System| P3
  
```




---


```mermaid
flowchart TD
  ODM["ODM (ODMVersion=2.0)"]
  Study["Study (OID=S.Study123)"]
  MetaDataVersion["MetaDataVersion (OID=MDV.001)"]
  ItemDef["ItemDef (OID=IT.LBORRES, Name=LBORRES)"]
  Description["Description: Lab Test Result"]
  Origin["Origin (Type=Collected)"]
  SourceItem["SourceItem"]
  Resource["Resource: Observation"]
  Attribute["Attribute: valueQuantity.value"]
  Coding["Coding: LOINC 26464-8"]
  MethodRef["MethodRef (MT.ExtractFHIRValue)"]
  Annotation["Annotation: FHIR to SDTM conversion by Data Engineer 1"]
  MethodDef["MethodDef (MT.ExtractFHIRValue)"]
  User["User (USR.DataEngineer1)"]
  AuditTrail["AuditTrail (AT.LBORRES.12345)"]
  UserRef["UserRef: USR.DataEngineer1"]
  Location["Location: FHIR2SDTM Mapper"]
  DateTimeStamp["DateTimeStamp: 2025-05-10T12:00:00"]
  Reason["Reason: FHIR to SDTM conversion for LBORRES"]

  ODM --> Study
  Study --> MetaDataVersion
  MetaDataVersion --> ItemDef
  ItemDef --> Description
  ItemDef --> Origin
  ItemDef --> Annotation
  Origin --> SourceItem
  SourceItem --> Resource
  SourceItem --> Attribute
  SourceItem --> Coding
  Origin --> MethodRef
  MetaDataVersion --> MethodDef
  MetaDataVersion --> User
  MetaDataVersion --> AuditTrail
  AuditTrail --> UserRef
  AuditTrail --> Location
  AuditTrail --> DateTimeStamp
  AuditTrail --> Reason

```

---

---

Schemas Referenced:
[DataExchange-ODM (2.0)](https://github.com/cdisc-org/DataExchange-ODM)
[Define-XML](https://www.cdisc.org/standards/data-exchange/define-xml)
[odm-xml-v1-3-2](https://www.cdisc.org/standards/data-exchange/odm-xml/odm-xml-v1-3-2)
[fhir-all-xsd.zip](https://build.fhir.org/fhir-all-xsd.zip)


