Skip to content

Commit

Permalink
Merge pull request #70 from TeoMeWhy/feat/dota
Browse files Browse the repository at this point in the history
Feature Store of teams
  • Loading branch information
TeoCalvo authored Aug 22, 2023
2 parents 3833d79 + 3d10938 commit a13fe62
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 0 deletions.
156 changes: 156 additions & 0 deletions src/03.silver/dota/feature_store/etl/teams.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
SELECT
t1.dtReference,
t1.idTeam,
t1.descTeamName,
t1.descTeamTag,

coalesce(avg(t2.nrFrequency),0) AS nrFrequency180,
coalesce(avg(t2.avgWin),0) AS avgWin180,
coalesce(avg(t2.avgCampsStacked),0) AS avgCampsStacked180,
coalesce(avg(t2.avgCreepsStacked),0) AS avgCreepsStacked180,
coalesce(avg(t2.avgKills),0) AS avgKills180,
coalesce(avg(t2.avgAssist),0) AS avgAssist180,
coalesce(avg(t2.avgDeaths),0) AS avgDeaths180,
coalesce(avg(t2.avgDenies),0) AS avgDenies180,
coalesce(avg(t2.avgFirstbloodClaimed),0) AS avgFirstbloodClaimed180,
coalesce(avg(t2.avgGold),0) AS avgGold180,
coalesce(avg(t2.avgGoldMinute),0) AS avgGoldMinute180,
coalesce(avg(t2.avgGoldSpent),0) AS avgGoldSpent180,
coalesce(avg(t2.avgHeroDamage),0) AS avgHeroDamage180,
coalesce(avg(t2.avgHeroHealing),0) AS avgHeroHealing180,
coalesce(avg(t2.avgLastHits),0) AS avgLastHits180,
coalesce(avg(t2.avgLevel),0) AS avgLevel180,
coalesce(avg(t2.avgNetWorth),0) AS avgNetWorth180,
coalesce(avg(t2.avgRoshansKilled),0) AS avgRoshansKilled180,
coalesce(avg(t2.avgRunePicks),0) AS avgRunePicks180,
coalesce(avg(t2.avgStunsSec),0) AS avgStunsSec180,
coalesce(avg(t2.avgtTeamfightParticipation),0) AS avgtTeamfightParticipation180,
coalesce(avg(t2.avgTowerDamage),0) AS avgTowerDamage180,
coalesce(avg(t2.avgTowerKilled),0) AS avgTowerKilled180,
coalesce(avg(t2.avgXpMinute),0) AS avgXpMinute180,
coalesce(avg(t2.avgTotalGold),0) AS avgTotalGold180,
coalesce(avg(t2.avgTotalXp),0) AS avgTotalXp180,
coalesce(avg(t2.avgKillsMinute),0) AS avgKillsMinute180,
coalesce(avg(t2.avgKDA),0) AS avgKDA180,
coalesce(avg(t2.avgNeutralKills),0) AS avgNeutralKills180,
coalesce(avg(t2.avgTowerKills),0) AS avgTowerKills180,
coalesce(avg(t2.avgCourierKills),0) AS avgCourierKills180,
coalesce(avg(t2.avgLaneKills),0) AS avgLaneKills180,
coalesce(avg(t2.avgHeroKills),0) AS avgHeroKills180,
coalesce(avg(t2.avgObserverKills),0) AS avgObserverKills180,
coalesce(avg(t2.avgSentryKills),0) AS avgSentryKills180,
coalesce(avg(t2.avgRoshansKills),0) AS avgRoshansKills180,
coalesce(avg(t2.avgNecronomiconKills),0) AS avgNecronomiconKills180,
coalesce(avg(t2.avgAncientKills),0) AS avgAncientKills180,
coalesce(avg(t2.avgBuybackCount),0) AS avgBuybackCount180,
coalesce(avg(t2.avgObserverUses),0) AS avgObserverUses180,
coalesce(avg(t2.avgSentryUses),0) AS avgSentryUses180,
coalesce(avg(t2.avgLaneEfficiency),0) AS avgLaneEfficiency180,
coalesce(avg(t2.avgPurchaseTps),0) AS avgPurchaseTps180,

