scout/server/blueprints/cases/controllers.py
def mme_matches(case_obj, institute_obj, mme_base_url, mme_token):
    """Show Matchmaker submission data for a sample and eventual matches.

    Args:
        case_obj(dict): a scout case object
        institute_obj(dict): an institute object
        mme_base_url(str) base url of the MME server
        mme_token(str) auth token of the MME server

    Returns:
        data(dict): data to display in the html template
    """
    data = {
        'institute' : institute_obj,
        'case' : case_obj,
        'server_errors' : []
    }
    matches = {}
    # loop over the submitted samples and get matches from the MatchMaker server
    if not case_obj.get('mme_submission'):
        return None

    for patient in case_obj['mme_submission']['patients']:
        patient_id = patient['id']
        matches[patient_id] = None
        url = ''.join([ mme_base_url, '/matches/', patient_id])
        server_resp = matchmaker_request(url=url, token=mme_token, method='GET')
        if 'status_code' in server_resp: # the server returned a valid response
            # and this will be a list of match objects sorted by desc date
            pat_matches = []
            if server_resp.get('matches'):
                pat_matches = parse_matches(patient_id, server_resp['matches'])
            matches[patient_id] = pat_matches
        else:
            LOG.warning('Server returned error message: {}'.format(server_resp['message']))
            data['server_errors'].append(server_resp['message'])

    data['matches'] = matches

    return data
def mme_matches(case_obj, institute_obj, mme_base_url, mme_token):
    data = {
        'institute' : institute_obj,
        'case' : case_obj,
        'server_errors' : []
    }
    matches = {}
    # loop over the submitted samples and get matches from the MatchMaker server
    if not case_obj.get('mme_submission'):
        return None

    for patient in case_obj['mme_submission']['patients']:
        patient_id = patient['id']
        matches[patient_id] = None
        url = ''.join([ mme_base_url, '/matches/', patient_id])
        server_resp = matchmaker_request(url=url, token=mme_token, method='GET')
        if 'status_code' in server_resp: # the server returned a valid response
            # and this will be a list of match objects sorted by desc date
            pat_matches = []
            if server_resp.get('matches'):
                pat_matches = parse_matches(patient_id, server_resp['matches'])
            matches[patient_id] = pat_matches
        else:
            LOG.warning('Server returned error message: {}'.format(server_resp['message']))
            data['server_errors'].append(server_resp['message'])

    data['matches'] = matches

    return data
def mme_matches ( case_obj , institute_obj , mme_base_url , mme_token ) : data = { 'institute' : institute_obj , 'case' : case_obj , 'server_errors' : [ ] } matches = { } # loop over the submitted samples and get matches from the MatchMaker server if not case_obj . get ( 'mme_submission' ) : return None for patient in case_obj [ 'mme_submission' ] [ 'patients' ] : patient_id = patient [ 'id' ] matches [ patient_id ] = None url = '' . join ( [ mme_base_url , '/matches/' , patient_id ] ) server_resp = matchmaker_request ( url = url , token = mme_token , method = 'GET' ) if 'status_code' in server_resp : # the server returned a valid response # and this will be a list of match objects sorted by desc date pat_matches = [ ] if server_resp . get ( 'matches' ) : pat_matches = parse_matches ( patient_id , server_resp [ 'matches' ] ) matches [ patient_id ] = pat_matches else : LOG . warning ( 'Server returned error message: {}' . format ( server_resp [ 'message' ] ) ) data [ 'server_errors' ] . append ( server_resp [ 'message' ] ) data [ 'matches' ] = matches return data
Show Matchmaker submission data for a sample and eventual matches.

    Args:
        case_obj(dict): a scout case object
        institute_obj(dict): an institute object
        mme_base_url(str) base url of the MME server
        mme_token(str) auth token of the MME server

    Returns:
        data(dict): data to display in the html template
Show Matchmaker submission data for a sample and eventual matches .