(object_type, object_id, analysis_id, result, type_, subtype,
                user)
return res
Add multiple results to an analysis task.

    :param object_type: The top-level object type.
    :type object_type: str
    :param object_id: The ObjectId to search for.
    :type object_id: str
    :param analysis_id: The ID of the task to update.
    :type analysis_id: str
    :param result: The list of result to append.
    :type result: list of str
    :param type_: The list of result types.
    :type type_: list of str
    :param subtype: The list of result subtypes.
    :type subtype: list of str
    :param user: The user updating the results.
    :type user: :class:`crits.core.user.CRITsUser`
    :returns: dict with keys "success" (boolean) and "message" (str) if failed.
Add multiple results to an analysis task.
Add multiple results to an analysis task .
def add_results(object_type, object_id, analysis_id, result, type_, subtype,
                user):
    """
    Add multiple results to an analysis task.

    :param object_type: The top-level object type.
    :type object_type: str
    :param object_id: The ObjectId to search for.
    :type object_id: str
    :param analysis_id: The ID of the task to update.
    :type analysis_id: str
    :param result: The list of result to append.
    :type result: list of str
    :param type_: The list of result types.
    :type type_: list of str
    :param subtype: The list of result subtypes.
    :type subtype: list of str
    :param user: The user updating the results.
    :type user: :class:`crits.core.user.CRITsUser`
    :returns: dict with keys "success" (boolean) and "message" (str) if failed.
    """

    res = {'success': False}
    if not object_type or not object_id or not analysis_id:
        res['message'] = "Must supply object id/type and analysis id."
        return res

    # Validate user can add service results to this TLO.
    klass = class_from_type(object_type)
    sources = user.get_sources_list()
    obj = klass.objects(id=object_id, source__name__in=sources).first()
    if not obj:
        res['message'] = "Could not find object to add results to."
        return res

    if not(result and type_ and subtype):
        res['message'] = "Need a result, type, and subtype to add a result."
        return res

    if not(len(result) == len(type_) == len(subtype)):
        res['message'] = "result, type, and subtype need to be the same length."
        return res

    # Update analysis results
    final_list = []
    for key, r in enumerate(result):
        final = {}
        final['subtype'] = subtype[key]
        final['result'] = r
        tmp = ast.literal_eval(type_[key])
        for k in tmp:
            final[k] = tmp[k]
        final_list.append(final)

    ar = AnalysisResult.objects(analysis_id=analysis_id).first()
    if ar:
        AnalysisResult.objects(id=ar.id).update_one(push_all__results=final_list)

    res['success'] = True
    return res
def add_results ( object_type , object_id , analysis_id , result , type_ , subtype , user ) : res = { 'success' : False } if not object_type or not object_id or not analysis_id : res [ 'message' ] = "Must supply object id/type and analysis id." return res # Validate user can add service results to this TLO. klass = class_from_type ( object_type ) sources = user . get_sources_list ( ) obj = klass . objects ( id = object_id , source__name__in = sources ) . first ( ) if not obj : res [ 'message' ] = "Could not find object to add results to." return res if not ( result and type_ and subtype ) : res [ 'message' ] = "Need a result, type, and subtype to add a result." return res if not ( len ( result ) == len ( type_ ) == len ( subtype ) ) : res [ 'message' ] = "result, type, and subtype need to be the same length." return res # Update analysis results final_list = [ ] for key , r in enumerate ( result ) : final = { } final [ 'subtype' ] = subtype [ key ] final [ 'result' ] = r tmp = ast . literal_eval ( type_ [ key ] ) for k in tmp : final [ k ] = tmp [ k ] final_list . append ( final ) ar = AnalysisResult . objects ( analysis_id = analysis_id ) . first ( ) if ar : AnalysisResult . objects ( id = ar . id ) . update_one ( push_all__results = final_list ) res [ 'success' ] = True return res