Skip to content

Commit

Permalink
update etl scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Nov 20, 2023
1 parent e369fce commit ffb5d13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions etl/scripts/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
source_dir = '../source/'
output_dir = '../../'

data_csv = os.path.join(source_dir, 'WDIData.csv')
data_csv = os.path.join(source_dir, 'WDICSV.csv')
country_csv = os.path.join(source_dir, 'WDICountry.csv')
series_csv = os.path.join(source_dir, 'WDISeries.csv')
groups_xls = os.path.join(source_dir, 'CLASS.xlsx')
Expand Down Expand Up @@ -53,7 +53,7 @@ def extract_economy_entities(countries: pd.DataFrame, domains: pd.DataFrame, gro
sets=sets_list,
props={'name': name})

grouped = groups.groupby(by=['CountryCode'])
grouped = groups.groupby(by='CountryCode')
for eco, df in grouped:
eco_groups = df['GroupCode'].values.tolist()
eco_id = to_concept_id(eco)
Expand Down
10 changes: 8 additions & 2 deletions etl/scripts/update_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

from zipfile import ZipFile
# from ddf_utils.factory import WorldBankLoader
from ddf_utils.factory.common import download
# from ddf_utils.factory.common import download
import requests


def download(url, outpath):
response = requests.get(url, allow_redirects=True)
open(outpath, 'wb').write(response.content)


source_dir = '../source/'
# classification files
# see https://datahelpdesk.worldbank.org/knowledgebase/articles/906519-world-bank-country-and-lending-groups
zip_file = "http://databank.worldbank.org/data/download/WDI_csv.zip"
zip_file = "https://databank.worldbank.org/data/download/WDI_CSV.zip"
url_class_xls = 'http://databank.worldbank.org/data/download/site-content/CLASS.xlsx'
url_oghist_xls = 'http://databank.worldbank.org/data/download/site-content/OGHIST.xlsx'

Expand Down

0 comments on commit ffb5d13

Please sign in to comment.