james-eda
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Understanding FHIR & Provenance Resource ...in an attempt to achieve subject-level data lineage --- [toc] --- # **What is FHIR?** * Fast Healthcare Interoperability Resources (FHIR) by HL7 * Supported by major vendors (e.g., Epic, Cerner, Apple) * Standard for healthcare data exchange based on RESTful APIs * CRUD operations (Create, Read, Update, Delete) * Supports JSON & XML formats * Designed for web-based, scale * Modular data units called "resources" * Highly extensible via extensions and profiles --- > RESTful API is an interface that two computer systems use to exchange information securely over the internet. https://aws.amazon.com/what-is/restful-api/ --- ![image](https://hackmd.io/_uploads/BJ64FM9Zlg.png) [Link](https://build.fhir.org/overview-arch.html#frameworks) --- # FHIR Resources **Definition:** Modular components that represent specific healthcare concepts. See https://build.fhir.org/resourcelist.html **Examples resources:** * `Patient`: Demographic and administrative information [Link](https://build.fhir.org/patient.html) * `Observation`: Vital signs, lab results [Link](https://build.fhir.org/observation.html) * `Medication`: Medication details [Link](https://build.fhir.org/medication.html) * `Encounter`: Interaction between patient and healthcare provider [Link](https://build.fhir.org/encounter.html) --- Each resource: * Has a unique `id` * Is accessible via REST API (`GET [base]/Patient/[id]`) * Can reference other resources (`Observation.subject → Patient`) * Can be grouped in `Bundle` for transactions or documents --- # Example: RESTful API Impact on Data Lineage ## Scenario A clinical system uses a RESTful API to transmit lab test results from an EHR to a central research database. ## Data Flow 1. **System A (EHR)** sends data via RESTful API: ```http POST /lab-results { "patient_id": "1234", "test": "Hemoglobin", "result": "13.5", "unit": "g/dL" } ``` 2. **System B (Lab Aggregator)** processes the data: - Maps `"Hemoglobin"` to standardized LOINC code `"718-7"`. - Converts units if needed. - Applies business rules (e.g., discards low-confidence entries). - Forwards processed data to System C. 3. **System C (Research DB)** receives: ```json { "patient_id": "1234", "test_code": "718-7", "result": "13.5", "unit": "g/dL" } ``` ## Problem - **System C** has no visibility into: - The original value (`"Hemoglobin"`). - The transformation logic applied. - Metadata about the API call (timestamp, sender, endpoint). - **No audit trail or transformation log** is preserved. ## Impact on Lineage - Loss of: - **Source attribution** (Who sent the data? From what system?). - **Transformation traceability** (How was `"Hemoglobin"` mapped to `"718-7"`?). - **Change auditability** (What rules or filters were applied?). ## Consequences - Inability to: - Reconstruct original data lineage. - Validate or trace back results. - Ensure transparency, reproducibility, and accountability. --- # What is Provenance? **Based on W3C Provenance Ontology (PROV-O)** ![image](https://hackmd.io/_uploads/BkY9N3KZee.png) * **Agent:** Person or system initiating activity * **Activity:** Action that generated or changed data * **Entity:** Data that was used or created **Relationships:** * `wasGeneratedBy`, `wasAttributedTo`, `used` --- ## What is the Provenance Resource? **Definition:** A FHIR resource that records the **origin, authorship, and context** of another resource. **Purpose:** * Identify WHO created, updated, or deleted data * Capture WHEN and HOW data was generated or modified * Link back to original sources (e.g., scanned forms, HL7 messages) **Applications:** * Data transformation or import (e.g., from HL7 V2 or CDA) * Trust and verification in clinical decision-making * Legal audit trails --- ## How Provenance Links to FHIR Resources **Target Field (`Provenance.target`)** * Points to one or more FHIR resources whose origin it documents * Examples: `Observation/123`, `MedicationAdministration/45` **Multi-resource Support:** * Multiple resources can be tracked in a single Provenance * Useful in batch imports or bulk operations **Practical Use:** * Every POST/PUT in a system can be paired with Provenance to maintain traceability --- # Key Fields in Provenance | Field | Description | | ------------- | --------------------------------------------------------------- | | `target` | Resource(s) being documented | | `agent` | The person/system/device that performed the activity | | `entity` | Source material used in the activity (e.g., a scanned doc) | | `recorded` | Timestamp of when the provenance was captured | | `occurred[x]` | When the actual activity took place (can be DateTime or Period) | | `reason` | Justification for the activity | | `activity` | Describes the action taken (e.g., creation, update, import) | | `signature` | Cryptographic signature (optional) | --- ## Capturing Who, What, When, How **Who:** `agent.who` — Practitioner, Patient, Device, Organization **What:** `target` — FHIR resource being tracked **When:** `occurredDateTime` or `occurredPeriod`, and `recorded` **How:** `activity`, `agent.type`, `entity.role` --- ## Example of Tracing a Lab Result **Use Case:** Trace the origin of a Hemoglobin lab result (`Observation/123`) **Provenance Fields:** * **Agent:** Practitioner/Dr. Smith (`agent.who`) * **Activity:** Entry from Lab System (`activity = record`) * **Entity:** Source system `Binary/hl7v2message` or DocumentReference * **Target:** `Observation/123` **Insight Gained:** You know who entered the lab value, when, and using what source. --- ## Chained Provenance Support **What is Chaining?** * Multiple Provenance records referencing each other via `entity` and `target` * Useful when a derived resource is created from another FHIR resource or external content **Example:** * Step 1: HL7 V2 message → Provenance A → Patient resource * Step 2: Patient → Provenance B → Derived QuestionnaireResponse **FHIR Supports** via multiple Provenance instances, only **Challenges:** * Requires careful modeling * Visualization and debugging may be complex --- ## Limitations of Provenance | Limitation | Details | | -------------------- | ----------------------------------------------------------------------- | | Version Handling | Hard to create version-specific reference before creation | | HTTP Header Limits | `X-Provenance` header size may exceed server limits | | Server Inconsistency | Not all FHIR servers support recording or interpreting provenance | | Real-time Capture | Not equivalent to full real-time audit logging | | Chain Management | Tracing across multiple layers (import → transform → create) is complex | --- h/t Trinath Panda ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully