Beispiel #1
0
def async_create_case(upload_id):
    """
    Task backend for sonosite upload
    """

    upload_doc = SonositeUpload.get(upload_id)
    files = get_files_from_doc(upload_doc)
    create_case(upload_doc.related_case_id, files)

    upload_doc.delete()
Beispiel #2
0
def async_create_case(upload_id):
    """
    Task backend for sonosite upload
    """

    upload_doc = SonositeUpload.get(upload_id)
    files = get_files_from_doc(upload_doc)
    create_case(upload_doc.related_case_id, files)

    upload_doc.delete()
Beispiel #3
0
def sonosite_upload(request, domain, **kwargs):
    """
    End point for uploading data from sonosite.

    Expects the PT_PPS.XML file with patient data and
    images/videos.
    """

    response_data = {}

    try:
        config_file = request.FILES['PT_PPS.XML'].read()
    except Exception as e:
        response_data['result'] = 'failed'
        response_data['message'] = 'Could not load config file: %s' % (
            e.message)
        return HttpResponse(json.dumps(response_data),
                            content_type="application/json",
                            status=500)

    case_id = get_case_id(config_file)
    study_id = get_study_id(config_file)

    upload = SonositeUpload(
        study_id=study_id,
        related_case_id=case_id,
    )
    upload.save()

    put_request_files_in_doc(request, upload)

    async_create_case.delay(upload._id)

    response_data['result'] = 'uploaded'
    response_data['message'] = 'uploaded'
    return HttpResponse(json.dumps(response_data),
                        content_type="application/json")
Beispiel #4
0
def sonosite_upload(request, domain, **kwargs):
    """
    End point for uploading data from sonosite.

    Expects the PT_PPS.XML file with patient data and
    images/videos.
    """

    response_data = {}

    try:
        config_file = request.FILES['PT_PPS.XML'].read()
    except Exception as e:
        response_data['result'] = 'failed'
        response_data['message'] = 'Could not load config file: %s' % (e.message)
        return HttpResponse(
            json.dumps(response_data),
            content_type="application/json",
            status=500
        )

    case_id = get_case_id(config_file)
    study_id = get_study_id(config_file)

    upload = SonositeUpload(
        study_id=study_id,
        related_case_id=case_id,
    )
    upload.save()

    put_request_files_in_doc(request, upload)

    async_create_case.delay(upload._id)

    response_data['result'] = 'uploaded'
    response_data['message'] = 'uploaded'
    return HttpResponse(json.dumps(response_data), content_type="application/json")