This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
from pathlib import Path | |
def transform_station(station): | |
"""Transform a single station record to the desired output format.""" | |
# Extract tags and convert to list | |
genres = station.get('tags', '').split(',') | |
# Clean up empty strings and strip whitespace | |
genres = [g.strip() for g in genres if g.strip()] |