scout/server/blueprints/cases/controllers.py
def mme_delete(case_obj, mme_base_url, mme_token):
    """Delete all affected samples for a case from MatchMaker

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

    Returns:
         server_responses(list): a list of object of this type:
                    {
                        'patient_id': patient_id
                        'message': server_message,
                        'status_code': server_status_code
                    }
    """
    server_responses = []

    if not mme_base_url or not mme_token:
        return 'Please check that Matchmaker connection parameters are valid'

    # for each patient of the case in matchmaker
    for patient in case_obj['mme_submission']['patients']:

        # send delete request to server and capture server's response
        patient_id = patient['id']
        url = ''.join([mme_base_url, '/patient/delete/', patient_id])
        resp = matchmaker_request(url=url, token=mme_token, method='DELETE', )

        server_responses.append({
            'patient_id': patient_id,
            'message': resp.get('message'),
            'status_code': resp.get('status_code')
        })

    return server_responses
def mme_delete(case_obj, mme_base_url, mme_token):
    """Delete all affected samples for a case from MatchMaker

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

    Returns:
         server_responses(list): a list of object of this type:
                    {
                        'patient_id': patient_id
                        'message': server_message,
                        'status_code': server_status_code
                    }
    """
    server_responses = []

    if not mme_base_url or not mme_token:
        return 'Please check that Matchmaker connection parameters are valid'

    # for each patient of the case in matchmaker
    for patient in case_obj['mme_submission']['patients']:

        # send delete request to server and capture server's response
        patient_id = patient['id']
        url = ''.join([mme_base_url, '/patient/delete/', patient_id])
        resp = matchmaker_request(url=url, token=mme_token, method='DELETE', )

        server_responses.append({
            'patient_id': patient_id,
            'message': resp.get('message'),
            'status_code': resp.get('status_code')
        })

    return server_responses
Delete all affected samples for a case from MatchMaker

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

    Returns:
         server_responses(list): a list of object of this type:
                    {
                        'patient_id': patient_id
                        'message': server_message,
                        'status_code': server_status_code
                    }