Skip to content

Commit 4933545

Browse files
Merge pull request #253 from digitalghost-dev/1.9.0
1.9.0
2 parents 033c9d6 + 144f679 commit 4933545

64 files changed

Lines changed: 5220 additions & 499 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
- main
3232

3333
env:
34-
VERSION_NUMBER: 'v1.8.11'
34+
VERSION_NUMBER: 'v1.9.0'
3535
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3636
AWS_REGION: 'us-west-2'
3737

@@ -50,7 +50,7 @@ jobs:
5050
uses: actions/checkout@v6
5151

5252
- name: Run Gosec Security Scanner
53-
uses: securego/gosec@v2.22.11
53+
uses: securego/gosec@v2.25.0
5454
with:
5555
args: '-no-fail -fmt sarif -out results.sarif ./...'
5656

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ go.work.sum
2929
# env file
3030
.env
3131

32+
# web
33+
web/.venv
34+
web/.streamlit/secrets.toml
35+
web/.coverage
36+
3237
# Python
3338
card_data/.venv
3439
__pycache__/
@@ -56,7 +61,6 @@ card_data/infrastructure/supabase/access-token
5661

5762
card_data/.tmp*/**
5863

59-
6064
card_data/pipelines/poke_cli_dbt/.user.yml
6165
/card_data/supabase/
6266
/card_data/sample_scripts/

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ builds:
1414
- windows
1515
- darwin
1616
ldflags:
17-
- -s -w -X main.version=v1.8.11
17+
- -s -w -X main.version=v1.9.0
1818

1919
archives:
2020
- formats: [ 'zip' ]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN go mod download
88

99
COPY . .
1010

11-
RUN go build -ldflags "-X main.version=v1.8.11" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.9.0" -o poke-cli .
1212

1313
# build 2
1414
FROM --platform=$BUILDPLATFORM alpine:3.23

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img width="425" src="poke-cli.png" alt="pokemon-logo"/>
33
<h4></h4>
44
<img src="https://img.shields.io/github/v/release/digitalghost-dev/poke-cli?style=flat-square&logo=git&logoColor=FFCC00&label=Release%20Version&labelColor=EEE&color=FFCC00" alt="version-label">
5-
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.8.11?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
5+
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.9.0?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
66
<img src="https://img.shields.io/github/actions/workflow/status/digitalghost-dev/poke-cli/ci.yml?branch=main&style=flat-square&logo=github&logoColor=FFCC00&label=CI&labelColor=EEE&color=FFCC00" alt="ci-status-badge">
77
</div>
88
<div align="center">
@@ -27,11 +27,11 @@ View the [documentation](https://docs.poke-cli.com) on the data infrastructure i
2727
## Demo
2828
### Video Game Data
2929

30-
![demo-vg](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.6.0.gif)
30+
![demo-vg](https://dc8hq8aq7pr04.cloudfront.net/demo-v1.6.0.gif)
3131

3232
### Trading Card Game Data
3333

34-
![demo-tcg](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/poke-cli-card-v1.8.8.gif)
34+
![demo-tcg](https://dc8hq8aq7pr04.cloudfront.net/poke-cli-card-v1.8.8.gif)
3535

3636
---
3737

@@ -99,11 +99,11 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
9999
3. Choose how to interact with the container:
100100
* Run a single command and exit:
101101
```bash
102-
docker run --rm -it digitalghostdev/poke-cli:v1.8.11 <command> [subcommand] [flag]
102+
docker run --rm -it digitalghostdev/poke-cli:v1.9.0 <command> [subcommand] [flag]
103103
```
104104
* Enter the container and use its shell:
105105
```bash
106-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.8.11 -c "cd /app && exec sh"
106+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.0 -c "cd /app && exec sh"
107107
# placed into the /app directory, run the program with './poke-cli'
108108
# example: ./poke-cli ability swift-swim
109109
```
@@ -118,7 +118,7 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
118118
6. Run the tool!
119119

120120
> [!IMPORTANT]
121-
> For macOS, you may have to allow the executable to run as it is not signed. Head to System Settings > Privacy & Security > scroll down and allow the executable to run.
121+
> For macOS, you may have to allow the executable to run as it is not signed. Head to System Settings > Privacy & Security > scroll down and allow executable to run.
122122

123123
<details>
124124

@@ -174,6 +174,7 @@ By running `poke-cli [-h | --help]`, it'll display information on how to use the
174174
│ pokemon Get details about a Pokémon │
175175
│ search Search for a resource │
176176
│ speed Calculate the speed of a Pokémon in battle │
177+
│ tcg Get details about TCG tournaments │
177178
│ types Get details about a typing │
178179
│ │
179180
│ hint: when calling a resource with a space, use a hyphen │
@@ -197,7 +198,7 @@ Below is a list of the planned/completed commands and flags:
197198
- [x] add mega evolution data
198199
- [x] add scarlet & violet data
199200
- [x] add sword & shield data
200-
- [ ] add sun & moon data
201+
- [x] add sun & moon data
201202
- [ ] add x & y data
202203
- [x] `item`: get data about an item.
203204
- [x] `move`: get data about a move.
@@ -216,6 +217,7 @@ Below is a list of the planned/completed commands and flags:
216217
- [x] `move`
217218
- [x] `pokemon`
218219
- [x] `speed`: compare speed stats between two Pokémon.
220+
- [x] `tcg`: get data about TCG tournaments.
219221
- [x] `types`: get data about a specific typing.
220222

221223
---

card_data/pipelines/defs/extract/limitless/extract_standings.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
import dagster as dg
22
import polars as pl
33
import requests
4-
from bs4 import BeautifulSoup
4+
from bs4 import BeautifulSoup, Tag
55

66
def seasons(year: int) -> list[dict]:
77
url = "https://labs.limitlesstcg.com/"
88
r = requests.get(url)
99
soup = BeautifulSoup(r.content, 'html.parser')
1010

11-
season_header = soup.find("h2", string=lambda x: x and f"{year}" in x)
11+
season_header = soup.find("h2", string=lambda x: bool(x and f"{year}" in x))
12+
if not isinstance(season_header, Tag):
13+
return []
1214
tournament_list = season_header.find_next_sibling("ul")
15+
if not isinstance(tournament_list, Tag):
16+
return []
1317

1418
tournaments = []
1519
for a in tournament_list.find_all("a", href=True):
20+
if not isinstance(a, Tag):
21+
continue
1622
parts = list(a.stripped_strings)
1723
tournaments.append({
1824
"name": parts[0],
@@ -31,23 +37,29 @@ def build_standings(tournament: dict) -> pl.DataFrame | None:
3137

3238
table = soup.find("table", class_="data-table striped")
3339

34-
if table:
40+
if isinstance(table, Tag):
3541
headers = ['Rank', 'Name', 'Country', 'Points', 'Record', 'OPW%', 'OOPW%', 'Deck', 'Decklist', 'Unknown']
3642

3743
rows = []
3844
tbody = table.find('tbody')
45+
if not isinstance(tbody, Tag):
46+
return None
3947

4048
for tr in tbody.find_all('tr'):
49+
if not isinstance(tr, Tag):
50+
continue
4151
cells = tr.find_all('td')
4252

4353
if len(cells) == 1:
4454
continue
4555

4656
row_data = []
4757
for i, td in enumerate(cells):
58+
if not isinstance(td, Tag):
59+
continue
4860
if i == 2:
4961
img = td.find('img')
50-
if img:
62+
if isinstance(img, Tag):
5163
country = img.get('alt') or img.get('title') or ''
5264
row_data.append(country)
5365
else:
@@ -56,15 +68,15 @@ def build_standings(tournament: dict) -> pl.DataFrame | None:
5668
elif i == 7: # Deck column
5769
pokemon_imgs = td.find_all('img', class_='pokemon')
5870
if pokemon_imgs:
59-
pokemon_names = [img.get('alt', '') for img in pokemon_imgs if img.get('alt')]
71+
pokemon_names = [str(img.get('alt', '')) for img in pokemon_imgs if isinstance(img, Tag) and img.get('alt')]
6072
pokemon_string = '/'.join(pokemon_names)
6173
row_data.append(pokemon_string)
6274
else:
6375
row_data.append('')
6476

6577
elif i == 8: # Decklist column
6678
link = td.find('a')
67-
if link:
79+
if isinstance(link, Tag):
6880
decklist_url = link.get('href', '')
6981
row_data.append(f"https://labs.limitlesstcg.com{decklist_url}" if decklist_url else '')
7082
else:

card_data/pipelines/defs/transform/transform_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def get_asset_key(self, dbt_resource_props):
1717
"sets": "data_quality_checks_on_sets",
1818
"cards": "load_card_data",
1919
"pricing_data": "data_quality_checks_on_pricing",
20+
"standings": "load_standings_data",
2021
}
2122
if name in source_mapping:
2223
return dg.AssetKey([source_mapping[name]])

card_data/pipelines/poke_cli_dbt/dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'poke_cli_dbt'
2-
version: '1.8.11'
2+
version: '1.9.0'
33

44
profile: 'poke_cli_dbt'
55

card_data/pipelines/poke_cli_dbt/models/sources.yml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,62 @@ sources:
103103
description: "Third attack energy cost"
104104

105105
- name: standings
106-
description: "Tournament standings data"
106+
description: "Player standings data for tournaments"
107+
columns:
108+
- name: rank
109+
description: "Player rank in the tournament"
110+
- name: name
111+
description: "Player name"
112+
- name: points
113+
description: "Player points"
114+
- name: record
115+
description: "Player win/loss record"
116+
- name: opp_win_percent
117+
description: "Opponent win percentage"
118+
- name: opp_opp_win_percent
119+
description: "Opponent's opponent win percentage"
120+
- name: deck
121+
description: "Deck name used by player"
122+
- name: decklist
123+
description: "Decklist URL"
124+
- name: country
125+
description: "Player country code"
126+
- name: tournament_id
127+
description: "Foreign key to tournaments"
107128

108129
- name: tournaments
109130
description: "Tournament metadata"
131+
columns:
132+
- name: tournament_id
133+
description: "Unique tournament identifier"
134+
- name: location
135+
description: "Tournament location"
136+
- name: start_date
137+
description: "Tournament start date"
138+
- name: end_date
139+
description: "Tournament end date"
140+
- name: type
141+
description: "Tournament type"
142+
- name: player_quantity
143+
description: "Number of players in the tournament"
144+
- name: text_date
145+
description: "Tournament date in text format"
146+
- name: country_code
147+
description: "Country ISO code"
148+
- name: logo
149+
description: "Tournament type logo URL"
150+
- name: latitude
151+
description: "Tournament city latitude"
152+
- name: longitude
153+
description: "Tournament city longitude"
110154

111155
- name: country_codes
112-
description: "Country code to country name mapping"
156+
description: "Country code to country name mapping with geographic centroids"
157+
columns:
158+
- name: code
159+
description: "ISO country code"
160+
- name: country_name
161+
description: "Full country name"
113162

114163
- name: pricing_data
115164
description: "Card pricing data"

card_data/pipelines/poke_cli_dbt/models/standings.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ SELECT
1313
s.deck,
1414
s.decklist,
1515
c.country_name AS player_country,
16+
LOWER(c.code) AS country_code,
1617
t.location,
18+
t.country_code AS iso_code,
19+
t.latitude AS tournament_latitude,
20+
t.longitude AS tournament_longitude,
21+
t.logo,
1722
t.start_date,
1823
t.end_date,
24+
t.text_date,
1925
t.type,
2026
t.player_quantity
2127
FROM
2228
{{ source('staging', 'standings') }} AS s
2329
INNER JOIN {{ source('staging', 'tournaments') }} AS t
2430
ON s.tournament_id = t.tournament_id
25-
INNER JOIN {{ source('staging', 'country_codes') }} AS c
31+
LEFT JOIN {{ source('staging', 'country_codes') }} AS c
2632
ON s.country = c.code

0 commit comments

Comments
 (0)