Package: lol-dto
LoL Game DTOA unified Data Transfer Object for League of Legends games. Currently developed by Tolki.2.0 note and JSON serializationVersion 2.0 moved the implementation fromTypedDicttodataclass, which means the syntax changed and is not
backwards compatible.dataclasses.asdict()can be used to get the object as a dictionary, and then saved as a JSON.Fields can be omitted when not supplied to make the object lighter. This is particularly useful for Snapshots objects.MotivationLeague of Legends game information can come in many forms. The most popular source is Riot’s API and in particular itsMATCH-V5endpoint, which defines its own MatchDto
and MatchTimelineDto objects. While other sources of information could follow Riot’s data format, requiring
multiple objects to represent a single game and being constrained by Riot’s data format is inconvenient.This is why creating a unique, community-driven representation of League of Legends game data will help communication
and teamwork in open source projects. Improving the data structure will also make the data more accessible to new
developers, and will make existing libraries easier to maintain.ConstraintsRetain all the information present in the Riot APIAllow for external information, like role, to be added to the objectBe compatible across a wide variety of programming languagesGeneral philosophyWe try to adhere to theGoogle JSON Style GuideInformation is as close as possible to the objects it refers toPlayer-specific information is directly underplayerobjectsTeam-wide information is directly underteamobjectsInformation is not duplicatedwinneris only defined once in thegameobjectField names are coherent and comply with modern LoL nomenclatureEvery field that is an identifier ends withidFields likecsormonstersKilleduse current game vocabulary (as of June 2020)All durations from the game start are expressed in secondsnullThenullvalue should only be used for unknown information. The best practice is to not have unknown fields in
the object to keep it as light as possible.lol_dtoThis repository hosts apythonreference implementation in the form of adataclass.Adataclassdoes not enforce type constraints but will raise linter warnings and allows IDEs to autocomplete field names.Another module focused on transformingMatchDtoandMatchTimelineDtoto aLolGamecanbe found here. Itsunit testsandJSON examplesare useful sources to better understand the data structure.LolGame DTO overviewgame: dict
├── sources: dict
├── teams: dict
|   ├── uniqueIdentifiers: dict
│   ├── bans: list
│   ├── monstersKills: list
│   ├── buildingsKills: list
│   └── players: list
│       ├── uniqueIdentifiers: dict
│       ├── endOfGameStats: dict
│       │   └── items: list
│       ├── summonersSpells: list
│       ├── runes: list
│       ├── snapshots: list
│       ├── itemsEvents: list
│       ├── wardsEvents: list
│       └── skillsLevelUpEvents: list
├── kills: list
├── picksBans: list
└── pauses: listGamesourcesrepresents unique identifiers for this game for a given data source"riotLolApi": { "gameId": 4409190456, "platformId": "KR" }teamshas properties equal to'BLUE'and'RED'killsare present directly at the root of thegameobject as they refer to multiple players throughkillerId,victimId, andassistingParticipantsIdsWe have to rely on the arbitraryparticipantIdgiven by the Riot API because:Relying onchampionIdmakes it incompatible with blind pickRelying oninGameNamedoes not work forMatchTimelineobjects from the Riot APIpicksBansrepresents the full picks and bans and is mostly used for esports gamesTeambansis a simple list ofidof champions banned by the team.monsterKillsandbuildingKillsare at theteamlevel because they are team-wideThey both define their ownBuildingKillEventandMonsterKillEventDTOs that are very different from Riot’s APIplayersare simply in a list because no unique key arisesrolesare not guaranteed to be defined and uniquePlayeridrefers to Riot API’sparticipantIdand is unfortunately necessary to be able to link different objects coming
from ituniqueIdentifiersis similar togame['sources']in that it represents a unique identifier for the player in the
specified data source"riotLolApi": { "accountId": "3VcaXNMW8jq3adCqG0k0RPBaxoNL08NFXH_h4_2sKI_iEKw", "platformId": "KR" }endOfGameStatsrepresents statistics that are only available at the end of the game, including end of gameitemsas well askills,totalDamageDealtToChampions, ...snapshotsis a list of timestamped information about the player, mostlygoldandpositionat given timestampsitemsEventsare item-related events from players (buying, selling, undoing, destroying)wardsEventsare ward-related events from players (placing, destroying)skillsLevelUpEventsare skills level up events from playersContributingCurrently wanted contribution are:Feedback about the data structure and field namesImplementation of the data structure in other programming languagesC functions to cast Riot API objects to this LolGame DTO as multiple languages can bind to them