If I could be naughty and do a hijack, I have also perhaps been overthinking this and not getting anywhere.
I have built a bagging machine and thought it would be nice to give the guy's a way of keeping tab's on it.
It runs on an ESP and when one of the scales tip it writes to a .csv file like this, date/time then the number of bags for today.
Code:
1552334967,25,
1552334973,26,
1552338975,1,
1552338983,2,
1552338987,3,
1552338989,4,
1552338990,5,
I then use that and display it(on a webpage) nicely on a graph and it looks awesome

. Then our dear friends at Eskom **** around with the power and my counter gets reset.
So I thought, ok fine, let the graph look funny, I will just add a counter for today's and yesterday's production, because I just have to count the number of times a day appears in the array, choose yesterday and today, count and display.
But I have not succeeded (probably very silly attempts) with anything I have tried.
This was my starting point.
JavaScript:
function parseCSV(string) {
var array = []
var lines = string.split("\n");
for (var i = 0; i < lines.length; i++) {
var data = lines[i].split(",", 2);
data[0] = new Date(parseInt(data[0]) * 1000);
data[1] = parseFloat(data[1]);
array.push(data);
}
return array;

What it looks like now is too disgusting to publish!
Both ends( ie. what gets written to the file and what runs on the client) are under my control and can be changed, however if I change the .csv I will have to fix the graph portion

(and that took me a long time to do.)
Is what I'm trying to do possible? should I put it in a JSON format and parse it out ? or perhaps something else?
I would prefer not to have to many writes to the ESP and obviously space is at a premium.