def vscan_upload(request, domain, **kwargs): """ End point for uploading data from vscan. Expects scanner_serial and scan_id in params and a list of image/video files. """ scanner_serial = request.POST.get('scanner_serial', None) scan_id = request.POST.get('scan_id', None) response_code = None if not (scanner_serial and scan_id): response_data = {} response_data['result'] = 'failed' response_data['message'] = 'Missing required parameters' response_code = 500 else: upload = VscanUpload( scanner_serial=scanner_serial, scan_id=scan_id, ) upload.save() put_request_files_in_doc(request, upload) async_find_and_attach.delay(upload._id) response_data = {} response_data['result'] = 'success' response_data['message'] = '' return HttpResponse( json.dumps(response_data), content_type="application/json", status=response_code or 200 )
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")
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")