Skip to content
Snippets Groups Projects
Commit 8cd26603 authored by Christophe Benz's avatar Christophe Benz
Browse files

Add datasets with data URL to category tree only

parent 5f992778
No related branches found
No related tags found
No related merge requests found
Pipeline #360312 passed with stages
in 4 minutes and 54 seconds
......@@ -378,12 +378,6 @@ def toc_element_to_category_tree(xml_element, dataset_json_stubs, dataset_codes_
)
)
elif xml_element_tag == "branch":
code = xml_element.findtext("{*}code")
if code == "DS-1062396":
# Remove "International trade in goods - detailed data" branch from category tree
# as it doesn't contains any data here.
# https://git.nomics.world/dbnomics-fetchers/management/issues/435
return None
children = list(
filter(
None,
......@@ -396,7 +390,7 @@ def toc_element_to_category_tree(xml_element, dataset_json_stubs, dataset_codes_
return (
without_falsy_values(
{
"code": code,
"code": xml_element.findtext("{*}code"),
"name": xml_element.findtext("{*}title[@language='en']"),
"children": children,
}
......@@ -412,6 +406,10 @@ def toc_element_to_category_tree(xml_element, dataset_json_stubs, dataset_codes_
if dataset_code not in dataset_codes_to_convert:
return None
dataset_url = xml_element.findtext("{*}downloadLink[@format='sdmx']")
if not dataset_url:
return None
dataset_name = xml_element.findtext("{*}title[@language='en']")
if dataset_code not in dataset_json_stubs:
dataset_json_stubs[dataset_code] = {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment