code: def build_label_tag_aggregations(
      sample_collection: foc.SampleCollection,
  ):
      counts = []
      tags = []
      for path, field in foc._iter_label_fields(sample_collection):
          label_type = field.document_type
          if issubclass(label_type, fol._HasLabelList):
              path += "." + label_type._LABEL_LIST_FIELD
  
          counts.append(foa.Count(path))
          tags.append(foa.CountValues(path + ".tags"))
  
      return counts, tags
  
file_path: fiftyone/fiftyone/server/routes/tagging.py
imports: from collections import defaultdict
  from starlette.endpoints import HTTPEndpoint
  from starlette.requests import Request
  import fiftyone.core.aggregations
  import fiftyone.core.collections
  import fiftyone.core.labels
  from fiftyone.server.decorators import route
  from fiftyone.server.filters import GroupElementFilter, SampleFilter
  import fiftyone.server.tags
label_desc: Use image node_id 1 for calling a global function with example usage: build_label_tag_aggregations(sample_collection) and returns: counts,  tags