def get_analysis_types(adapter, total_cases, institute_id=None, slice_query=None):
    """ Return information about analysis types.
        Group cases based on analysis type for the individuals.
    Args:
        adapter(adapter.MongoAdapter)
        total_cases(int): Total number of cases
        institute_id(str)
        slice_query(str): Query to filter cases to obtain statistics for.
    Returns:
        analysis_types array of hashes with name: analysis_type(str), count: count(int)

    """
    # Group cases based on analysis type of the individuals
    query = {}

    subquery = {}
    if institute_id and slice_query:
        subquery = adapter.cases(owner=institute_id, name_query=slice_query,
                              yield_query=True)
    elif institute_id:
        subquery = adapter.cases(owner=institute_id, yield_query=True)
    elif slice_query:
        subquery = adapter.cases(name_query=slice_query, yield_query=True)

    query = {'$match': subquery}

    pipeline = []
    if query:
        pipeline.append(query)

    pipeline.append({'$unwind': '$individuals'})
    pipeline.append({'$group': {'_id': '$individuals.analysis_type', 'count': {'$sum': 1}}})
    analysis_query = adapter.case_collection.aggregate(pipeline)
    analysis_types = [{'name': group['_id'], 'count': group['count']} for group in analysis_query]

    return analysis_types
def get_analysis_types(adapter, total_cases, institute_id=None, slice_query=None):
    """ Return information about analysis types.
        Group cases based on analysis type for the individuals.
    Args:
        adapter(adapter.MongoAdapter)
        total_cases(int): Total number of cases
        institute_id(str)
        slice_query(str): Query to filter cases to obtain statistics for.
    Returns:
        analysis_types array of hashes with name: analysis_type(str), count: count(int)

    """
    # Group cases based on analysis type of the individuals
    query = {}

    subquery = {}
    if institute_id and slice_query:
        subquery = adapter.cases(owner=institute_id, name_query=slice_query,
                              yield_query=True)
    elif institute_id:
        subquery = adapter.cases(owner=institute_id, yield_query=True)
    elif slice_query:
        subquery = adapter.cases(name_query=slice_query, yield_query=True)

    query = {'$match': subquery}

    pipeline = []
    if query:
        pipeline.append(query)

    pipeline.append({'$unwind': '$individuals'})
    pipeline.append({'$group': {'_id': '$individuals.analysis_type', 'count': {'$sum': 1}}})
    analysis_query = adapter.case_collection.aggregate(pipeline)
    analysis_types = [{'name': group['_id'], 'count': group['count']} for group in analysis_query]

    return analysis_types
def get_analysis_types ( adapter , total_cases , institute_id = None , slice_query = None ) : # Group cases based on analysis type of the individuals query = { } subquery = { } if institute_id and slice_query : subquery = adapter . cases ( owner = institute_id , name_query = slice_query , yield_query = True ) elif institute_id : subquery = adapter . cases ( owner = institute_id , yield_query = True ) elif slice_query : subquery = adapter . cases ( name_query = slice_query , yield_query = True ) query = { '$match' : subquery } pipeline = [ ] if query : pipeline . append ( query ) pipeline . append ( { '$unwind' : '$individuals' } ) pipeline . append ( { '$group' : { '_id' : '$individuals.analysis_type' , 'count' : { '$sum' : 1 } } } ) analysis_query = adapter . case_collection . aggregate ( pipeline ) analysis_types = [ { 'name' : group [ '_id' ] , 'count' : group [ 'count' ] } for group in analysis_query ] return analysis_types
Return information about analysis types.
        Group cases based on analysis type for the individuals.
    Args:
        adapter(adapter.MongoAdapter)
        total_cases(int): Total number of cases
        institute_id(str)
        slice_query(str): Query to filter cases to obtain statistics for.
    Returns:
        analysis_types array of hashes with name: analysis_type(str), count: count(int)
Return information about analysis types . Group cases based on analysis type for the individuals . Args : adapter ( adapter . MongoAdapter ) total_cases ( int ) : Total number of cases institute_id ( str ) slice_query ( str ) : Query to filter cases to obtain statistics for . Returns : analysis_types array of hashes with name : analysis_type ( str ) count : count ( int )