Skip to content

WIP: Frontend and API for entry kill heatmaps - #42

Open
nibalizer wants to merge 6 commits into
masterfrom
entrykills_api
Open

WIP: Frontend and API for entry kill heatmaps#42
nibalizer wants to merge 6 commits into
masterfrom
entrykills_api

Conversation

@nibalizer

Copy link
Copy Markdown
Contributor

This is an example.

Do not merge

Comment thread cheeseshop/games/csgo.py Outdated
self._handle_historical_entry_kills_heatmap)
router.add_get('/games/csgo/historical/entry_kills_heatmaps',
self._handle_historical_entry_kills_heatmap)
router.add_get('/api/games/csgo/historical/entry_kills',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we replace 'historical' with 'replay' or 'events'? I also think entry_kills_heatmaps is probably too specific, maybe just 'location_events'? I think we want to use GET args to actually filter what kind of events we get. e.g. location_events?ev_types=deaths&custom_filter=first_in_game for getting entry kills

Comment thread cheeseshop/games/csgo.py Outdated
self._handle_gsi_moneylog)
router.add_get('/games/csgo/historical/entry_kills_heatmaps',
self._handle_historical_entry_kills_heatmap)
router.add_get('/games/csgo/historical/entry_kills_heatmaps',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this specified twice?

@nibalizer
nibalizer force-pushed the entrykills_api branch 2 times, most recently from 3a4b294 to b27542f Compare September 12, 2017 16:17
This creates two new routes:

/games/csgo/events/entry_kills_heatmaps - a webpage with some
configuration buttons allowing the user to drill down and create a
heatmap graphic containing exactly what they want

/api/games/csgo/location/events - a json api endpoint that returns
location data for the event type queried. This is all vaporware at this
point but an example query can be found in the template used in the
entry_kills_heatmaps endpoint. Right now we're looking at
'ev_types=deaths' and 'custom_filter=first_in_game'.
So far just tables of players and teams, with getters.
Comment thread cheeseshop/dbapi.py Outdated
victim_pos_z real,
assister integer REFERENCES cs_go_steam_ids (id),
weapon_original_owner integer REFERENCES cs_go_steam_ids (id),
penetrated boolean,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a short integer (Postgres type is smallint). It's the number of objects that the shot penetrated before the kill.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oshit cool.

Comment thread cheeseshop/dbapi.py Outdated
weapon_original_owner integer REFERENCES cs_go_steam_ids (id),
penetrated boolean,
weapon text,
map text

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also keep track of the game ID and the tick here? That would make it easy to find the first player_death event of any game.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah we need meta information for at least:

match
map (sometimes matches are best of 3 or best of 5)
round
tick
seconds into round?

And the associated relation tables
The order of table creation is picky because there are multiple tables
that refer to keys in other tables.
Comment thread cheeseshop/dbapi.py
id serial PRIMARY KEY,
steam_id text UNIQUE NOT NULL
steam_id text UNIQUE NOT NULL,
print_name text,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we can have this column here as names are changeable. The two options are make this a list (although theres some issues there perf wise) or break this out in to its own table we refer in to (probably best).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Comment thread cheeseshop/dbapi.py
weapon_original_owner integer REFERENCES cs_go_steam_ids (id),
penetrated smallint,
weapon text,
map_name text,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this if we have the cs_go_map releation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't. Will remove.

Comment thread cheeseshop/dbapi.py
penetrated smallint,
weapon text,
map_name text,
attacker_team text,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this be a reference to cs_go_team_ids?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

team as in T or CT

Comment thread cheeseshop/dbapi.py
weapon text,
map_name text,
attacker_team text,
victim_team text,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, also a reference to cs_go_team_ids

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

team as in T or CT

Comment thread cheeseshop/dbapi.py
async def create_schema(conn):
await conn.execute('''
CREATE TABLE cs_go_team_ids(
id serial PRIMARY KEY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table is going to require some thinking. If we have no information to distinguish a 'team' other than name then wouldnt two differently named teams always be considered different teams (and therefore name for a team would belong in this table)? I suspect the idea is we want to use some other information to correlate events from a team even if the name isnt exatly the same. If so, then we have to figure out what other information we are going to use and that information has to be added as a column in this table.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like theres an hltv id which is the main source of truth we should try for disambiguating a team. Lets add a hltv_id column here

Comment thread cheeseshop/dbapi.py
@staticmethod
async def create_schema(conn):
await conn.execute('''
CREATE TABLE cs_go_team_ids(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just call this table cs_go_teams (id isnt an external property here like steamid, its a key were using internally).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Comment thread cheeseshop/dbapi.py
CREATE TABLE cs_go_death_events(
id serial PRIMARY KEY,
attacker integer REFERENCES cs_go_steam_ids (id),
attacker_pos_x real,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the motivation with adding all of these properties, but I would recommend starting with the minimal set. The idea of the separate hltv events table is it should be trivial for us to add in properties later on and if we start huge like this then theres just going to be a lot of initial work before getting an end-to-end demo working.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah I agree that anything not directly needed should be dropped. All of these are pulled directly from the example paste ryan put together of what's already in the death event. If any of these values give us trouble, drop them then?

Comment thread cheeseshop/dbapi.py
@staticmethod
async def create_schema(conn):
await conn.execute('''
CREATE TABLE cs_go_team_names(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we can probably remove this table in the name of simplicity and add a column in the main teams table called hltv_name which is probably what well want to use for team names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants