class_docstr: A utility class for manipulating the UMLS Semantic Type Hierarchy.
  Designed to be constructed from a TSV file using `construct_umls_tree_from_tsv`.
class_docstr_tok: ["A","utility","class","for","manipulating","the","UMLS","Semantic","Type","Hierarchy",".","Designed","to","be","constructed","from","a","TSV","file","using","`","construct_umls_tree_from_tsv","`","."]
docstr: Constructs a label mapping from the original tree labels to a tree of a fixed depth,
  collapsing labels greater than the depth specified to the closest parent which is
  still present in the new fixed depth tree. This is effectively mapping to a _coarser_
  label space.
docstr_tok: ["Constructs","a","label","mapping","from","the","original","tree","labels","to","a","tree","of","a","fixed","depth",",","collapsing","labels","greater","than","the","depth","specified","to","the","closest","parent","which","is","still","present","in","the","new","fixed","depth","tree",".","This","is","effectively","mapping","to","a","_coarser_","label","space","."]
code: def get_collapsed_type_id_map_at_level(
      self, level: int
  ) -> Dict[str, str]:
      """
      Constructs a label mapping from the original tree labels to a tree of a fixed depth,
      collapsing labels greater than the depth specified to the closest parent which is
      still present in the new fixed depth tree. This is effectively mapping to a _coarser_
      label space.
      """
      new_type_id_map: Dict[str, str] = {
          k: k for k in self.type_id_to_node.keys()
      }
      for node in self.get_nodes_at_depth(level):
          for child in self.get_children(node):
              new_type_id_map[child.type_id] = node.type_id
      return new_type_id_map
  
file_path: scispacy/scispacy/umls_semantic_type_tree.py
imports: from typing import NamedTuple, List, Dict, Deque, Any, Optional
  from collections import deque
  from scispacy.file_cache import cached_path
label_desc: Use image node_id 7 for calling the UmlsSemanticTypeTree obj's underlying member method code with example usage: obj.get_collapsed_type_id_map_at_level(level) and returns: new_type_id_map