[Unsupported] Progress Chart Script

Basically, I assign points per item per level. Lower levels are worth more points. Here’s my list of points (from my personal notes):

// Level 0: Paused / 0T- Lessons
// Level 1: 4h / 6T- Apprentice
// Level 2: 8h / 3T - Apprentice
// Level 3: 23h / 1.04T - Apprentice
// Level 4: 47h / 0.51T - Apprentice --> Guru
// Level 5: 167h / 0.14T - Guru
// Level 6: 335h / 0.07T - Guru --> Master
// Level 7: 719h / 0.03T - Master --> Enlightened
// Level 8: 2879h / 0.01T - Enlightened --> Burned
// Level 9: Paused / 0T -Burned

The ratios are what’s important, not what exactly the points is. But essentially the points tell you how much time you will be spending on the item, on average, during the next let’s say day, compared to other items. So if I have ten apprentice one items, they are worth 60 points. Ten enlightened items are worth 0.1 points. You can read a bit more about the algorithm on my script page. It is possible to use these numbers to gauge how burdened your WK day is, and to adjust your learning speed with real numbers.

The actual logic (pseudocode but copied sloppily) for printing the numbers is:

for (var i = 13; i < tlength+11; i++) {
    cell.offset(1,i).setValue((total_srs[i-12]*danger[i-12])/2);
 } // This basically prints a value for each of the levels in fields along the row.

where:
var tlength = total_srs.length; // this finds out how many items are in the array iirc.
var total_srs[] = wkDataIterate() // this builds an array of numbers of items per level from apprentice to enlightened.
var danger = [0, 6, 3, 1.04, 0.51, 0.14, 0.07, 0.03, 0.01, 0]

The chart is a 100% stacked area chart, which shows the ratios day by day. I found it interesting to see if my main burden is apprentice items, or guru items, or even enlightened items. It will depend on how many items you add per day.

I’m sorry if anything is unclear. I tried to explain as well as I could.

The actual actual code is:

Summary
// Level 0: Paused / 0 GGE - Lessons
// Level 1: 4h     / 6 GGR - Apprentice
// Level 2: 8h     / 3 GGR - Apprentice
// Level 3: 23h    / 1.04 GGR - Apprentice
// Level 4: 47h    / 0.51 GGR - Apprentice --> Guru
// Level 5: 167h   / 0.14 GGR - Guru
// Level 6: 335h   / 0.07 GGR - Guru --> Master
// Level 7: 719h   / 0.03 GGE - Master --> Enlightened
// Level 8: 2879h  / 0.01 GGE - Enlightened --> Burned
// Level 9: Paused / 0 GGE -Burned

var apikey = '4185e81b-c0f5-4e69-ac5b-5fe4420cf1c8';
var danger = [0, 6, 3, 1.04, 0.51, 0.14, 0.07, 0.03, 0.01, 0]
var sheet = SpreadsheetApp.getActiveSheet();

function statisticsPrint() {
  var cell = sheet.getRange(sheet.getLastRow(),1);
  var total_srs = wkDataIterate();
  var tlength = total_srs.length;
  cell.offset(1,0).setValue(new Date());
      for (var i = 1; i < tlength; i++) {
       cell.offset(1,i).setValue(total_srs[i]);
    }
        for (var i = 13; i < tlength+11; i++) {
       cell.offset(1,i).setValue((total_srs[i-12]*danger[i-12])/2);
    }
  
}

function dangerPrint() {
  var basecell = sheet.getRange(2,1);
  var total_srs = wkDataIterate();
  var tlength = total_srs.length
  var calc_danger = 0
  
    for (i = 0; i < tlength; i++) {
       basecell.offset(0,i).setValue(total_srs[i]);
       calc_danger += total_srs[i] * danger[i]
    }
  basecell.offset(0,10).setValue(calc_danger / 2);
}

function wkDataIterate() {
    var total_srs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    tlength = total_srs.length

    for (i = 0; i < tlength; i++) {
        total_srs[i] = wkDataGet(i).total_count

        if (total_srs[i] == null) {
            total_srs[i] = 0
        } 
    }
  return total_srs
}

function wkDataGet(srsLevel) {
    var headers = {
        'Authorization': 'Token token={' + apikey + '}'
    };

    var options = {
        'headers': headers,
        'Cache-Control': 'max-age=0, must-revalidate',
        'muteHttpExceptions': true,
    };
    var wkData = UrlFetchApp.fetch("https://www.wanikani.com/api/v2/assignments?srs_stages=" + srsLevel, options).getContentText();
    var wkDataSerialized = JSON.parse(wkData);
  
    return wkDataSerialized;
}

(I have since changed my api key.)

Doesn’t this basically do what you want? Just with not as much data.

1 Like

Part of the reason I rolled my own is that the chart you linked uses API v1. This API is supposed to be sunset (whatever that means), and I’m not sure if I would want any long term projects running on it.

