original_docstring: Transforms annotated json into a dictionary database
      
      :param annotated_json: Annotated json to turn into a dictionary.
      :type annotated_json: dict
      :param data_base: The dictionary containing the final database. Pass this as an empty dict.
      :type data_base: dict
      
docstring: Transforms annotated json into a dictionary database
docstring_tokens: Transforms annotated json into a dictionary database
code: def database_builder(annotated_json, csv={}):
      """Transforms annotated json into a dictionary database
      
      :param annotated_json: Annotated json to turn into a dictionary.
      :type annotated_json: dict
      :param data_base: The dictionary containing the final database. Pass this as an empty dict.
      :type data_base: dict
      """
      data_base = {}
      for key, value in annotated_json.items():
          # Use ! to delineate Schema Annotation
          if '!' in key:
              prop, annotation = tuple(key.split('!', 1))
          else:
              prop, annotation = key, None
          # Skip all @ items
          if '@' in key or prop in ['', None]:
              continue
          data_base[prop] = {} if prop not in data_base else data_base[prop]
          if annotation is None:
              if isinstance(value, list):
                  data_base[prop]["items"] = {
                      "type": list(set([type(x) for x in value]))
                  }
                  data_base[prop]["type"] = "array"
                  value = value[0]
              if isinstance(value, dict):
                  sub_csv = {k.split('/', 1)[1]: s for k, s in csv.items() if prop in k and '/' in k}
                  data_base[prop]["properties"] = database_builder(value, sub_csv)
              elif isinstance(value, str) and '|' in value:
                  #For enum values
                  value = [val.strip() for val in value.split('|') if val]
                  data_base[prop]["enum"] = value
              data_base[prop]["value"] = value
          else:
              data_base[prop][annotation] = value
      for prop in data_base:
          if prop in csv:
              print(prop)
              data_base[prop]['description'] = csv[prop][0]
              data_base[prop]['longDescription'] = csv[prop][1]
              if data_base[prop].get("enum"):
                  csv_enum = csv[prop][2:]
                  print(csv_enum, prop)
                  if data_base[prop].get("enumDescriptions") is None:
                      data_base[prop]["enumDescriptions"] = {}
                  data_base[prop]["enumDescriptions"].update({e: d for e, d in zip(data_base[prop]["value"], csv_enum)})
  
  
      return data_base
code_tokens: def database_builder ( annotated_json , csv = { } ) : data_base = { } for key , value in annotated_json . items ( ) : if '!' in key : prop , annotation = tuple ( key . split ( '!' , 1 ) ) else : prop , annotation = key , None if '@' in key or prop in [ '' , None ] : continue data_base [ prop ] = { } if prop not in data_base else data_base [ prop ] if annotation is None : if isinstance ( value , list ) : data_base [ prop ] [ "items" ] = { "type" : list ( set ( [ type ( x ) for x in value ] ) ) } data_base [ prop ] [ "type" ] = "array" value = value [ 0 ] if isinstance ( value , dict ) : sub_csv = { k . split ( '/' , 1 ) [ 1 ] : s for k , s in csv . items ( ) if prop in k and '/' in k } data_base [ prop ] [ "properties" ] = database_builder ( value , sub_csv ) elif isinstance ( value , str ) and '|' in value : value = [ val . strip ( ) for val in value . split ( '|' ) if val ] data_base [ prop ] [ "enum" ] = value data_base [ prop ] [ "value" ] = value else : data_base [ prop ] [ annotation ] = value for prop in data_base : if prop in csv : print ( prop ) data_base [ prop ] [ 'description' ] = csv [ prop ] [ 0 ] data_base [ prop ] [ 'longDescription' ] = csv [ prop ] [ 1 ] if data_base [ prop ] . get ( "enum" ) : csv_enum = csv [ prop ] [ 2 : ] print ( csv_enum , prop ) if data_base [ prop ] . get ( "enumDescriptions" ) is None : data_base [ prop ] [ "enumDescriptions" ] = { } data_base [ prop ] [ "enumDescriptions" ] . update ( { e : d for e , d in zip ( data_base [ prop ] [ "value" ] , csv_enum ) } ) return data_base
short_docstring: Transforms annotated json into a dictionary database
short_docstring_tokens: Transforms annotated json into a dictionary database
comment: """Transforms annotated json into a dictionary database
      
      :param annotated_json: Annotated json to turn into a dictionary.
      :type annotated_json: dict
      :param data_base: The dictionary containing the final database. Pass this as an empty dict.
      :type data_base: dict
      """$SEP$# Use ! to delineate Schema Annotation$SEP$# Skip all @ items$SEP$#For enum values