coalesce(avg(t3.nrFrequency),0)AS nrFrequency90,
coalesce(avg(t3.avgWin),0)AS avgWin90,
coalesce(avg(t3.avgCampsStacked),0)AS avgCampsStacked90,
coalesce(avg(t3.avgCreepsStacked),0)AS avgCreepsStacked90,
coalesce(avg(t3.avgKills),0)AS avgKills90,
coalesce(avg(t3.avgAssist),0)AS avgAssist90,
coalesce(avg(t3.avgDeaths),0)AS avgDeaths90,
coalesce(avg(t3.avgDenies),0)AS avgDenies90,
coalesce(avg(t3.avgFirstbloodClaimed),0)AS avgFirstbloodClaimed90,
coalesce(avg(t3.avgGold),0)AS avgGold90,
coalesce(avg(t3.avgGoldMinute),0)AS avgGoldMinute90,
coalesce(avg(t3.avgGoldSpent),0)AS avgGoldSpent90,
coalesce(avg(t3.avgHeroDamage),0)AS avgHeroDamage90,
coalesce(avg(t3.avgHeroHealing),0)AS avgHeroHealing90,
coalesce(avg(t3.avgLastHits),0)AS avgLastHits90,
coalesce(avg(t3.avgLevel),0)AS avgLevel90,
coalesce(avg(t3.avgNetWorth),0)AS avgNetWorth90,
coalesce(avg(t3.avgRoshansKilled),0)AS avgRoshansKilled90,
coalesce(avg(t3.avgRunePicks),0)AS avgRunePicks90,
coalesce(avg(t3.avgStunsSec),0)AS avgStunsSec90,
coalesce(avg(t3.avgtTeamfightParticipation),0)AS avgtTeamfightParticipation90,
coalesce(avg(t3.avgTowerDamage),0)AS avgTowerDamage90,
coalesce(avg(t3.avgTowerKilled),0)AS avgTowerKilled90,
coalesce(avg(t3.avgXpMinute),0)AS avgXpMinute90,
coalesce(avg(t3.avgTotalGold),0)AS avgTotalGold90,
coalesce(avg(t3.avgTotalXp),0)AS avgTotalXp90,
coalesce(avg(t3.avgKillsMinute),0)AS avgKillsMinute90,
coalesce(avg(t3.avgKDA),0)AS avgKDA90,
coalesce(avg(t3.avgNeutralKills),0)AS avgNeutralKills90,
coalesce(avg(t3.avgTowerKills),0)AS avgTowerKills90,
coalesce(avg(t3.avgCourierKills),0)AS avgCourierKills90,
coalesce(avg(t3.avgLaneKills),0)AS avgLaneKills90,
coalesce(avg(t3.avgHeroKills),0)AS avgHeroKills90,
coalesce(avg(t3.avgObserverKills),0)AS avgObserverKills90,
coalesce(avg(t3.avgSentryKills),0)AS avgSentryKills90,
coalesce(avg(t3.avgRoshansKills),0)AS avgRoshansKills90,
coalesce(avg(t3.avgNecronomiconKills),0)AS avgNecronomiconKills90,
coalesce(avg(t3.avgAncientKills),0)AS avgAncientKills90,
coalesce(avg(t3.avgBuybackCount),0)AS avgBuybackCount90,
coalesce(avg(t3.avgObserverUses),0)AS avgObserverUses90,
coalesce(avg(t3.avgSentryUses),0)AS avgSentryUses90,
coalesce(avg(t3.avgLaneEfficiency),0)AS avgLaneEfficiency90,
coalesce(avg(t3.avgPurchaseTps),0)AS avgPurchaseTps90,

