I am not very familiar with python nor with the particular DICOM toolkit you are using. I dare to answer because the exception appears to be pretty clear - the toolkit does not seem to support the Study Root Query Information model.
DICOM queries come in four flavours which are called information models:
- Modality Worklist (that's a different story)
- Patient Root
- Study Root
- Patient Study Only (not very popular in commercial products, has been retired)
Source: DICOM PS3.4
As the name tells, Patient- and Study Root differ in terms of what is the root element from which you start to search down the hierarchy (Patient -> Study -> Series -> Image) in subsequent queries.
Patient Root starts on the patient level, so you first search for criteria on the patient level and have patient level results. With the patient ID obtained from the results you go down to the study level to query for studies of the particular patient.
Study Root treats the patient level attributes as secondary study attributes, i.e. you are asking for studies and you receive the attributes of the patient each study belongs to for each study (meaning that you may receive the same patient twice for different studies which makes the difference to Patient Root).
I agree that a study root is what you want to have for your use case, but unfortunately the toolkit you are using apparently only supports Patient Root. According to the error message it's a problem on the client (SCU) side, so dcm4chee is not to blame.
How to solve this?
You might find a different toolkit supporting StudyRoot. Actually to me the absence of Study Root support puts the fitness for practical usage in question to me.
You might want to go the dirty way and try to form a non DICOM conformant query in Patient Root looking like this:
- Q/R-Level = "STUDY"
- Patient-ID = "*" or empty
- Study Date = <your date range>
There is a fair chance that this is going to work, however, keep in mind, it is not DICOM conformant, so it depends on the SCP implementation and may vary between different products.
For the sake of completeness: You may put a query on patient level and for each patient received put a subsequent query on study level giving the patient-ID and your study date range as matching criteria. Not worth mentioning that this is going to fail for performance issues but it would be the DICOM conformance way to solve the issue.