Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📊 WDI update #3767

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dag/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ steps:
- data://garden/news/2024-05-23/gdelt_v2

# World Development Indicators - WDI
# TO BE ARCHIVED
data://meadow/worldbank_wdi/2024-05-20/wdi:
- snapshot://worldbank_wdi/2024-05-20/wdi.zip

Expand All @@ -543,6 +544,20 @@ steps:
data://grapher/worldbank_wdi/2024-05-20/wdi:
- data://garden/worldbank_wdi/2024-05-20/wdi

# World Development Indicators - WDI
data://meadow/worldbank_wdi/2024-12-27/wdi:
- snapshot://worldbank_wdi/2024-12-27/wdi.zip

data://garden/worldbank_wdi/2024-12-27/wdi:
- snapshot://worldbank_wdi/2024-12-27/wdi.zip
- data://meadow/worldbank_wdi/2024-12-27/wdi
- data://garden/demography/2024-07-15/population
- data://garden/regions/2023-01-01/regions
- data://garden/wb/2024-07-29/income_groups

data://grapher/worldbank_wdi/2024-12-27/wdi:
- data://garden/worldbank_wdi/2024-12-27/wdi

#
# Aviation Safety Network - Aviation Statistics.
#
Expand Down
12 changes: 9 additions & 3 deletions etl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@ def get_dependency_step_name(
short_name=short_name,
is_private=is_private,
)
matches = [dependency for dependency in self.dependencies if bool(re.match(pattern, dependency))]
deps = self.dependencies
matches = _match_dependencies(pattern, deps)

# If no step was found and is_private was not specified, try again assuming step is private.
if (len(matches) == 0) and (is_private is None):
Expand All @@ -700,7 +701,7 @@ def get_dependency_step_name(
short_name=short_name,
is_private=True,
)
matches = [dependency for dependency in self.dependencies if bool(re.match(pattern, dependency))]
matches = _match_dependencies(pattern, self.dependencies)

# If not step was found and channel is "grapher", try again assuming this is a grapher://grapher step.
if (len(matches) == 0) and (channel == "grapher"):
Expand All @@ -712,7 +713,7 @@ def get_dependency_step_name(
short_name=short_name,
is_private=is_private,
)
matches = [dependency for dependency in self.dependencies if bool(re.match(pattern, dependency))]
matches = _match_dependencies(pattern, self.dependencies)

if len(matches) == 0:
raise NoMatchingStepsAmongDependencies(step_name=self.step_name)
Expand Down Expand Up @@ -798,6 +799,11 @@ def load_mdim_config(self, filename: Optional[str] = None, path: Optional[str |
return config


def _match_dependencies(pattern: str, dependencies: List[str]) -> List[str]:
regex = re.compile(pattern)
return [dependency for dependency in dependencies if regex.match(dependency)]


def print_tables_metadata_template(tables: List[Table], fields: Optional[List[str]] = None) -> None:
# This function is meant to be used when creating code in an interactive window (or a notebook).
# It prints a template for the metadata of the tables in the list.
Expand Down
Loading
Loading