Skip to content

Commit 13c46c4

Browse files
changing damage field to string (#251)
1 parent bbfcda7 commit 13c46c4

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

card_data/pipelines/defs/extract/tcgdex/extract_cards.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ def create_card_dataframe(extract_card_info: list) -> pl.DataFrame:
9999

100100
flat["attacks_json"] = json.dumps(card.get("attacks", []), ensure_ascii=False)
101101

102-
attacks = card.get("attacks", [])
102+
attacks = [atk for atk in card.get("attacks", []) if atk.get("name")]
103103
for i, atk in enumerate(attacks):
104104
prefix = f"attack_{i + 1}"
105105
flat[f"{prefix}_name"] = atk.get("name")
106-
flat[f"{prefix}_damage"] = atk.get("damage")
106+
damage = atk.get("damage")
107+
flat[f"{prefix}_damage"] = str(damage) if damage is not None else None
107108
flat[f"{prefix}_effect"] = atk.get("effect")
108109
flat[f"{prefix}_cost"] = ", ".join(atk.get("cost", []))
109110

card_data/pipelines/poke_cli_dbt/models/sources.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ sources:
9393
description: "Second attack effect"
9494
- name: attack_2_cost
9595
description: "Second attack energy cost"
96+
- name: attack_3_name
97+
description: "Third attack name"
98+
- name: attack_3_damage
99+
description: "Third attack damage"
100+
- name: attack_3_effect
101+
description: "Third attack effect"
102+
- name: attack_3_cost
103+
description: "Third attack energy cost"
96104

97105
- name: pricing_data
98106
description: "Card pricing data"

0 commit comments

Comments
 (0)