Skip to content

Commit

Permalink
feat: 🥅 add groups [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgasquez committed Apr 2, 2024
1 parent 55d175e commit f890057
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
6 changes: 5 additions & 1 deletion datadex/assets/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@


def create_hf_asset(dataset_name: str):
@asset(name="huggingface_" + dataset_name, ins={"data": AssetIn(dataset_name)})
@asset(
name="huggingface_" + dataset_name,
ins={"data": AssetIn(dataset_name)},
group_name="huggingface",
)
def hf_asset(data: pd.DataFrame, hf: HuggingFaceResource) -> None:
"""
Upload data to HuggingFace.
Expand Down
6 changes: 3 additions & 3 deletions datadex/assets/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from slugify import slugify


@asset
@asset(group_name="country_indicators")
def owid_energy_data() -> pd.DataFrame:
"""
Raw Energy data from Our World in Data.
Expand All @@ -18,7 +18,7 @@ def owid_energy_data() -> pd.DataFrame:
return pd.read_csv(energy_owid_url)


@asset
@asset(group_name="country_indicators")
def owid_co2_data() -> pd.DataFrame:
"""
Raw CO2 data from Our World in Data.
Expand All @@ -29,7 +29,7 @@ def owid_co2_data() -> pd.DataFrame:
return pd.read_csv(co2_owid_url)


@asset
@asset(group_name="country_indicators")
def world_bank_wdi() -> pd.DataFrame:
"""
World Development Indicators (WDI) is the World Bank's premier compilation of cross-country comparable data on development.
Expand Down
4 changes: 2 additions & 2 deletions datadex/assets/others.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..resources import IUCNRedListAPI


@asset
@asset(group_name="others")
def threatened_animal_species(iucn_redlist_api: IUCNRedListAPI) -> pd.DataFrame:
"""
Threatened animal species data from the IUCN Red List API.
Expand All @@ -27,7 +27,7 @@ def threatened_animal_species(iucn_redlist_api: IUCNRedListAPI) -> pd.DataFrame:
)


@asset
@asset(group_name="others")
def wikidata_asteroids() -> pd.DataFrame:
"""
Wikidata asteroids data.
Expand Down
8 changes: 4 additions & 4 deletions datadex/assets/spain.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..resources import AEMETAPI


@asset
@asset(group_name="spain_open_data")
def spain_energy_demand(context: AssetExecutionContext) -> pd.DataFrame:
"""
Spain energy demand data.
Expand Down Expand Up @@ -49,7 +49,7 @@ def spain_energy_demand(context: AssetExecutionContext) -> pd.DataFrame:
return df


@asset
@asset(group_name="spain_open_data")
def spain_ipc() -> pd.DataFrame:
"""
Spain IPC data from INE. Downloaded from datos.gob.es (https://datos.gob.es/es/apidata).
Expand All @@ -73,7 +73,7 @@ def spain_ipc() -> pd.DataFrame:
return df


@asset
@asset(group_name="spain_open_data")
def spain_aemet_stations(aemet_api: AEMETAPI) -> pd.DataFrame:
"""
Spain AEMET stations data.
Expand All @@ -84,7 +84,7 @@ def spain_aemet_stations(aemet_api: AEMETAPI) -> pd.DataFrame:
return df


@asset
@asset(group_name="spain_open_data")
def spain_aemet_weather_data(
context: AssetExecutionContext, aemet_api: AEMETAPI
) -> pd.DataFrame:
Expand Down
9 changes: 9 additions & 0 deletions dbt/models/country_year_indicators_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

models:
- name: country_year_indicators
description: "Country-year indicators"
config:
meta:
dagster:
group: country_indicators

0 comments on commit f890057

Please sign in to comment.