Skip to content

Commit

Permalink
update generate bundle script to support flat index files (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Aug 29, 2024
1 parent 5a49d74 commit 4cb1708
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions scripts/generate-bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@
with open(filename) as fh2:
reader = csv.reader(fh2)
next(reader)
for row in reader:
topic_to_add = f'{root2}/{row[0]}'
if topic_to_add.startswith('/'):
topic_to_add = topic_to_add.lstrip('/')
if file_.endswith('index.csv'):
for row in reader:
topic_to_add = f'{root2}/{row[0]}'
if topic_to_add.startswith('/'):
topic_to_add = topic_to_add.lstrip('/')

topics.append(topic_to_add)
topics.append(topic_to_add)
elif file_.endswith('index-flat.csv'):
parent_groups = []
for row in reader:
parent_groups.append(row[0])
topics.append(f'{root2}/{row[0]}/{row[1]}')

for parent_group in set(parent_groups):
topics.append(f'{root2}/{parent_group}')

with open('topic-hierarchy/earth-system-discipline.csv', 'w') as fh:
fieldnames = ['Name']
Expand Down

0 comments on commit 4cb1708

Please sign in to comment.