CREATE TABLE item_map (item TEXT, concept TEXT, priority INTEGER, why TEXT);
INSERT INTO item_map VALUES
('cost_of_revenue', 'CostOfRevenue', 1, 'the usual tag for total cost of revenue'),
('cost_of_revenue', 'CostOfGoodsAndServicesSold', 2, 'used instead by filers such as Salesforce; same line'),
('gross_profit', 'GrossProfit', 1, 'reported gross profit; if absent it is computed as revenue less cost of revenue'),
('sm', 'SellingAndMarketingExpense', 1, 'sales and marketing as its own line'),
('ga', 'GeneralAndAdministrativeExpense', 1, 'general and administrative as its own line'),
('sga', 'SellingGeneralAndAdministrativeExpense', 1, 'combined SG&A; used for S&M + G&A only when the two are not split'),
('rd', 'ResearchAndDevelopmentExpense', 1, 'research and development'),
('rd', 'ResearchAndDevelopmentExpenseExcludingAcquiredInProcessCost', 2, 'same line, tagged without acquired in-process R&D'),
('opex', 'OperatingExpenses', 1, 'total operating expenses, used only as a cross-check'),
('operating_income', 'OperatingIncomeLoss', 1, 'GAAP operating income (loss)'),
('sbc', 'ShareBasedCompensation', 1, 'stock comp added back in the cash flow statement: the full-year total'),
('sbc', 'AllocatedShareBasedCompensationExpense', 2, 'stock comp expense from the notes, when the cash flow line is not tagged');