I stole the charting idea from it though!

Ah, I forgot about that. :frowning: Maybe someone will generously update the script to v2 for everyone.

It feels like that’s kind of what hitechbunny wants to do in this thread!

Okay! Anyone can now use the CORS-friendly URL here to download their history of SRS level counts (and leech counts)
by visiting https://wanikanitools-golang.curiousattemptbunny.com/srs/status/history.csv?api_key=YOUR_V2_API_KEY. Of course this is only populated with data if you use [Unsupported] Dashboard Userscript: Leech, Apprentice, and Guru detail (aka SRS level progress).

I only just started recording this information, so it will be historic data from now onwards. What to see what this looks like? If you visit the URL without an api_key parameter then it will show you data for my user, hitechbunny:

https://wanikanitools-golang.curiousattemptbunny.com/srs/status/history.csv

The content of the file looks like this:

UTCDateTime,EpochSeconds,UserLevel,Total,LeechTotal,Apprentice1,Apprentice2,Apprentice3,Apprentice4,Guru1,Guru2,Master,Enlightened,Burned,LeechApprentice1,LeechApprentice2,LeechApprentice3,LeechApprentice4,LeechGuru1,LeechGuru2,LeechMaster,LeechEnlightened,LeechBurned
2017-10-24 15:51:38,1508860298,6,671,24,0,1,1,3,35,102,206,323,0,0,1,1,3,6,10,3,0,0

You can see where those numbers are in the corresponding dashboard view:

image

To further illustrate, I just did a review:

So my updated dashboard looks like this:

image

And likewise my history csv is:

UTCDateTime,EpochSeconds,UserLevel,Total,LeechTotal,Apprentice1,Apprentice2,Apprentice3,Apprentice4,Guru1,Guru2,Master,Enlightened,Burned,LeechApprentice1,LeechApprentice2,LeechApprentice3,LeechApprentice4,LeechGuru1,LeechGuru2,LeechMaster,LeechEnlightened,LeechBurned
2017-10-24 15:51:38,1508860298,6,671,24,0,1,1,3,35,102,206,323,0,0,1,1,3,6,10,3,0,0
2017-10-24 15:57:36,1508860656,6,671,24,0,1,1,3,35,102,206,323,0,0,1,1,3,6,10,3,0,0
2017-10-24 15:57:38,1508860658,6,671,24,0,1,1,3,35,102,206,323,0,0,1,1,3,6,10,3,0,0
2017-10-24 15:59:12,1508860752,6,671,24,0,1,1,3,34,103,205,324,0,0,1,1,3,6,10,3,0,0

I’m not doing anything to eliminate duplicate lines yet. You get the idea, I hope.

Let me know if you have questions. I’d love for someone to do something with this in some way. :smiley:

1 Like

I’ve put something together. What do you all think? See animated gif:

I have more information to show (leech total, and leech totals by SRS stage). I’m not sure how to show it. Thoughts welcome.

5 Likes

Genuinely impressed.

This would be an instant installation for me.

Seems to be motivating !

I’ve published this script and updated the OP with details. You can get the “Progress Chart” script from the App Store script.

Looking good!

A data import, for those of us that have some data but arrived late to the party, would be great.

Otherwise, I’ll have to wait until I have some data to show before I can see how it looks.

2 Likes

Any update on this?
I just found out about this and it would be nice if i could show the data from level 1 to current.
Nice script either way!

Suddenly stopped working today for me.
I didn’t change any settings/installed new scripts.

The space where the progress chart is supposed to go is just an empty space now.
It seems the dev isn’t around anymore, so I hope someone else will start maintaining this in the future, I really like having this.

EDIT: the website linked in OP’s post is no longer working, so I assume that has something to do with it. Seems it was taken offline :frowning:
more info here https://github.com/curious-attempt-bunny/wanikanitools

Yeah, I see what you mean, it is empty for me too :cry:

I like this script a lot. I was expecting this to happen eventually since @hitechbunny is not around anymore but I would hoping it would just “magically” continue to work. Maybe we are lucky and the server goes back up at some point.

It will be difficult to maintain this one without his server doing all the work in the background.

I just opened an issue on his github page asking if its permanent or a temporary hiccup. fingers crossed

2 Likes

I think that all the scripts by @hitechbunny stopped working :frowning:

Both the review leech script and the SRS level progress script aren’t working D:

1 Like

They all worked fine until yesterday for me. I guess it might have to do with them not getting any data from the wanikanitools site.
I already messaged some friends that might be able to maintain this. will see how it goes i guess.

1 Like

They won’t have the historical data from the original site though. Let’s see if he responds on github. Or maybe we are lucky and it is just a temporary outage. It is not the first one as far as I remember.

Even if the server has been shutdown, usually the data are not erased at once.

Yes but the original creator would have to be respnsive and willing to hand it over. He seems to be very busy or has lost interest. We‘ll see… :frowning: