Programming 'https://www.smogon.com/stats/yyyy-mm/' file to .json converter

EDIT: This project has been mostly finished as of now. The GitHub Project is linked below, but please bear in mind that it also has a wiki on how this package works.

A couple of days ago I asked in this reddit post on the wrong place if .json compatibility would be possible with the moveset-usage files on smogon.stats.
It was honestly quite good that there was no traction behind it, as it inspired me to make something of my own.
Here is the GitHub project for it. It's an importable python file with functions in it to both request and convert the files into usable JSON compatible dictionaries.
I have already rooted out some of the issues that were in it, but there are probably some more (though most likely easily fixable) which turns this:

into this:


There were still some slight issues I ran into during the creation of this, which I have put on the GitHub project's main and wiki page, as well have I opened an issue on it.

Now this is of course only in Python (and probably not perfect). I'd like to start refining this and maybe (help) porting this over to other languages, or possibly even plug it into the site itself.
I reckon it would be very useful to have this as an endpoint for get-requests as that would skip having to port it over to many other languages entirely.

I will probably start making it compatible with other files as well in the near future, which I can then either put in a new file in the same repo or in the same one.
Thanks for reading, have a nice day :)
 
Last edited:
I have started working on other types of files as well, with /leads/ being done as well.
I have also implemented a simple builtin function that turns the dict into a json usable by all language's json packages.
I'll probably keep expanding it while I'm not completely insane quite yet.
Knipsel.PNG
Knipsel.PNG

and of course I'll add wiki documentation for all of it.
 
I have just.. come across the /chaos/ section.. welp
seems I was quite hasty. Though I can be happy about something: the information seems to be worse. or at least, in my opinion.
Knipsel.PNG
This just doesn't cut it in my opinion.
Also my setup of the move's section is more practical IMO, as it's sorted by usage (high-low) and doesn't quite the move's name as a dict[key] which is nice
Knipsel.PNG

So I will keep working on it until I'm done with it, only to expand it when there needs to be. (oh and ofc update when needed)
 
I finished the 'general' files converter as well, which turns this:
Knipsel.PNG

into this:
Knipsel.PNG

which means I have everything but /metagame/ 's 'stalliness' statistics done. I don't know when those will be done, but I'll see.
 
Even that is implemented now.
That should be it for now, I cannot find other types of files except /chaos/ but that's already .json so I don't have to meddle with that.
Use if you please, and if anything goes wrong feel free to open an issue or send a pull request. or just dm me that works too I hope.
 
Last edited:
What do you mean by that, what are the difference except the values' order?
Mons instead of listed are dictionary keys, and the moves dict-key naming also puts me off.
There are big key-naming differences between Mons and things that are not mons and I prefer my solution to the 'checks and counters' data as the numbers are instead sorted into dicts instead of a list, with more numbers being available that are in the /moveset/ files and while it does not contain things like all spreads, it does have the most popular ones.

It's fine to disagree with me but I personally heavily prefer the way I structured the data than how Smogon did it.

Edit: If I'm looking for a mon's top 10 most used moves I'd rather not loop through a complete database of possible moves to put in as a dict to sort them, I'd rather just have them in a list, in order.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top