welcome to the community @priya_joshi.
As always at this forum, provide the small representative sample of the input data - the one that would allow the YOU (and us) to thoroughly test any potential solution.
No ....
for "missing data", small, but set of data covering any edge cases, e.g. in you case does input contain multiple "module" blocks, etc...
Also, as always post your sample input/output data and any personal attempts at solving your issue using markdown code tags. The description of these "markdown code tag" are linked in the welcome page of the forum portal.
And more importantly, please share any of your own attempts at solving the issue - this will "guide us" at helping you.