The complexity of cancer care requires planning and analysis to achieve the highest level of quality. We aim to measure the quality of care provided to patients with non-small cell lung cancer (NSCLC) using the data contained in the hospital's information systems, in order to establish a system of continuous quality improvement. Retrospective observational cohort study conducted in a university hospital in Spain, consecutively including all patients with NSCLC treated between 2016 and 2020. A total of 34 quality indicators were selected based on a literature review and clinical practice guideline recommendations, covering care processes, timeliness, and outcomes. Applying data science methods, an analysis algorithm, based on clinical guideline recommendations, was set up to integrate activity and administrative data extracted from the Electronic Patient Record along with clinical data from a lung cancer registry. Through data generated in routine practice, it has been feasible to reconstruct the therapeutic trajectory and automatically calculate quality indicators using an algorithm based on clinical practice guidelines. Process indicators revealed high adherence to guideline recommendations, and outcome indicators showed favorable survival rates compared to previous data. Our study proposes a methodology to take advantage of the data contained in hospital information sources, allowing feedback and repeated measurement over time, developing a tool to understand quality metrics in accordance with evidence-based recommendations, ultimately seeking a system of continuous improvement of the quality of health care.