# Modality WorkList Implementation Questions

**URL:** https://discourse.orthanc-server.org/t/modality-worklist-implementation-questions/1983
**Category:** Google Groups archive
**Created:** [June 15, 2020, 12:49am UTC](https://discourse.orthanc-server.org/t/modality-worklist-implementation-questions/1983 "2020-06-15T00:49:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sdscotti](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/sdscotti/32/2563_2.png) [@sdscotti](https://discourse.orthanc-server.org/u/sdscotti)
#### Post date: [June 15, 2020, 12:49am UTC](https://discourse.orthanc-server.org/t/modality-worklist-implementation-questions/1983/1 "2020-06-15T00:49:11Z")

</div>

Regarding the MWL.

I have a template for the MWL, and I can convert a .txt file to a .wl file using dcmtk. I also have a “ROOT” id that was obtained from IANA: e.g. 1.3.6.1.4.1.xxxxx, [IANA](https://www.iana.org/). Not sure that is necessary, but nice to have.

I cannot yet test in a live environment, but I have some questions about how to fully implement the MWL.

I did find the Orthanc DICOM conformance statement. [Orthanc DICOM conformance](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.7.1/Resources/DicomConformanceStatement.txt)

So I am not yet clear on how to create a valid MWL file in regards to some of the settings and how / if to use a custom ROOT id.

We would mostly be using CT, MRI and US. It isn’t clear to be what the values should be for a template, both in the header and the Data-set, although most in the dataset are clear.

Question are:

1. What values are actual values that can / should be used for the Header, using Orthanc 1.7.1 with or without a private ROOT ID ? Which ones are “static” and which ones are dynamic ?

2. For the Data-set: Most of the items there are self-explanatory, except for the `StudyInstanceUID:`

```(0020,000d) UI [’ . $this-\>DICOMROOT . ‘.’ . $this-\>device-\>id . '???] # 26, 1 StudyInstanceUID`

`Can we use our own ROOT ID and just guarantee that it is unique for a study (e.g. append the device id, date/time & some other params to identify a study), to generate a ```StudyInstanceUID, and how does that relate to the Orthanc DICOM conformance statement and the items in the header ?``

`3. What tags set in the MWL can actually be queried on later using the tools/find with the REST API ?`

`If that is out-of-scope for the forum, would be willing to pay a consultant to clarify that as we get close to live testing. For now, just need assistance in creating a valid .txt template for a MWL file. Thanks.`

`  
public function makeMWLFile () {

//print\_r($\_POST);

$template =  
'# Dicom-File-Format

# Dicom-Meta-Information-Header

# Used TransferSyntax: Little Endian Explicit

(0002,0000) UL 202 # 4, 1 FileMetaInformationGroupLength  
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion  
(0002,0002) UI [1.2.276.0.7230010.3.1.0.1] # 26, 1 MediaStorageSOPClassUID  
(0002,0003) UI [1.2.276.0.7230010.3.1.4.2831176407.11154.1448031138.805061] # 58, 1 MediaStorageSOPInstanceUID  
(0002,0010) UI =LittleEndianExplicit # 20, 1 TransferSyntaxUID  
(0002,0012) UI [1.2.276.0.7230010.3.0.3.6.0] # 28, 1 ImplementationClassUID  
(0002,0013) SH [OFFIS\_DCMTK\_360] # 16, 1 ImplementationVersionName

# Dicom-Data-Set

# Used TransferSyntax: Little Endian Explicit

(0008,0005) CS [’ . $this-\>CharSet . ‘] # 10, 1 SpecificCharacterSet  
(0008,0050) SH [’ . $this-\>AccessionNumber . ‘] # 6, 1 AccessionNumber  
(0008,0060) CS [’ . $this-\>Modality . ‘] # Modality  
(0010,0010) PN [’ . $this-\>PatientName . ‘] # 16, 1 PatientName  
(0010,0020) LO [’ . $this-\>PatientID . ‘] # 8, 1 PatientID  
(0010,0030) DA [’ . $this-\>PatientBirthDate . ‘] # 8, 1 PatientBirthDate  
(0010,0040) CS [’ . $this-\>PatientSex . ‘] # 2, 1 PatientSex  
(0010,2000) LO [’ . $this-\>MedicalAlerts . ‘] # 10, 1 MedicalAlerts Indication  
(0010,2110) LO [’ . $this-\>Allergies . ‘] # 6, 1 Allergies  
(0020,000d) UI [’ . $this-\>DICOMROOT . ‘.’ . $this-\>device-\>id . ‘???] # 26, 1 StudyInstanceUID  
(0032,1032) PN [’ . $this-\>RequestingPhysician . ‘] # 6, 1 RequestingPhysician  
(0032,1060) LO [’ . $this-\>RequestedProcedureDescription . ‘] # 6, 1 RequestedProcedureDescription  
(0040,0001) AE [’ . $this-\>ScheduleStationAETitle . ‘] # Station AET  
(0040,0002) DA [’ . $this-\>ScheduledProcedureStepStartDate . ‘] # Scheduled DATE  
(0040,0003) TM [’ . $this-\>ScheduledProcedureStepStartTime . ‘] # Scheduled TIME  
(0040,1001) SH [’ . $this-\>RequestedProcedureID . ‘] # 10, 1 RequestedProcedureID  
(0040,1003) SH [’ . $this-\>RequestedProcedurePriority . ‘] # 4, 1 RequestedProcedurePriority’;

//echo $template;dump2dcm.exe sampleWorklist.txt newWorklist.wl

file\_put\_contents (self::$ORTHANC\_MWL . “samplephp.txt”, $template);  
echo ‘[{“status”:“Sent to ORTHANC”}]’;  
self::dcmtk\_command('dump2dcm ’ . self::$ORTHANC\_MWL . "samplephp.txt " . self::$ORTHANC\_MWL . “samplephp.wl”);

}  
`

Sample Exanded Result for Study Query (Can you only query on the `MainDicomTags && ```PatientMainDicomTags using tools/find ?``

`"ID": "", "IsStable": true, "LastUpdate": "20200606T015632", "MainDicomTags": { "AccessionNumber": "", "InstitutionName": "" "ReferringPhysicianName": "", "RequestingPhysician": "", "StudyDate": "", "StudyDescription": "", "StudyID": "", "StudyInstanceUID": "", "StudyTime": "" }, "ParentPatient": "", "PatientMainDicomTags": { "OtherPatientIDs": "", "PatientBirthDate": "", "PatientID": "", "PatientName": "", "PatientSex": "" }, "Series": [""]`

---

<div class="post-metadata">

### Author: ![sdscotti](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/sdscotti/32/2563_2.png) [@sdscotti](https://discourse.orthanc-server.org/u/sdscotti)
#### Post date: [June 17, 2020, 2:11am UTC](https://discourse.orthanc-server.org/t/modality-worklist-implementation-questions/1983/2 "2020-06-17T02:11:38Z")

</div>

Just wanted to provide a follow up.

Like I said, I am able to create a .wl file, and I can also query the worklist using:

`findscu -W -aec CALLED_AET -k "(0040,0001)=AETITLE_MRI" 127.0.0.1 4242`

`  
That returns a response like:

I: ---------------------------  
I: Find Response: 1 (Pending)  
I:  
I: # Dicom-Data-Set  
I: # Used TransferSyntax: Little Endian Explicit  
I: (0008,0005) CS [ISO\_IR 192] # 10, 1 SpecificCharacterSet  
I: (0040,0001) AE [AETITLE\_MRI] # 12, 1 ScheduledStationAETitle  
I:  
`

in CLI mode. I did reach out to some of the consultants, but I think I really just need to know what some of the setting are for the things that I am not sure about. As far as naming the files is concerned, I could perhaps use the some parameter plus the datetime, but I might just want to use the accession\_number for the filename since if a person reschedules an exam I can just overwrite the file, and if they mark it as a No Show(NS), Cancelled, etc., I can just delete the file. I am using HL7 ORM messages originally, so I just extract most of the information needed for the MWL file from the HL7 message.

For now, I am mostly uncertain about what goes into the header:

`

'# Dicom-File-Format

# Dicom-Meta-Information-Header

# Used TransferSyntax: Little Endian Explicit

(0002,0000) UL 202 # 4, 1 FileMetaInformationGroupLength  
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion  
(0002,0002) UI [1.2.276.0.7230010.3.1.0.1] # 26, 1 MediaStorageSOPClassUID  
(0002,0003) UI [1.2.276.0.7230010.3.1.4.2831176407.11154.1448031138.805061] # 58, 1 MediaStorageSOPInstanceUID  
(0002,0010) UI =LittleEndianExplicit # 20, 1 TransferSyntaxUID  
(0002,0012) UI [1.2.276.0.7230010.3.0.3.6.0] # 28, 1 ImplementationClassUID  
(0002,0013) SH [OFFIS\_DCMTK\_360] # 16, 1 ImplementationVersionName  
`

`I won't be able to test live until the MRI scanner is hooked up, but at least the findscu query from the CLI seems to work.`

`BTW, I did seem to have a problem with the Worklist Plug-in finding the Worklist folder. I had to change the folder from just "WorklistsDatabase" to the FULL PATH to the Worklists folder. With the relative Path (to the Config file) I got an error.`

``  
`e.g.`

` `

`"Worklists" : {`  
`"Enable": true,`  
`"Database": "WorklistsDatabase" // Path to the folder with the worklist files`  
`},`

`to`

`"Worklists" : {`  
`"Enable": true,`  
`"Database": "/full/path/to/WorklistsDatabase" // Path to the folder with the worklist files`  
`},`

---

<div class="post-metadata">

### Author: ![Alain\_Mazy3](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Alain\_Mazy3](https://discourse.orthanc-server.org/u/Alain_Mazy3)
#### Post date: [June 17, 2020, 9:45am UTC](https://discourse.orthanc-server.org/t/modality-worklist-implementation-questions/1983/3 "2020-06-17T09:45:22Z")

</div>

Note that relative paths in the config files are actually relative to the working folder and not relative to the config file. To avoid any surprise, I usually only use absolute paths.
