def volumetrics(sheets): sheet = list(list(sheets)[2]) yield ["_timestamp", "service", "channel", "transaction", "volume"] header, rows = extract_transaction_rows(remove_summary_columns(sheet)) for row in rows: for data in create_transaction_data(header, row): yield data
def test_removes_summary_columns(self): sheet = [ ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ["Channel Descriptions", "", "Transaction", "Apr 2012", "2012/13 Total", "Mar 2013"], ["Assisted Digital", "Relicensing", "V-V10 Licence Application Post Office", 1000, 2000, 3000], ["", "", "V-V11 Licence Renewal Reminder Post Office", 1001, 2001, 3001], ["_", "_", "_", "_", "_", "_"], ["", "SORN", "V-V11 Some transaction", 1003, 2003, 3003], ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ["Fully Digital", "Relicensing", "V-V10 Licence Application EVL", 1006, 2006, 3006], ["", "", "V-V11 Fleets", 1007, 2007, 3007], ["", "", "V-V11 Licence Renewal Reminder EVL", 1008, 2008, 3008], ["", "", "V-V85 and V85/1 HGV Licence Application EVL", 1009, 2008, 3008], ["_", "_", "_", "_", "_", "_"], ["", "SORN", "V-V11 SORN EVL", 1011, 2011, 3011], ["", "", "V-V85/1 HGV SORN Declaration EVL", 1012, 2012, 3012], ["", "", "V-V890 SORN Declaration EVL", 1013, 2013, 3013], ["", "", "V-V890 SORN Declaration Fleets", 1014, 2014, 3014], ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ["Manual", "Relicensing", "V-V890 Another transaction", 1017, 2017, 3017], ["", "", "V-V11 Licence Renewal Reminder Local Office", 1018, 2018, 3018], ["", "", "V-V85 and V85/1 HGV Licence Application", 1019, 2019, 3019], ["_", "_", "_", "_", "_", "_"], ["", "SORN", "V-V11 SORN Local Office", 1021, 2021, 3021], ["", "", "V-V85/1 HGV SORN Declaration", 1022, 2022, 3022], ["", "", "V-V890 SORN Declaration", 1023, 2023, 3023], ["", "", "V-V890 SORN Declaration Key from Image", 1024, 2024, 3024], ["", "", "V-V890 SORN Declaration Refunds Input", 1025, 2025, 3025], ["", "", "V-V890 SORN Declaration Vehicles Input", 1026, 2026, 3026], ["", "", "V-V890 SORN Declaration Vehicles Triage", 1027, 2027, 3027], ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ["_", "_", "_", "_", "_", "_"], ] assert_that(remove_summary_columns(sheet), has_items( ["Channel Descriptions", "", "Transaction", "Apr 2012", "Mar 2013"], ["", "", "V-V85 and V85/1 HGV Licence Application EVL", 1009, 3008], ))