def home_view(request):
    topics = []
    organized_topics = defaultdict(list)
    for tag in Tag.tags.public().top_level():
        child_tags = tag.children.values_list('id')
        resource_count = Resource.objects.filter(status=Resource.APPROVED).filter(
            Q(resourcetag__tag__pk__in=child_tags) | Q(resourcetag__tag=tag)).distinct().count()

        for category_slug in ["health-domain"]:
            if tag.category.slug == category_slug:
                organized_topics[category_slug.replace("-", "_")].append({
                    'resource_count': resource_count,
                    'tag': tag,
                })

        topics.append({
            'resource_count': resource_count,
            'tag': tag,
        })

    return render(request, 'orb/home.html', {
        'topics': topics,
        'organized_topics': home_resources(),
        'page_title': _(u'ORB by mPowering'),
    })