def testRelatedMethods(self):
     patient_config = self.files['PT_PPS.XML'].read()
     self.assertEqual(
         'JHUYIIYIUIY',
         utils.get_case_id(patient_config)
     )
     self.assertEqual(
         '1.2.840.114340.03.000008251017183037.2.20130821.094421.0000080',
         utils.get_study_id(patient_config)
     )
Exemple #2
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")
Exemple #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")
Exemple #4
0
 def testRelatedMethods(self):
     patient_config = self.files['PT_PPS.XML'].read()
     self.assertEqual('JHUYIIYIUIY', utils.get_case_id(patient_config))
     self.assertEqual(
         '1.2.840.114340.03.000008251017183037.2.20130821.094421.0000080',
         utils.get_study_id(patient_config))