We present a visual summary of case/control cohort construction, PheNet model training, and application within a discovery dataset at UCLA Health. (A) The workflow for constructing a case cohort of clinically diagnosed patients with CVID from medical charts. (B) Criteria used to create a matched control cohort from the EHR (n = 1106). (C) Construction of the prediction model, including feature selection from phecodes, inclusion of laboratory values, a variety of inference frameworks, and data balancing techniques. (D) Example of how the PheNet model can be applied within a discovery cohort to identify patients with a high likelihood of CVID, who could then be further assessed by manual chart review to confirm diagnosis.