BryceStevenWilley / visioning_texts

A D3 project that locally visualizes your messages from Signal or Whatsapp
GNU General Public License v3.0
37 stars 6 forks source link

Issue visualizing the data #3

Closed zabaio closed 4 years ago

zabaio commented 4 years ago

Hi Bryce, I come from you post on Reddit too, it seems to have troubles analyzing/visualizing the data. Maybe the code doesn't support dd/mm/yy dates? My format is, in fact dd/mm/yy, hh:mm - Name: Text This is what i get: Screenshot_2020-01-20 Visioning Messages

LuanCiribelli commented 4 years ago

I'm having the same issue, i tought it was because I'm using portuguese data and it makes sense that It could be an date format issue

KirkBuah commented 4 years ago

Same issue here, i've tried with different files but i have the same problem with all of them.

BryceStevenWilley commented 4 years ago

This is absolutely correct: I only handle mm/dd/yyyy. Definitely should have expected some international audience when I posted it to Reddit. 😅

I'll take a look at handling this, likely it'll have to take user input on what the date format is to resolve ambiguities like 1/2 being January 2nd or February 1st.

zabaio commented 4 years ago

So, I swapped day and month in my file to see if it would work, and it's almost there. As you can see it works great except for "word use difference" and "words/characters per text". I also would suggest to use mm/yy below the main graph since if the chat is old enough months names start overlapping. One last thing, while I was looking at the txt i noticed that, at least in my case, forwarded messages have newlines in them. Maybe it's not a problem or you have already taken it into account, but I thought I should point it out. immagine

maartenwiegers commented 4 years ago

For those with a similar date formatting issue (my Whatsapp export has dd/MM/yyyy, hh:mm), I've replaced the original line 42-43 in math.js with

let dateParts = time_str.split("/");
return {'name' : name_str.trim().split(' ')[0], 'BODY' : msg_str.trim(),
                'date' : new Date(+dateParts[2].split(',')[0], dateParts[1] -1, +dateParts[0], dateParts[2].split(',')[1].split(':')[0], dateParts[2].split(',')[1].split(':')[1])};

Then it works completely for me :)

Vidhin05 commented 4 years ago

If if your line looks like [DD/MM/YY, HH:mm:ss] Name: ‎TEXT Change 37 and 38 in math.js to

let dash_idx = l.indexOf(']');
let time_str = l.slice(1, dash_idx);

I changed from dd/mm/YYY to mm/dd/YYYY too using @maartenwiegers and I'm getting

Uncaught TypeError: Cannot read property 'texts' of undefined
    at math.js:101
    at Array.reduce (<anonymous>)
    at xy_time_of_day (math.js:100)
    at graphs.js:485
IMG20191023 commented 4 years ago

Using some trickery for testing i changed my phone location to USA and did the whatsapp export again and it fixed up the date. What i found was importing <20k lines worked fine, but any data above that amount it started to cause issues like @illbekeen above. The chat file i would like to eventually put through this amazing little script is 60k lines.

htkcodes commented 4 years ago
 let full_data = lines.map(function(l) {

        let dash_idx = l.indexOf(']');
        let time_str = l.slice(0, dash_idx);
        let rest_str = l.slice(dash_idx + 1);
        let colon_idx = rest_str.indexOf(':');
        let name_str = rest_str.slice(0, colon_idx);
        let msg_str = rest_str.slice(colon_idx + 1);
        let dateparts=time_str.split('/');

  let day=dateparts[0].split('[')[1];
  let month=dateparts[1];
  let yr="20"
  let year=dateparts[2].split(",")[0];

  let fullyear=yr.concat(year);
let hour=dateparts[2].split(",")[1].split(":")[0];
let minute=dateparts[2].split(",")[1].split(":")[1];
let seconds=dateparts[2].split(",")[1].split(":")[2].split(" ")[0];
let meridian=dateparts[2].split(",")[1].split(":")[2].split(" ")[1];
let date =`${day}/${month}/${fullyear} ${hour}:${minute} ${meridian}`
        return {'name' : name_str.trim().split(' ')[0], 'BODY' : msg_str.trim(),
                'date' : new Date(date)};
    });

My fix for iphone exports for whatsapp.

Replace full_data function on line 36. to fix for IPHONES!

BryceStevenWilley commented 4 years ago

@htkcodes can you take a look at things post https://github.com/BryceStevenWilley/visioning_texts/commit/d074635050e819f6be70d1fb0a465b52328d7864 and let me know if it works without your change?

htkcodes commented 4 years ago

@BryceStevenWilley Got "The input file has an ambigious date format. TODO(brycew): fix"

Vidhin05 commented 4 years ago

@BryceStevenWilley https://github.com/BryceStevenWilley/visioning_texts/commit/799f6e84709af7696ff22de0c3b60574a5272c95 Works like a charm, thank you for such a quick fix!

biejay commented 4 years ago

Works great, thanks @BryceStevenWilley! (FYI: Confirm for german layout)

LuanCiribelli commented 4 years ago

@BryceStevenWilley

image

I thought it was because the txt are to big, but even when I use one with less than 2 mega it just does this

BryceStevenWilley commented 4 years ago

Hey all, I think the issues talked about here are mostly fixed. If you're still having problems, check out #2 or #6, or make another issue. Gonna close this one for now.