def test_store(pacs_srv: pacs.PACS): ds = Dataset() ds.SpecificCharacterSet = 'ISO_IR 192' ds.PatientID = 'test_id' ds.PatientName = 'Store^Store^Stor' ds.PatientBirthDate = '19800101' ds.StudyInstanceUID = '1.2.5' ds.StudyDate = '20200301' ds.StudyTime = '101010' ds.SeriesInstanceUID = '1.2.5.6' ds.Modality = 'CT' ds.SOPInstanceUID = '1.2.5.6' ds.SOPClassUID = '2.3.4' pacs_srv.c_store(ds) request = Dataset() request.PatientName = 'Store^*' request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'IMAGE' request.StudyInstanceUID = None request.SeriesInstanceUID = None request.SOPInstanceUID = None request.Modality = None results = list(pacs_srv.c_find(request)) assert len(results) == 1
def test_patient_find_text_filter_negative(pacs_srv: pacs.PACS): request = Dataset() request.PatientSex = None request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'PATIENT' request.PatientName = 'Test1^*' assert not list(pacs_srv.c_find(request))
def test_study_find_patient_attrs_with_filters_negative(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = 'Test1^*' request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'STUDY' request.AccessionNumber = '1234' assert not list(pacs_srv.c_find(request))
def test_study_find_no_patient_attrs(pacs_srv: pacs.PACS): request = Dataset() request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'STUDY' request.AccessionNumber = '1234' results = list(pacs_srv.c_find(request)) assert len(results) == 1 assert results[0].AccessionNumber == '1234'
def test_patient_find_date_range_negative(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = None request.PatientSex = None request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'PATIENT' request.PatientBirthDate = '19670101-19680102' assert not list(pacs_srv.c_find(request))
def test_patient_find_text_filter_positive(pacs_srv: pacs.PACS): request = Dataset() request.PatientSex = None request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'PATIENT' request.PatientName = 'Test^*' for patient in pacs_srv.c_find(request): assert patient.PatientName == 'Test^Test^Test' assert patient.PatientSex == 'M'
def test_series_find_patient_filter(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = 'Test^*' request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'SERIES' request.SeriesInstanceUID = None request.Modality = None results = list(pacs_srv.c_find(request)) assert len(results) == 4
def test_study_find_modalities_in_study_no_filter(pacs_srv: pacs.PACS): request = Dataset() request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'STUDY' request.AccessionNumber = '1234' request.ModalitiesInStudy = None results = list(pacs_srv.c_find(request)) assert len(results) == 1 assert results[0].ModalitiesInStudy == ['DX', 'SR']
def test_study_find_patient_attrs_with_filters_positive(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = 'Test^*' request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'STUDY' request.AccessionNumber = '1234' results = list(pacs_srv.c_find(request)) assert len(results) == 1 assert results[0].AccessionNumber == '1234' assert results[0].PatientName == 'Test^Test^Test'
def test_patient_find_date_range_positive(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = None request.PatientSex = None request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'PATIENT' request.PatientBirthDate = '19650101-19660102' for patient in pacs_srv.c_find(request): assert patient.PatientName == 'Test^Test^Test' assert patient.PatientSex == 'M'
def test_patient_find_with_count(pacs_srv: pacs.PACS): request = Dataset() request.PatientName = None request.PatientSex = None request.SpecificCharacterSet = 'ISO_IR 192' request.QueryRetrieveLevel = 'PATIENT' request.NumberOfPatientRelatedStudies = None for patient in pacs_srv.c_find(request): assert patient.PatientName == 'Test^Test^Test' assert patient.PatientSex == 'M' assert patient.NumberOfPatientRelatedStudies == 2