580 Background: Measurements of cancer care quality are critical for internal administration and participation in value-based care programs, towards the goal of improving patient outcomes. Data from electronic health records (EHRs) have the potential to allow for automatic computation of quality measures at a larger scale than manual chart review. This requires the creation of algorithms that process data and apply custom logic to define a clinically meaningful measurement. In this work, we describe the development and performance of an algorithm for deriving time from first primary oncologist visit to first cancer treatment using EHR data. Methods: This EHR-derived measure of time to first treatment (TTT) was implemented at an academic medical center for all patients who had a visit since 01/01/2011 and a cancer-related diagnosis code. We defined a patient’s primary oncologist as the first medical oncologist who they visited at least 5 times. These criteria were chosen to find the first provider at the site who the patient likely established care with and received treatment from. Then the patient’s TTT is computed as the number of days between their first visit date with this oncologist and the date of their first antineoplastic drug administration. Data on other treatment modalities, such as surgery and radiation therapy, were not available at the time of algorithm development. We allow for patients to receive their first treatment up to 60 days before their first visit to account for inpatient treatments before a primary outpatient oncologist is established. This algorithm’s performance was assessed through manual chart review among a sample of 38 patients. Results: Our algorithm correctly assigned 37 out of 38 patients (97.4%) to their primary oncologist, and computed the correct TTT for 28 out of 38 patients (73.4%). Incorrect TTT computations were mostly due to missingness of systemic therapy administrations in the structured EHR data; these were primarily for oral therapies. Conclusions: This work demonstrates the feasibility of measuring a patient’s TTT from structured EHR data alone. In particular, a patient’s initial visit with their primary oncologist can be derived with high accuracy. From this index date, the accuracy of the metric is dependent on the availability of structured treatment data. To further improve the EHR-derived metric, future work should incorporate other treatment modalities through structured data sources such as billing codes, and improve completeness of systemic therapy data in a scalable way, such as from natural language processing techniques.[Table: see text]