XDSdemo Configuration Instructions
XDSdemo is a stand-alone program for distributing DICOM images and documents for the XDS demo.
1 Directory Structure
The program's directory contains the following files and directories:
- XDSdemo.jar - the executable jar file for the program.
- config.xml - the demo configuration file.
- config.properties - the persistent properties.
- test-config.xml - a configuration file for use in software development.
- vc-config.xml - a configuration file for use in the virtual connectathon.
- example-config.xml - an example configuration file.
- addresses.xml - the set of addresses for registrations.
- registrations.xml - the database of registrations.
- log4j.jar - the program library for error logging.
- log4j.properties - the configuration file for log4j.
- dcm4che.jar - the DICOM library.
- other jar files - software libraries.
- studies - the directory containing the DICOM studies to be used in the demonstration.
- docsets - the directory containing the document sets to be used in the demonstration.
- example-studies - a directory containing some test studies.
- example-docsets - a directory containing a test document set.
- ROOT - the root directory of the HTTP server.
- stylesheets - the directory containing the XSL stylesheets used by the KOS uploading function.
The ROOT directory is the base directory for the HTTP server and the root of the servlet paths.
It contains the following files and directories:
- example-index.html - an example of an index.html page containing links to XDSdemo servlets.
- help.html - this help page.
- registration - the base directory of the registration servlet.
- pdq - the base directory of the demographic query servlet.
- messages - the base directory of the messages servlet.
2 XDSdemo.jar
The program can be run on a Windows system by double-clicking this file.
If it is desired to monitor any possible error log entries (for example, by the DICOM library), the program should be run from a command window using the command:
If memory problems are experienced during operation, it may be necessary to increase the heap space available for Java. This can be accomplished by adding the mx and ms parameters to the command:
- java -Xms256m -Xmx256m -jar XDSdemo.jar
On a Windows system, these parameters can be added to the default start parameters for the jar file type so they will be applied when the program is started by double-clicking the jar file.
3 config.xml
When the program starts, it loads the config.xml file. If the file is not present, it copies the example-config.xml file into config.xml and then loads the configuration. This allows upgrades to be done without overwriting existing configuration files.
The configuration file contains all the information necessary to define the demonstration. It is an XML file which can be edited with any text editor. Special care must be taken that the file be well-formed. Note that the assigning authority attributes in the file contain ampersands which must be escaped in the file as shown below. After editing the file, it is wise to open it in a program that will parse the file and report errors. One such program is Internet Explorer. The configuration file has the following structure:
<config
askOnClose="no"
uidRoot="1.2.3.4.5.6.7"
logDepth="100"
serverPort="80"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"
localAssigningAuthority="RSNA_LOCAL&1.2.6.1.4.1.21367.2005.1.2&ISO">
<registry id="Registry1"
hl7URL="http://localhost:3900"
receivingApplication="Registry1"
receivingFacility="facility"
acceptsITI8withGlobalID="yes"
acceptsITI8withLocalID="no"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"/>
<pixmgr id="PIXMgr1"
hl7URL="http://localhost:3900"
receivingApplication="PIXMgr1"
receivingFacility="facility"
acceptsITI8withGlobalID="yes"
acceptsITI8withLocalID="no"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"/>
<pdqmgr id="PDQMgr1"
hl7URL="http://localhost:3900"
receivingApplication="PDQMgr1"
receivingFacility="facility"
acceptsITI8withGlobalID="yes"
acceptsITI8withLocalID="no"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"/>
<repository id="Repository1"
soapURL="http://localhost:3901"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"
docsetDelay="10000"/>
<ehrsystem id="EHRSystem1"
hl7URL="http://localhost:3900"
receivingApplication="EHRSystem1"
receivingFacility="facility"
acceptsITI8withGlobalID="no"
acceptsITI8withLocalID="no"
sendsITI8withLocalID="no"
acceptsRAD1="no"
acceptsMessages="no"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"
localAssigningAuthority="RSNA_LOCAL1&1.2.6.1.4.1.21367.2005.1.2&ISO">
<hl7 msg="ITI8" segment="PV1" seq="7" value="PV1-7 value"/>
<hl7 msg="ITI8" segment="PV1" seq="9" value="PV1-9 value"/>
</ehrsystem>
<dcmsystem id="DCMSystem1"
hl7URL="http://localhost:3900"
receivingApplication="DCMSystem1"
receivingFacility="facility"
acceptsITI8withGlobalID="no"
acceptsITI8withLocalID="no"
sendsITI8withLocalID="no"
acceptsRAD1="yes"
acceptsRAD4="yes"
dcmURL="dicom://TCE:XDSDEMO@localhost:104"
sendsKOS="yes"
repositoryID="Repository1"
retrieveAET="RetrieveAETitle"
institutionName="Hospital 1">
pointOfCare="WestTower"
globalAssigningAuthority="RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO"
localAssigningAuthority="RSNA_LOCAL2&1.2.6.1.4.1.21367.2005.1.3&ISO">
<hl7 msg="RAD1" segment="PV1" seq="7" value="PV1-7 value"/>
<hl7 msg="RAD1" segment="PV1" seq="9" value="PV1-9 value"/>
<hl7 msg="RAD4" segment="PV1" seq="6" value="PV1-6 value"/>
</dcmsystem>
<study id="Study1"
dcmsystemID="DCMSystem1"
directory="studies/study1"
date="20000101"
description="..."
placerOrderAuthority="XDSDEMO_ORDPLC"
fillerOrderAuthority="XDSDEMO_ORDFIL"
enteringOrganization="922229-10^IHE-RAD^IHE-CODE-231"
procedureCode="P1^Procedure 1^XDSDEMO"
localProcedureCode="X1_A1^SP Action Item X1_A1^DSS_XDSDEMO" />
<docset id="DocSet1"
repositoryID="Repository1"
directory="docsets/docset1"
document="document1.xml"
template="xmlToFO.xsl"
metadata="metadata1.xml"
title="Document Title"
date="20000101"
institutionName="Hospital 1"/>
<docset id="DocSet2"
repositoryID="Repository1"
directory="docsets/docset2"
title="ECG Study"
date="*"
institutionName="Hospital 2"/>
<message id="Message1"
ehrsystemID="EHRSystem1"
file="messages/message1"/>
</config>
Notes:
- askOnClose defines whether the program asks the user if he is sure he wants to stop the application when the close box is clicked.
- uidRoot is the root from which the program creates replacement UIDs for each transmission. The uidRoot should be a real UID obtained from an authority.
- logDepth defines the size of the circular buffer of log entries. A reasonable value is a few hundred. The default size is 100.
- serverPort defines the port on which the HTTP server listens for GETs and POSTs. The default is port 80. Two conditions may require using a different port:
- If the program is run on a system which is also running a web server, port 80 may be in use.
- If the program is run on a Unix system, port 80 may not be allowed.
- The config element's globalAssigningAuthority attribute specifies the default Global Assigning Authority string which is used if the configuration for a system does not include a globalAssigningAuthority attribute. The default value is "RSNA_GLOBAL&1.2.6.1.4.1.21367.2005.1.1&ISO".
- The config element's localAssigningAuthority specifies the default Local Assigning Authority string which is used if the configuration for a system does not include a localAssigningAuthority attribute. The default value is "RSNA_LOCAL&1.2.6.1.4.1.21367.2005.1.1&ISO".
- Each individual system must be represented by an element identifying its type (PIX Manager, PDQ Manager, Repository, EHR System, and DICOM System) and providing the attributes of the system. The id attributes of these elements must be unique within the entire demonstration. One element of each system type is shown in the example above.
- The hl7URL attributes must start with the http protocol even though the protocol is not used.
- Each system has two attributes to determine whether the Registration Servlet is to send ITI8 messages to the system. If acceptsITI8withGlobalID is set to anything other than "no", an ITI8 containing the patient's global ID is sent to the system when the patient is registered. The acceptsITI8withLocalID does the same thing with the local ID. Typical values for each system type are specified in the example.
- The receivingApplication and receivingFacility attributes specify the values to be used in the MSH segments of HL7 messages sent to the system. The corresponding sending fields are "XDSDEMO_ADT" and "XDSDEMO" for ITI8 and RAD1 messages and "XDSDEMO_OF" and "XDSDEMO" for RAD4 messages.
- Each system element may contain an optional timeout attribute specifying the maximum time in milliseconds to wait for a response from the system when an HL7 message is transmitted. If the attribute is missing, zero is assigned. A value of zero is interpreted to be the default value (5000 ms).
- Each system element may contain hl7 child elements to define additional fields to be added to HL7 messages sent to the system. These elements are optional and are intended only to support systems which require special fields values not required by the IHE technical framework. Examples are shown in the ehrsystem and dcmsystem elements above, but they can appear in any system element.
- A system element's globalAssigningAuthority specifies the Global Assigning Authority string which is used when sending HL7 messages to or from the system. If the attribute is missing, the default value is used. Systems which have the same globalAssigningAuthority attribute value will be given the same global ID for a patient. This attribute effectively segregates systems into multiple demonstrations on the basis of their Global Assigning Authority values. If only one demonstration is being managed by the XDSdemo application, the globalAssigningAuthority attributes of the system elements can be omitted, causing the default value to be used for all systems.
- The ehrsystem and dcmsystem elements have a localAssigningAuthority attribute that specifies the Local Assigning Authority string which is used when sending HL7 messages to or from the system. If the attribute is missing, the default value is used. Systems which have the same localAssigningAuthority attribute value will be given the same local ID for a patient. In order to generate different local IDs for a patient on each system, all the systems must have different localAssigningAuthority values.
- The ehrsystem and dcmsystem elements also have a sendsITI8withLocalID attribute that determines whether an ITI8 containing the local ID is to be sent to all PIX Managers (in the same Global Assigning Authjority) that accept such messages. The Registration Servlet only sends one such ITI8 (to each destination) for all the systems sharing a single localAssigningAuthority. This feature is intended to allow local affinity domains to be individually configured whether to supply local IDs to the PIX Managers.
- The ehrsystem and dcmsystem elements also have an acceptsMessages attribute that determines whether the system will receive HL7 messages that are specially constructed from XML files. These messages are typically used for referrals or discharge summaries, but they can be used to construct any type of HL7 message. Any value except "yes" is interpreted as "no".
- DICOM Systems have additional attributes that define whether they accept ORM messages and whether the XDSdemo program is to transmit the KOS to the assigned Repository after images are sent to the DICOM System. For all these attributes, any value except "no" is interpreted as "yes".
- All systems have a startupDelay attribute that determines the length of time (in milliseconds) to delay before starting its thread that handles a registration. Each system has an independent thread, and in some cases, for example when a single PIX Manager is servicing multiple global affinity domains (where the physical system is represented in the configuration by multiple pixmgr elements - one for each Global Assigning Authority), it is necessary to delay the threads by different times to prevent the system from receiving too many HL7 connections at once. If the startupDelay attribute is missing, no delay is used.
- PIX Managers and Registries also have a connectionInterval attribute that determines the minimum time (in milliseconds) between HL7 connections to the system. The default value is zero.
- Repositories have a docsetDelay attribute that determines the length of time (in milliseconds) to delay before the docsets are processed. The purpose of this attribute is to give time for registries to process registrations before receiving requests for patient IDs associated with reports. If the docsetDelay attribute is missing, no delay is used.
- Each study element references a single DICOM System through the dcmsystemID attribute.
- Each docset element references a single Repository through the repositoryID attribute.
- For both studies and document sets, the directory attribute specifies the path to the directory containing its files. The path can be absolute or relative to the directory containing the program.
- For both studies and document sets, the date attribute specifies the value used to replace the date elements in DICOM studies and document sets before transmission. The value must be a valid DICOM date (YYYYMMDD). If the value is an asterisk, the program uses the current date.
- The template attribute of the docset element specifies the name of the XSL transformation file that converts the DocSet's XML file into a Formatting Objects file before conversion to a PDF. This allows each document to have a different format if desired.
- DocSets must contain one XML file to define the content of the document. This file may contain elements that instruct the template XSL file to insert specific values from the registration into the Formatting Objects file (for example, patient name, patient ID, etc.).
4 addresses.xml
The addresses.xm file contains a set of addresses to be supplied to registrants. The set is treated as a circular buffer. Each registration is given the next address in line, wrapping back to the beginning when the end of the list is reached. As the demonstration progresses, therefore, the distribution of addresses will be the same as the distribution in the set. The format of the file is:
<addresses>
<address
sex="M" or "F"
street="Elm St."
city="Smallville"
state="KA"
zip="55555"
country="US" />
<address
street="State St."
city="Hampshire"
state="IL"
zip="60104"
country="US" />
...etc...
</addresses>
If a sex attribute is present with a value of "M" or "F", it applies only to registrations of the corresponding sex. If a sex attribute is not present or if it has any other value, it applies to registrations of either sex.
The country attribute is optional. The default is US.
Street addresses should not include house numbers. When the addresses.xml file is parsed, the street addresses are separated from the rest of the addresses, and any non-blank street addresses are added to a list. When a registration is received, a random selection of street, with a randomly generated house number, is applied to the next city/state/zip/country. Thus, not all address elements must include a street attribute, but at least one street attribute must be present somewhere in the file.
5 DICOM Studies
The studies directory contains one subdirectory for each DICOM study. Each subdirectory must contain only the DICOM instances to be processed and transmitted. Note that a studies subdirectory can be referenced by multiple study elements in the config.xml file.
6 Document Sets
The docsets directory contains one subdirectory for each document. A docsets subdirectory can be referenced by multiple docset elements in the config.xml file. Each subdirectory contains the following files:
- pdfSource.xml: The XML file containing the text and image references necessary for creation of the PDF file. This file is only present for docsets which create PDF documents and encapsulate them within a CDA document.
- Any image files referenced by the pdfSource.xml file which are to be included in the PDF document.
- cdaSource.xml: The XML file which contains the source of the CDA which is created for transmission to the Repository.
- metadataSource.xml: The XML file containing the SOAP metadata for transmission to the Repository.
Each of the source files can contain special elements which insert information from the configuration or the registration into the constructed document, allowing different documents to be created from the same instructions.
7 Messages
The messages directory contains one XML file for each message to be constructed. A message file can be referenced by multiple message elements in the config.xml file. A message file defines a single HL7 message as in this example:
<a03>
<msh>
<seq n="9">ADT^A03^ADT_A01</seq>
<msh>
<evn>
<seq n="1">A03</seq>
<seq n="2">@dateTime</seq>
<seq n="6">@dateTime</seq>
</evn>
<pid/>
</a03>
Message and segment names are converted to upper case when they are inserted into the HL7 structure. The most common segments are populated by default from the EHRSystem's configuration parameters or from the registration. If any seq elements appear in the segment, they override the prepopulated values. The @dateTime reference generates the current date and time string. The value of a field is trimmed before being inserted into its segment.
8 HTTP Server
The ROOT directory is the base directory of the HTTP server. The server returns files in this directory in response to HTTP GETs. The server supports sub-paths from this directory (for example, http://localhost/xyz/abc.html). The server attempts to assign a proper content type for all files as defined below. It always suppresses caching.
8.1 Path Evaluation
When the HTTP server receives a request, it evaluates the path to identify the servlet which will handle the request. The servlets are:
- ConfigurationServlet (/configuration) - returns a page displaying the contents of the configuration file, providing web access to the same information that is displayed in the Configuration tab of the XDSdemo program.
- DashboardServlet (/dashboard) - returns a page displaying the current operating parameters of the program (currently the number of registrations in the registration database and the contents of the event log).
- RegistrationServlet (/registration) - provides access to the registration system. On an HTTP GET, this displays the contents of the /registration/index.html page. On an HTTP POST, it triggers the processing of the registration using the parameters provided in the posted form. This is the main function of the entire system.
- PDQServlet (/pdq) - provides access to the demographic query system. On an HTTP GET, this displays the contents of the /pdq/index.html page. On an HTTP POST, it searches the registration database for registrations that match the parameters provided in the posted form and returns a page showing their elements.
- MessagesServlet (/messages) - provides access to collections of HL7 messages that have been captured using the program's Special tab.
- Servlet - returns the file identified by the path. If the path is a directory, it attempts to return the index.html file in that directory. This is the servlet that is run by default when the path does not correspond to any other servlet.
8.2 Content Types
The HTTP Server's default servlet returns files with content types that correspond to their file extensions. It knows only the following extensions:
Extension | Content-Type |
html | text/html;charset=UTF-8 |
htm | text/html;charset=UTF-8 |
xml | text/xml;charset=UTF-8 |
txt | text/plain;charset=UTF-8 |
gif | image/gif |
jpeg | image/jpeg |
jpg | image/jpeg |
zip | application/zip |
8.3 Index files
When the program starts, it initializes each servlet by calling its static init method. This method looks in the base directory of the servlet for its index.html file. If the file is not present and there does exist an example-index.html file in the same directory, then it copies that file into the index.html file. Since the index.html files are not included in the software release, this allows the administrator of the demonstration to change those files (to include, for instance, demonstration logos and better graphics) without losing their contents during an upgrade.
9 Batch Registration Processing
The Batch Registration tab allows processing lists of registrations formatted either as an XML file using the schema of the registrations.xml file (the registratioin database) or as a CSV file. For CVS files, the column names of each of the fields must be specified in the columns.properties file. The defaultCountry property must also be included in the columns.properties file. An example file is included in the release. This file is overwritten on an upgrade, so it is important to backup the file before an upgrade.
When registrations are processed, many subordinate threads are launched. To prevent the system from being flooded with threads, an interval field is provided in the header of the Batch Registration page. The default is 10 seconds. This field can be adjusted to see if shorter intervals will work.
10 Source Software Overview
Almost all the classes are in the org.rsna.xds package. The exceptions are classes provided by external libraries.
The following notes are intended to provide basic guidance to the key classes for programmers wishing to modify the code.
- XDSDemo
- The main class of the program. This class loads the configuration, initializes the UI, initializes the servlets, and instantiates and starts the HTTP Server.
- Configuration
- This class contains all the configuration information, including the config.xml file, the registration database, and the event log object. An instance of this class is passed to the constructors of key objects in the system.
- XDSEventLog
- This class keeps a circular buffer of the last 'n' XDSEvent objects generated and appended by other objects (typically servlets) during operation of the program.
- HttpServer
- This class is a Thread that creates a ServerSocket, waits for connections on it, and instantiate an HttpHandler objects to service the connections.
- HttpHandler
- This class is a Thread that services an individual connection. It instantiates HttpRequest and HttpResponse objects for the connection and calls the static Servlet.getInstance(HttpRequest) method to obtain an instance of the Servlet to handle the request. It then calls the servlet's doGet or doPost method, depending on the request type.
- HttpRequest
- This class encapsulates a request. It provides access to the path, the content type, and the parameters (obtained either from the query string on a GET or the form parameters on a POST).
- HttpResponse
- This class encapsulates a response. It allows a servlet to send both text and files to the client in the connection's output stream. Files are written without having to be loaded completely into memory in order to minimize the footprint when returning large images. This class provides the mapping of file extensions to Content-Types in the setContentType(File) and setContentType(String) methods. To extend the known content types, add to the static ContentTypes class which is contained within the HttpResponse class.
- Servlet
- This is the base class for all servlets. It includes the static getInstance(HttpRequest) method which returns the appropriate subclass to service the request. The Servlet class also includes the default file server for handling GET requests that correspond to files. Thus, the getInstance method returns an instance of the Servlet class when it cannot find a subclass that corresponds to the requested path. To add new servlets to the system, create a new subclass of this class and update the getInstance method to return an instance of it in reponse to the base path that defines it. The base path for any servlet is defined by the first path element (eg "registration" for the RegistrationServlet). Each servlet handles all requests whose first path element matches its base path. The base path is defined in a servlet's static servletPath field.
- ConfigurationServlet
- This class is the Servlet subclass that returns a page containing the contents of the config.xml file in tabular form.
- DashboardServlet
- This class is the Servlet subclass that returns a page displaying the current status of the system.
- RegistrationServlet
- This class is the Servlet subclass that handles registrations. On a GET, it returns the index.html file from its base directory (/registration/index.html). On a POST, it returns a page displaying the request and then processes it. To process a request, it starts separate processing threads for all systems. Each system processes the request in accordance with its configuration.
- PDQServlet
- This class is the Servlet subclass that handles patient demographic queries. On a GET, it returns the index.html file from its base directory (/pdq/index.html). On a POST, it returns a page displaying the result of the registration database search.
- MessagesServlet
- This class is the Servlet subclass that provides access to collections of HL7 messages that have been captured using the program's Special tab. If called with no path, it returns a page containing a list of zip files in the base directory of the servlet. If called with a path to a file, it returns the file.
- RegistrationDatabase
- This class stores Registration objects in a Hashtable and allows the table to be updated and searched. It also provides persistence by saving the contents of the table as an XML file.
- Registration
- This class encapsulates a single registration, including the patient demographics, global ID, and the local IDs corresponding to each EHR system and DICOM system.
- XDSElement
- This class is the base class for all systems and datasets in the demo.
- XDSSystem
- This class is the XDSElement subclass for all systems in the demo.
- DataSystem
- This class is the XDSSystem subclass that represents systems that accept HL7 messages (PIXMgr, PDQMgr, and EHRSystem).
- PIXMgr
- This class is the DataSystem subclass that represents a PIX Manager.
- PDQMgr
- This class is the DataSystem subclass that represents a PDQ Manager.
- Registry
- This class is the PIXMgr subclass that represents a Registry. It behaves exactly as a PIXMgr but has a different name to avoid confusion.
- Repository
- This class is the XDSSystem subclass that represents a Repository.
- EHRSystem
- This class is the DataSystem subclass that represents an EHR System.
- DCMSystem
- This class is the EHRSystem subclass that represents a DICOM System.
- HL7Message
- This class encapsulates a simple HL7 message, providing management of its segments. It also provides methods to save the message to a file and transmit the message to an HL7 system.
- HL7Segment
- This class encapsulates an HL7 message segment, providing methods for getting and setting fields.
- HL7A04
- This class is an abstract class to encapsulate an HL7 A04 message. It instantiates the required segments in the proper order and provides methods for populating the required fields.
- HL7ITI8
- This class extends HL7A04 to create an ITI8 transaction.
- HL7RAD1
- This class extends HL7A04 to create a RAD1 transaction.
- HL7RAD4
- This class implements the RAD4 transaction.
- HL7Field
- This class encapsulates a field in an HL7 message. It is used only to store the contents of hl7 elements in the config.xml file, as shown in the ehrsystem and dcmsystem examples in the config.xml section, above. These fields allow messages to be configured individually for each system when necessary.
- KOS
- This class encapsulates a DICOM Key Object Selection object. It is created during the processing of a study for a DicomSystem and transmitted (when enabled by the configuration of the DicomSystem) to the Repository.
- XDSSoapRequest
- This class provides transport for a metadata file and its associated XML object. This is used by the Repository class to send a CDA to a repository.
- Study
- This class is the XDSElement subclass that encapsulates a DICOM study. It points to the DicomSystem to which it will be sent.
- DocSet
- This class is the XDSElement subclass that encapsulates a collection of documents. It points to the Repository to which it will be sent.
- SimpleInstaller
- This class is the base class for the program's installer.
- Installer
- This class is the SimpleInstaller subclass that provides the parameters required for installation of XDSdemo.