mrtolkien / leaguepedia_parser

A parser for the Leaguepedia website, focused on gathering esports data.
MIT License
71 stars 18 forks source link

Added *.ipynb to gitignore, updated readme, change help verbage #2

Closed maxnumbers closed 4 years ago

maxnumbers commented 4 years ago

@mrtolkien I used black formatting this time, so I'm not sure why it changed the spacing/indentation on certain lines, but here's the changes/info for this pull request:

maxnumbers commented 4 years ago

Sidenote: What do you think of the following for game_parser.py in reference to "TODO Make that more beautiful"

def _add_game_players(game: LolGame, add_page_id: bool) -> LolGame:
    """Joins on PlayersRedirect to get all players information.
    """
    # TODO Make that more beautiful, not satisfied with black’s formatting
    agp_str = [
        [
            "ScoreboardGames, ScoreboardPlayers, PlayerRedirects, Players",
            ", _pageData = PD",
        ],
        ["ScoreboardGames.UniqueGame = ScoreboardPlayers.UniqueGame, "],
        ["ScoreboardPlayers.Link = PlayerRedirects.AllName, "],
        [
            ", Players._pageName = PD._pageName",
            "PlayerRedirects._pageName = Players._pageName",
        ],
        [", PD._pageID=pageId"],
        [
            "ScoreboardGames.UniqueGame = '{game['sources']['leaguepedia']['uniqueGame']}'"
            "AND PD._isRedirect = 0",
        ],
    ]

or

def _add_game_players(game: LolGame, add_page_id: bool) -> LolGame:
    """Joins on PlayersRedirect to get all players information.
    """
    # TODO Make that more beautiful, not satisfied with black’s formatting
    agp_str = [
        "ScoreboardGames, ScoreboardPlayers, PlayerRedirects, Players",
        ", _pageData = PD",
        "ScoreboardGames.UniqueGame = ScoreboardPlayers.UniqueGame, ",
        "ScoreboardPlayers.Link = PlayerRedirects.AllName, ",
        ", Players._pageName = PD._pageName",
        "PlayerRedirects._pageName = Players._pageName",
        ", PD._pageID=pageId",
        "ScoreboardGames.UniqueGame = '{game['sources']['leaguepedia']['uniqueGame']}'"
        "AND PD._isRedirect = 0",
    ]

or

    agp_ln1 = [
        "ScoreboardGames, ScoreboardPlayers, PlayerRedirects, Players",
        ", _pageData = PD",
    ]
    agp_ln2 = [
        "ScoreboardGames.UniqueGame = ScoreboardPlayers.UniqueGame, ",
    ]
    agp_ln3 = [
        "ScoreboardPlayers.Link = PlayerRedirects.AllName, ",
    ]
    agp_ln4 = [
        ", Players._pageName = PD._pageName",
        "PlayerRedirects._pageName = Players._pageName",
    ]
    agp_ln5 = [
        ", PD._pageID=pageId",
    ]
    agp_ln6 = [
        "ScoreboardGames.UniqueGame = '{game['sources']['leaguepedia']['uniqueGame']}'"
        "AND PD._isRedirect = 0",
    ]

I think they're all pretty... not pretty... but the last option seems okay.

mrtolkien commented 4 years ago

Looks better with the tests passing!

I’ll take a look at it later, but I’ll likely have to revert your change in get_games since it uses the tournament "overview page" field and not name. The doc was not properly updated, but not the variable name!

maxnumbers commented 4 years ago

Ahhhhh I get it now, yeah I was definitely wrong on that change.

I think I got confused because I was mostly working with the test file, and the list name with overview pages was "tournament_names".

maxnumbers commented 4 years ago

@mrtolkien when you redo the README.md, if you include a To-Do list for the parser of things you'd like worked on (similar to the one in lol-dto), I'll work on them. I'm currently working through the ones you already had listed as commented "TODO".

I'm kinda trying to help out with the parser, and other data gathering tools you've started the work for, as a means of contributing to the data science community for LoL while improving my basic python skills.

mrtolkien commented 4 years ago

Will do! I think the most pressing thing is to add functions to query other tables on Leaguepedia. I don’t personally use things like standings, schedule, and so on and so forth, but having easy access to them in python is definitely convenient for some people!