graph LR
    subgraph TR["TrackingRecords (Source Table)"]
        tracking_record_id["tracking_record_id"]
        image_id["image_id"]
        observations["observations"]
        created_at["created_at"]
        updated_at["updated_at"]
    end

    subgraph ObsTracking["OMOP: Observation (MIH Tracking)"]
        ot_observation_id["observation_id 🔑"]
        ot_concept["observation_concept_id 🔑<br/>(CID_MIH_TRACKING)"]
        ot_date["observation_date"]
    end

    subgraph NoteObs["OMOP: Note (Observations)"]
        no_concept["note_class_concept_id 🔑<br/>(CID_NOTE_TRACKING)"]
        no_text["note_text"]
        no_date["note_date"]
    end

    subgraph FR["OMOP: Fact_Relationship (Tracking ↔ Image)"]
        fr_domain1["domain_concept_id_1"]
        fr_fact1["fact_id_1"]
        fr_domain2["domain_concept_id_2"]
        fr_fact2["fact_id_2"]
    end

    subgraph Internal["Custom: PatientNonClinicalInfos"]
        internal_ctrl["updated_at"]
        ct_image_id["image_id"]
    end

    %% OBSERVATION mappings
    tracking_record_id -->|"row_observation"| ot_observation_id
    created_at -->|"row_observation"| ot_date

    %% NOTE mappings
    observations -->|"row_note"| no_text
    created_at -->|"row_note"| no_date

    %% FACT_RELATIONSHIP mappings
    image_id -->|"row_fact_relationship"| fr_fact2

    %% NOT MAPPED
    updated_at --> internal_ctrl
    image_id --> ct_image_id

    %% observation_id propagation to FR
    ot_observation_id --> fr_fact1

    style TR fill:#e1f5ff
    style ObsTracking fill:#f5e1ff
    style NoteObs fill:#f5e1ff
    style FR fill:#f5e1ff