DICOMcloud icon indicating copy to clipboard operation
DICOMcloud copied to clipboard

How to store dicom files from multiple hospitals?

Open wangning08115 opened this issue 4 years ago • 13 comments

How to store dicom files from multiple hospitals?

My dicom files from multiple hospitals, So Their StudyID and PatientID may be duplicated. No i found DICOMcloud store one dicom file use PatientID, But if dicom files from multiple hospitals PatientID may be duplicated. Then the two Patient will be hybrid.

How to solve this problem?

wangning08115 avatar May 22 '20 01:05 wangning08115

@Zaid-Safadi Hi,can you help me?

wangning08115 avatar May 23 '20 01:05 wangning08115

are you storing the files using STOW-RS ?

DANIELMWAMBI avatar May 23 '20 09:05 DANIELMWAMBI

if your using STOW-RS you can have a look into the WebObjectStoreService.cs class in the Dicom.Wado project in the Services folder.

DANIELMWAMBI avatar May 23 '20 10:05 DANIELMWAMBI

Yes, I use DICOMcloud project's STOW-RS to post dicom file . How to store dicom files from multiple hospitals? I think i can change WebObjectStoreService.cs class, I add one new filed named hospital_id in Patient Study Table , and when post file, add hospital_id parameter to url. So the table can Distinguish between hospital. And change all the DICOMcloud project's Controller , add hospital_id parameter to url.

Does my idea work?

And i have other Question: one Patient's one Study has more than 100 dicom files. The files more than 100MB. If use STOW-RS "class WebStoreRequest : MultipartRelatedStreamProvider, IWebStoreRequest", The WebStoreRequest will too big than 100MB. I find if WebStoreRequest is too big. The web http post is Easy to get wrong.
So i think can i post dicom file one by one. Then the one http post is small.

wangning08115 avatar May 24 '20 04:05 wangning08115

if the files are from multiple hospitals and large,then you can create a C-Store SCP that saves dicom files in the same structure as DicomCloud and also saves the record to the database. You can use fo-dicom to create the C-Store SCP. They also have samples to get you started

https://github.com/fo-dicom/fo-dicom-samples

DANIELMWAMBI avatar May 24 '20 07:05 DANIELMWAMBI

https://github.com/fo-dicom/fo-dicom-samples/blob/master/Desktop/C-Store%20SCP/Program.cs

DANIELMWAMBI avatar May 24 '20 07:05 DANIELMWAMBI

      public DicomCStoreResponse OnCStoreRequest(DicomCStoreRequest request){
            var studyUid = request.Dataset.GetSingleValue<string>(DicomTag.StudyInstanceUID);
            var instUid = request.SOPInstanceUID.UID;
            var path = Path.GetFullPath(Program.StoragePath);
            path = Path.Combine(path, studyUid);
            if (!Directory.Exists(path)) Directory.CreateDirectory(path);
            path = Path.Combine(path, instUid) + ".dcm";
            request.File.Save(path);
            return new DicomCStoreResponse(request, DicomStatus.Success);
        }

you can modify the above method to save to the path which you dicom cloud reads from and also insert the record into the data base

DANIELMWAMBI avatar May 24 '20 07:05 DANIELMWAMBI

Thanks i will try.

wangning08115 avatar May 24 '20 08:05 wangning08115

@DANIELMWAMBI I have one Question: Is Dicom File's StudyInstanceUid the only one in the world? I'm afraid it will repeat in multiple hospitals.

wangning08115 avatar May 25 '20 01:05 wangning08115

StudynstanceUid is globally unique and shouldn't repeat.

However, if you are planning to store several hospitals information, it is not as simple and you need to design your strategy first and understand the consequences of each option (regardless whether using C-Store or STOW-RS).

First, how do you identify which hospital the studies are coming from? is it the "issuer of patient id" tag, is it the station name...?

Second, is storing in the same database the best way to go or should you use separate databases (switch connection string on the flay based on the hospital...)? same apply to the storage folder...

If storing everything to the same database, then you need to update the primary keys and use this unique tag to amend each table with the source hospital id (again, same for the storage folder).

Then finally comes the query to solve, when someone query your PACS, how are you identifying which record need to be accessed? if this is a production data and your hospital is querying, then you need to be 10000% sure you are not mixing data in the results from other hospitals.

My recommendation is to think about all these options before starting to update the code and database.

Zaid-Safadi avatar May 25 '20 01:05 Zaid-Safadi

@Zaid-Safadi can mapping different hospitals to different ports on the C-Store SCP and then use a single database be a good approach?

DANIELMWAMBI avatar May 25 '20 05:05 DANIELMWAMBI

Thank you for everyone , I am now plan to : After learning, I plan to transform a high-performance project to support multi-hospital and high-performance batch large file writing. I will store data in a database and use hospital code to distinguish data sources.

In my reality situation, I have more than one hundred hospitals, tens of thousands of examinations every day, each physical examination has 200 Dicom files, each examination file size is 500MB(contains more than 200 dicom file once examination)

wangning08115 avatar Nov 16 '22 10:11 wangning08115

@wangning08115, is this question still open? Do you have a design to support your plan, and do you mind sharing it?

Zaid-Safadi avatar Dec 04 '22 01:12 Zaid-Safadi