graph LR
    subgraph USER["User/Provider (Source Table)"]
        id["id"]
        name["name"]
        email["email"]
        city["city"]
        state["state"]
        neighborhood["neighborhood"]
        phone_number["phone_number"]
        is_allowed["is_allowed"]
        accept_tcle["accept_tcle"]
        created_at["created_at"]
        updated_at["updated_at"]
    end

    subgraph Provider["OMOP: Provider"]
        prov_provider_id["provider_id 🔑"]
        prov_name["provider_name"]
        prov_source_value["provider_source_value"]
    end

    subgraph Location["OMOP: Location"]
        loc_location_id["location_id 🔑"]
        loc_city["city"]
        loc_state["state"]
        loc_address_1["address_1"]
    end

    subgraph Custom["Custom: ProviderNonClinicalInfos"]
        c_id["id"]
        c_email["email"]
        c_phone_number["phone_number"]
        c_is_allowed["is_allowed"]
        c_accept_tcle["accept_tcle"]
        c_created_at["created_at"]
        c_updated_at["updated_at"]
    end

    %% PROVIDER mappings
    id -->|"row_provider"| prov_provider_id
    name -->|"row_provider"| prov_name
    email -->|"row_provider"| prov_source_value

    %% LOCATION mappings
    city -->|"row_location"| loc_city
    state -->|"row_location"| loc_state
    neighborhood -->|"row_location"| loc_address_1

    %% Custom mappings
    id --> c_id
    email --> c_email
    phone_number --> c_phone_number
    is_allowed --> c_is_allowed
    accept_tcle --> c_accept_tcle
    created_at --> c_created_at
    updated_at --> c_updated_at

    %% location_id propagation
    loc_location_id --> prov_provider_id

    style USER fill:#e1f5ff
    style Provider fill:#fff4e1
    style Location fill:#fff4e1
    style Custom fill:#f5e1ff