MCP3008 Energy Monitoring issues

I am working on energy monitoring system based on Jetson Xavier(similar rpi), and MCP3008 chip. The sampling SPI frequency is 4Mhz and we have getting wave similar to sine wave but the problem is in finding RMS current. i have followed different methods described in this forum but nothing helps to solve… please check my circuit ,wave and help plz…

Screenshot from 2021-06-08 18-11-58