graph TD

    %% Node Definitions
    A1["A1: PDTs are not working correctly."]
    d1{"d1: Is one or more PDTs failing to build correctly?"}
    d2{"d2: Do you get an error when you manually rebuild the PDT?"}
    d3{"d3: Is the problem isolated to a single connection?"}
    d4{"d4: Is one or more of your PDTs building too frequently?"}
    d5{"d5: Are PDTs clogging up your scratch schema?"}
    d6{"d6: What is the build reason in PDT Activity dashboard?"}
    h1["h1: Check the build failure error message."]
    h2["h2: Test the connection and check scratch schema privileges."]
    h3["h3: Check for a hung regenerator."]
    h4["h4: Unknown scenario, check PDT dashboard and contact support."]
    h5["h5: Check for a hung reaper."]
    h6["h6: Change the scratch schema name for this connection."]
    h7["h7: Another user may be manually rebuilding PDTs."]
    h8["h8: Another PDT triggered this PDT to build."]
    h9["h9: The PDT was built because of a trigger or an initial build."]

    %% Connections
    A1 --> d1
    d1 -- "Yes" --> d2
    d1 -- "No" --> d4
    d2 -- "Yes" --> h1
    d2 -- "No" --> d3
    d3 -- "Yes" --> h2
    d3 -- "No" --> h3
    d4 -- "Yes" --> d5
    d4 -- "No" --> h4
    d5 -- "Yes" --> h5
    d5 -- "No" --> d6
    d6 -- "Table not in scratch schema" --> h6
    d6 -- "Manual Rebuild" --> h7
    d6 -- "Dependent PDT Build" --> h8
    d6 -- "Other" --> h9

    %% Styling

    classDef start fill:#C6DAF7,stroke:#000,stroke-width:2px,font-weight:normal;
    class A1 start

    classDef decision fill:#D8EED8,stroke:#000,stroke-width:2px,font-weight:normal;
    class d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13 decision

    classDef solution fill:#FEF6E0,stroke:#000,stroke-width:2px,font-weight:normal;
    class h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13,h14,h15 solution

    %% Click events

    click h1 href "https://cloud.google.com/looker/docs/admin-panel-database-pdts"
    click h2 href "https://cloud.google.com/looker/docs/derived-tables#persistent_derived_tables"
    click h3 href "https://cloud.google.com/looker/docs/derived-tables#the_looker_regenerator"
    click h4 href "https://cloud.google.com/looker/docs/admin-panel-database-pdts"
    click h5 href "https://cloud.google.com/looker/docs/best-practices/pdt-troubleshooting#too_many_pdts_in_scratch_schema"
    click h6 href "https://cloud.google.com/looker/docs/best-practices/pdt-troubleshooting#check_build_reason_in_pdt_activity_dashboard"
    click h7 href "https://cloud.google.com/looker/docs/best-practices/pdt-troubleshooting#check_build_reason_in_pdt_activity_dashboard"
    click h8 href "https://cloud.google.com/looker/docs/best-practices/pdt-troubleshooting#check_build_reason_in_pdt_activity_dashboard"
    click h9 href "https://cloud.google.com/looker/docs/best-practices/pdt-troubleshooting#check_build_reason_in_pdt_activity_dashboard"