coalesce(avg(t4.nrFrequency),0)AS nrFrequency30,
coalesce(avg(t4.avgWin),0)AS avgWin30,
coalesce(avg(t4.avgCampsStacked),0)AS avgCampsStacked30,
coalesce(avg(t4.avgCreepsStacked),0)AS avgCreepsStacked30,
coalesce(avg(t4.avgKills),0)AS avgKills30,
coalesce(avg(t4.avgAssist),0)AS avgAssist30,
coalesce(avg(t4.avgDeaths),0)AS avgDeaths30,
coalesce(avg(t4.avgDenies),0)AS avgDenies30,
coalesce(avg(t4.avgFirstbloodClaimed),0)AS avgFirstbloodClaimed30,
coalesce(avg(t4.avgGold),0)AS avgGold30,
coalesce(avg(t4.avgGoldMinute),0)AS avgGoldMinute30,
coalesce(avg(t4.avgGoldSpent),0)AS avgGoldSpent30,
coalesce(avg(t4.avgHeroDamage),0)AS avgHeroDamage30,
coalesce(avg(t4.avgHeroHealing),0)AS avgHeroHealing30,
coalesce(avg(t4.avgLastHits),0)AS avgLastHits30,
coalesce(avg(t4.avgLevel),0)AS avgLevel30,
coalesce(avg(t4.avgNetWorth),0)AS avgNetWorth30,
coalesce(avg(t4.avgRoshansKilled),0)AS avgRoshansKilled30,
coalesce(avg(t4.avgRunePicks),0)AS avgRunePicks30,
coalesce(avg(t4.avgStunsSec),0)AS avgStunsSec30,
coalesce(avg(t4.avgtTeamfightParticipation),0)AS avgtTeamfightParticipation30,
coalesce(avg(t4.avgTowerDamage),0)AS avgTowerDamage30,
coalesce(avg(t4.avgTowerKilled),0)AS avgTowerKilled30,
coalesce(avg(t4.avgXpMinute),0)AS avgXpMinute30,
coalesce(avg(t4.avgTotalGold),0)AS avgTotalGold30,
coalesce(avg(t4.avgTotalXp),0)AS avgTotalXp30,
coalesce(avg(t4.avgKillsMinute),0)AS avgKillsMinute30,
coalesce(avg(t4.avgKDA),0)AS avgKDA30,
coalesce(avg(t4.avgNeutralKills),0)AS avgNeutralKills30,
coalesce(avg(t4.avgTowerKills),0)AS avgTowerKills30,
coalesce(avg(t4.avgCourierKills),0)AS avgCourierKills30,
coalesce(avg(t4.avgLaneKills),0)AS avgLaneKills30,
coalesce(avg(t4.avgHeroKills),0)AS avgHeroKills30,
coalesce(avg(t4.avgObserverKills),0)AS avgObserverKills30,
coalesce(avg(t4.avgSentryKills),0)AS avgSentryKills30,
coalesce(avg(t4.avgRoshansKills),0)AS avgRoshansKills30,
coalesce(avg(t4.avgNecronomiconKills),0)AS avgNecronomiconKills30,
coalesce(avg(t4.avgAncientKills),0)AS avgAncientKills30,
coalesce(avg(t4.avgBuybackCount),0)AS avgBuybackCount30,
coalesce(avg(t4.avgObserverUses),0)AS avgObserverUses30,
coalesce(avg(t4.avgSentryUses),0)AS avgSentryUses30,
coalesce(avg(t4.avgLaneEfficiency),0)AS avgLaneEfficiency30,
coalesce(avg(t4.avgPurchaseTps),0)AS avgPurchaseTps30

FROM feature_store.dota_teams_player_0 AS t1

LEFT JOIN feature_store.dota_players_180 AS t2
ON t1.dtReference = t2.dtReference
AND t1.idPlayer = t2.idPlayer

LEFT JOIN feature_store.dota_players_90 AS t3
ON t1.dtReference = t3.dtReference
AND t1.idPlayer = t3.idPlayer

LEFT JOIN feature_store.dota_players_30 AS t4
ON t1.dtReference = t4.dtReference
AND t1.idPlayer = t4.idPlayer

-- WHERE t1.dtReference = '{date}'

GROUP BY t1.dtReference, t1.idTeam, t1.descTeamName, t1.descTeamTag
ORDER BY t1.idTeam, t1.dtReference
34 changes: 34 additions & 0 deletions src/06.workflows/data4u_dota.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,40 @@
"existing_cluster_id": "0809-155233-nc569ju7",
"timeout_seconds": 0,
"email_notifications": {}
},
{
"task_key": "fs_teams",
"depends_on": [
{
"task_key": "fs_teams_player"
},
{
"task_key": "fs_players_30"
},
{
"task_key": "fs_players_90"
},
{
"task_key": "fs_players_180"
}
],
"notebook_task": {
"notebook_path": "src/03.silver/dota/feature_store/fs_ingestao",
"base_parameters": {
"table": "teams",
"window": "0",
"description": "Feature Store de times com médias das performances dos jogadores",
"id_fields": "dtReference,idTeam",
"partition_fields": "dtReference",
"date_start": "{{start_date}}",
"date_stop": "{{start_date}}",
"monthly": "False"
},
"source": "GIT"
},
"existing_cluster_id": "0809-155233-nc569ju7",
"timeout_seconds": 0,
"email_notifications": {}
}
],
"git_source": {
Expand Down

0 comments on commit a13fe62

Please sign in to comment.