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

Fix category mismatch #489

Open
kavigupta opened this issue Oct 27, 2024 · 0 comments
Open

Fix category mismatch #489

kavigupta opened this issue Oct 27, 2024 · 0 comments

Comments

@kavigupta
Copy link
Owner

make it so you don't need to make distance_from_features and climate_change special cases. also maybe we need to handle 2010 and 2000 better. Currently the category list is only used for CSV export and juxtastat.

def get_statistic_categories():
    """
    Map from internal statistic names to categories.
    """
    category_by_tree = {}
    for category_id, category in statistics_tree.items():
        for _, group in category["contents"].items():
            for year, stats in group["contents"].items():
                for stat in stats:
                    category_id_to_use = {
                        "distance_from_features": "feature",
                        "climate_change": "climate",
                    }.get(category_id, category_id)
                    category_by_tree[stat] = (
                        category_id_to_use if year in {2020, None} else str(year)
                    )
    return category_by_tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant