US 12,130,845 B2
Method and system for validation of calculation code against calculation specification
Advaita Abhijit Datar, Pune (IN); Amey Zare, Pune (IN); Asia Akhtar, Hyderabad (IN); Venkatesh Ramanathan, Pune (IN); Shrawan Kumar, Pune (IN); Ulka Aniruddha Shrotri, Pune (IN); Suresh Bhaskaramurthy, Chennai (IN); Punyakoti Sathish, Chennai (IN); and Kannan Dhanasekaran, Chennai (IN)
Assigned to TATA CONSULTANCY SERVICES LIMITED, Mumbai (IN)
Filed by Tata Consultancy Services Limited, Mumbai (IN)
Filed on Jan. 11, 2023, as Appl. No. 18/153,192.
Claims priority of application No. 202221004590 (IN), filed on Jan. 27, 2022.
Prior Publication US 2023/0237078 A1, Jul. 27, 2023
Int. Cl. G06F 16/28 (2019.01); G06F 40/18 (2020.01)
CPC G06F 16/288 (2019.01) [G06F 40/18 (2020.01)] 3 Claims
OG exemplary drawing
 
1. A processor implemented method, comprising:
receiving, via one or more hardware processors, a calculation specification comprising one or more input fields, one or more output fields, and a plurality of intermediate calculations, wherein the calculation specification is a workbook with one or more spreadsheets linking the one or more input fields and the one or more output fields;
generating, via the one or more hardware processors, a schema from the calculation specification by parsing each of the one or more spreadsheets, wherein the generation of the schema further comprises:
constructing a directed graph comprising a plurality of nodes corresponding to each of a plurality of cells in the one or more spreadsheets and a plurality of directed edges connecting each pair of nodes among the plurality of nodes which represent relation between the corresponding cells;
classifying each of the plurality of nodes as: (i) input field if the node has no incoming edge and one or more outgoing edges, (ii) output field if the node has one or more incoming edges and no outgoing edge, and (iii) intermediate calculation if the node has one or more incoming edges and one or more outgoing edges;
identifying data source of each of the plurality of nodes from the calculation specification; and
generating the schema as a Comma Separated Value (CSV) file comprising a plurality of entries corresponding to the plurality of nodes, wherein each of the plurality of entries comprise: (i) type of field which is one of: an input field and an output field, (ii) cell identifier (ID) of the field, (iii) data source of the field which is one of: a database and an Application User Interface (App UI), and (iv) a data type of value of the field;
retrieving, via the one or more hardware processors, data related to the one or more input fields from data source mentioned in the schema and data related to the one or more output fields from a calculation code;
executing, via the one or more hardware processors, the plurality of intermediate calculations based on the data related to the one or more input fields to obtain calculated values of the one or more output fields;
comparing, via the one or more hardware processors, the calculated values of the one or more output fields with the retrieved data related to the one or more output fields to validate calculation code against the calculation specification; and
displaying, via the one or more hardware processors, result of comparison for each of the one or more output fields as one of: (i) ‘pass’ if the calculated value of an output field among the one or more output fields is equal to retrieved data related to the output field and (ii) ‘fail’ if the calculated value of an output field among the one or more output fields is not equal to retrieved data related to the output field and highlighting the output field in the calculation specification to assist in debugging the calculation code.