parameters: (request:HttpRequest, project_id)
return_statement: return JsonResponse(completeness, safe=False)
docstring: Obtain completeness information for a set of skeleton IDs.
      ---
      paramaters:
        - name: project_id
          description: Project of skeletons
          type: integer
          paramType: path
          required: true
        - name: skeleton_ids
          description: IDs of the skeletons to get completeness for
          required: true
          type: array
          items:
            type: integer
          paramType: form
        - name: open_ends_percent
          description: The number of allowed open ends in range [0,1].
          type: float
          paramType: form
          default: 0.03
          required: false
        - name: min_nodes
          description: |
              The minimum number of nodes a complete skeleton has to have, e.g. to
              exclude fragments.
          type: int
          paramType: form
          default: 500
          required: false
        - name: min_cable
          description: |
              The minimum cable length in nm a complete skeleton has to have, e.g.
              to exclude fragments.
          type: float
          paramType: form
          default: 0
          required: false
        - name: ignore_fragments
          description: |
              Whether skeletons without a node tagged 'soma' or 'out to nerve'
              should be ignored.
          type: bool
          paramType: form
          default: true
          required: false
docstring_summary: Obtain completeness information for a set of skeleton IDs.
      ---
      paramaters:
        - name: project_id
          description: Project of skeletons
          type: integer
          paramType: path
          required: true
        - name: skeleton_ids
          description: IDs of the skeletons to get completeness for
          required: true
          type: array
          items:
            type: integer
          paramType: form
        - name: open_ends_percent
          description: The number of allowed open ends in range [0,1].
          type: float
          paramType: form
          default: 0.03
          required: false
        - name: min_nodes
          description: |
              The minimum number of nodes a complete skeleton has to have, e.g. to
              exclude fragments.
          type: int
          paramType: form
          default: 500
          required: false
        - name: min_cable
          description: |
              The minimum cable length in nm a complete skeleton has to have, e.g.
              to exclude fragments.
          type: float
          paramType: form
          default: 0
          required: false
        - name: ignore_fragments
          description: |
              Whether skeletons without a node tagged 'soma' or 'out to nerve'
              should be ignored.
          type: bool
          paramType: form
          default: true
          required: false
docstring_tokens: Obtain completeness information for a set of skeleton IDs . --- paramaters : - name : project_id description : Project of skeletons type : integer paramType : path required : true - name : skeleton_ids description : IDs of the skeletons to get completeness for required : true type : array items : type : integer paramType : form - name : open_ends_percent description : The number of allowed open ends in range [ 0 1 ] . type : float paramType : form default : 0 . 03 required : false - name : min_nodes description : | The minimum number of nodes a complete skeleton has to have e . g . to exclude fragments . type : int paramType : form default : 500 required : false - name : min_cable description : | The minimum cable length in nm a complete skeleton has to have e . g . to exclude fragments . type : float paramType : form default : 0 required : false - name : ignore_fragments description : | Whether skeletons without a node tagged soma or out to nerve should be ignored . type : bool paramType : form default : true required : false
function: def completeness(request:HttpRequest, project_id) -> JsonResponse:
      """Obtain completeness information for a set of skeleton IDs.
      ---
      paramaters:
        - name: project_id
          description: Project of skeletons
          type: integer
          paramType: path
          required: true
        - name: skeleton_ids
          description: IDs of the skeletons to get completeness for
          required: true
          type: array
          items:
            type: integer
          paramType: form
        - name: open_ends_percent
          description: The number of allowed open ends in range [0,1].
          type: float
          paramType: form
          default: 0.03
          required: false
        - name: min_nodes
          description: |
              The minimum number of nodes a complete skeleton has to have, e.g. to
              exclude fragments.
          type: int
          paramType: form
          default: 500
          required: false
        - name: min_cable
          description: |
              The minimum cable length in nm a complete skeleton has to have, e.g.
              to exclude fragments.
          type: float
          paramType: form
          default: 0
          required: false
        - name: ignore_fragments
          description: |
              Whether skeletons without a node tagged 'soma' or 'out to nerve'
              should be ignored.
          type: bool
          paramType: form
          default: true
          required: false
      """
      if request.method == 'GET':
          data = request.GET
      elif request.method == 'POST':
          data = request.POST
      else:
          raise ValueError("Unsupported HTTP method: " + request.method)
  
      skeleton_ids = get_request_list(data, 'skeleton_ids', map_fn=int)
      if not skeleton_ids:
          raise ValueError('Need at least one skeleton ID')
  
      open_ends_percent = min(max(float(data.get('open_ends_percent', 0.03)), 0.0), 1.0)
      min_nodes = max(0, int(data.get('min_nodes', 500)))
      min_cable = max(0.0, float(data.get('min_cable', 0)))
      ignore_fragments = get_request_bool(data, 'ignore_fragments', True)
  
      completeness = get_completeness_data(project_id, skeleton_ids,
              open_ends_percent, min_nodes, min_cable, ignore_fragments)
  
      return JsonResponse(completeness, safe=False)
function_tokens: def completeness ( request : HttpRequest , project_id ) -> JsonResponse : if request . method == 'GET' : data = request . GET elif request . method == 'POST' : data = request . POST else : raise ValueError ( "Unsupported HTTP method: " + request . method ) skeleton_ids = get_request_list ( data , 'skeleton_ids' , map_fn = int ) if not skeleton_ids : raise ValueError ( 'Need at least one skeleton ID' ) open_ends_percent = min ( max ( float ( data . get ( 'open_ends_percent' , 0.03 ) ) , 0.0 ) , 1.0 ) min_nodes = max ( 0 , int ( data . get ( 'min_nodes' , 500 ) ) ) min_cable = max ( 0.0 , float ( data . get ( 'min_cable' , 0 ) ) ) ignore_fragments = get_request_bool ( data , 'ignore_fragments' , True ) completeness = get_completeness_data ( project_id , skeleton_ids , open_ends_percent , min_nodes , min_cable , ignore_fragments ) return JsonResponse ( completeness , safe = False )