Use XML databases to empower Java Web services

Integrate a native XML operational data store into your enterprise application

1 2 Page 2
Page 2 of 2
  • Patient Details: Primarily patient information such as name, address, and birthday
  • Patient Medical History: A list of all known illnesses or patient encounters, with the ability to pull up details on each illness (and order new lab work) including:

    • Doctor reports and notes
    • X-ray and other types of imaging
    • Medications
  • Patient Medication: A list of all known medications this patient has been prescribed over time, with the ability to prescribe new medication if needed
  • Patient Allergies: A list of all known patient allergies, with the ability to make a new entry
  • Medical Report: A list of available doctor observations and visit reports, with the ability to create a new report following a given visit

To provide a single view of a patient, the system must communicate and exchange information with the following hospital systems: reporting and decision support, patient care management, imaging, ambulatory, laboratory, health information management, pharmacy, and possibly the FDA and CDC depending on the patient's diagnosis.

A doctor may be using a PDA or some other wireless device during a patient visit or hospital round to obtain similar information. In this case, the system must be able to detect the device type and provide it with a response/content applicable to that device. This would require content transformation, such as: XML to HTML, SVG (scalable vector graphics), CSV (comma-separated values), or other.

To aggregate and present the above content (using a typical Java API for XML-based Remote Procedure Call (JAX-RPC) interface), the client application must make at least 10 to 25 Web service calls. In addition, more code is required for converting returned content to presentation and to make updates if needed. The following example returns just the patient's name, contact, and other primary information:

 Service service = ServiceFactory.newInstance().createService(null);
Call    call    = service.createCall();
call.setTargetEndpointAddress(opts.getURL());
call.setOperationName(new QName("urn:cominfo", "getPatientInfo"));
call.addParameter("sessionID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("chartNum", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
if(opts.getUser()!=null)
   call.setProperty(Call.SESSION_PROPERTY, opts.getSession());
if(opts.getPassword()!=null)
   call.setProperty(Call.CHARTNUM_PROPERTY, opts.getChartNum());
String res = (String) call.invoke(new Object[] {args[0], args[1]});

Multiples calls are required and results may need to be aggregated into a single XML message, then parsed or transformed as needed.

Billing

A financial services user, either via a browser or a desktop application, must obtain a list of all rendered services to a given patient for a certain period of time. This, once again, requires access to most available systems of record within the hospital infrastructure and another 10 to 15 separate Web service calls.

Using returned/aggregated information, a financial services user selects which services require billing at this time. Once selected, the system needs to prepare an invoice and electronically submit it to the appropriate insurance provider using the ACORD standard over a Web service provided by that insurance carrier. This requires code to convert performed services content to the ACORD-based XML standard, then another Web service call to send the invoice.

With an NXD in place, a single XQuery statement referencing all WSDL-based sources can aggregate the content and transform it into an ACORD-compliant XML document using either a referenced XSLT (transformation) or XQuery alone.

Ambulatory services

Ambulatory services personnel receive an emergency call about a patient having a possible heart attack. Armed with a wireless device, they arrive at a patient's residence and perform required tests to diagnose the problem. They conclude that patient must be admitted to the hospital as soon as possible and requires an immediate injection of penicillin.

Using a wireless device, the ambulatory services personnel log in to the hospital's portal and request information on the patient's history of illnesses, allergies, and past and current medications to determine if there are any issues with the medication about to be administered. This information must be accurate and immediately available.

With an NXD in place, once again, a single XQuery statement is sent. The server evaluates cache settings of every source involved and aggregates required content from both the locally persisted cache as well as the originating content provider. Results are transformed for the client device requesting the content and sent back.

Emergency services

A patient arrives in a hospital's emergency department with acute respiratory difficulty. The attending doctor suspects botulism. This physician usually calls a toll-free number to get a duty officer. Instead, she sends an HL7 standards-based CDA document (describing a botulism case report) to the Department of Public Health (via a Web service). It is sent directly to the duty officer. When it is received by the botulism system, the duty officer reviews it, and a message is sent to the quarantine station (regional CDC) to release the antitoxins to the appropriate hospital pharmacy.

The hospital's laboratory receives a request for a test to confirm the botulism. It sends notification to the local health authority that such a test is requested. A sample is drawn at the hospital and shipped to the state lab for testing. Usually, the antitoxins are released based on the reporting systems and any other supporting tests performed (EMG, neurological studies).

The CDA botulism case report is sent to the Department of Public Health with initial ED (emergency department) findings. When the lab results for the test confirm the case, the toxin assay results are sent to the Department of Public Health, which uses that data plus the CDA to create the Nationally Notifiable Diseases (NNDSS) message to be sent to the CDC.

Using an NXD, all messages to the CDC and FDA are created by the server using a predefined transformation or a server-stored XQuery. An XQuery may also contain appropriate logic for routing messages based on the events, type of data, etc.

RPC vs. XQuery

A typical RPC call may resemble the following:

 Service service = ServiceFactory.newInstance().createService(null);
Call    call    = service.createCall();
call.setTargetEndpointAddress(opts.getURL());
call.setOperationName(new QName("urn:cominfo", "getPatientInfo"));
call.addParameter("sessionID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("chartNum", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
if(opts.getUser()!=null)
   call.setProperty(Call.SESSION_PROPERTY, opts.getSession());
if(opts.getPassword()!=null)
   call.setProperty(Call.CHARTNUM_PROPERTY, opts.getChartNum());
String res = (String) call.invoke(new Object[] {args[0], args[1]});

The code above shows only the actual call and response code. Using this approach, pages and pages of code must be written to properly aggregate and transform the content.

Using XQuery, however, the code, which could tap all available example sources, is reduced to:

 <root> {
import service namespace PatientReg = 'PatientReg.wsdl' name PR;
import service namespace Reporting = 'Reporting.wsdl' name REP;
import service namespace Pharmacy = 'Pharmacy.wsdl' name RX;
import service namespace HealthInfoMngmnt = 'HIM.wsdl' name HIM;
import service namespace Laboratory = 'Lab.wsdl' name LAB;
import service namespace ITforPhys = 'ITforPhys.wsdl' name ITP;
import service namespace Ambulatory = 'Ambulatory.wsdl' name AMB;
import service namespace ITMngmnt = 'ITMngmnt.wsdl' name ITM;
import service namespace GeneralFinance = 'GeneralFinance.wsdl' name GF;
import service namespace Imaging = 'Imaging.wsdl' name IMG;
import service namespace PatientCareMngmnt = 'PatientCareMngmnt.wsdl' name PCM;
for $PCM in collection(PCM:GetPatientDetail(UserID, chartNum)),
$RX in collection(RX:GetPatientMeds(UserID, chartNum)),
$HIM in collection(HIM:GetPatientProcedures(UserID, chartNum)),
$LAB in collection(LAB:GetPatientLabWork(UserID, chartNum)),
$AMB in collection(AMB:GetPatientAmbServices(UserID, chartNum)),
$IMG in collection(IMG:GetPatientXrays(UserID, chartNum))
return
<PatientCareMngmnt> { $PCM } </PatientCareMngmnt>
<Pharmacy> { $RX } </Pharmacy>
<HealthInfoMngmnt> { $HIM } </HealthInfoMngmnt>
<Laboratory> { $LAB } </Laboratory>
<Ambulatory> { $AMB } </Ambulatory>
<Imaging> { $IMG } </Imaging>
} </root> 

To reference a transformation, either an XSL transformation can be used or XQuery alone. An example of an XSLT reference in XQuery is as follows:

 declare outbound-transformation 'tig:///HL7DEMO/XSLT/sectional.xsl';
<root> { 
for $b in collection('tig:///HL7/CDAR2')
let $documenturi := document-uri( $b )
 where $b/levelone[contains(clinical_document_header/patient/person/person_name/nm/GIV/@V,'a') and 
 contains(clinical_document_header/patient/person/person_name/nm/FAM/@V,'a')]
order by $b/levelone/clinical_document_header/patient/person/person_name/nm/GIV/@V 
   return  
      for $cd in $b/levelone/clinical_document_header
         return  
            <clinical_document_header> 
           {  
               $cd/*:*,  
                  attribute docNameRef { $documenturi }, 
               $cd/*:* 
           } 
           </clinical_document_header>
 } </root>

Using XQuery is simple and powerful. The above examples are just the tip of the iceberg as far as XQuery's capabilities are concerned.

Conclusion

Web services are not without their limitations as a technology. Combining Web services with native XML databases and XQuery can extend the power of Web services inter- and intra-enterprise. The result is a powerful computing platform for the enterprise, enabling integration of applications, processes, and data in an efficient, standards-based, and low-cost manner.

Robert Smik is a senior systems architect at Raining Data Corporation. He has been involved in application and software design and development for more than 15 years. His experience includes design and development of highly complex database systems, architecting multitier Web environments, architecting and developing various connectivity solutions, products, and smart cards, in addition to SOA and data aggregation tools. Smik is an active member of HL7 and CDISC. Ash Parikh is the director of technology and development of the Enterprise Applications Group at Raining Data Corporation. He is a named expert in the field of distributed computing and has presented and authored abstracts for Delphi BPX Summit 2004, Delphi Enterprise On-Demand 2004, JavaOne 2004, JavaOne 2003, BEA e-World 2002, and JavaOne 2002. Parikh has more than 15 years of IT experience and is an active member on a number of JSRs in the Java Community Process and in the Technical Committees of OASIS. He is also the president of the Bay Area Chapter of the Worldwide Institute of Software Architects. Parikh is the collaborating author of Oracle9iAS Building J2EE Applications (Osborne Press, November 2002), and has also authored several technical articles in journals such as XML-Journal, Java Pro, Web Services Journal, ADTmag, Softwaremag.com, and Java Skyline. Ajay Ramachandran is vice president and general manager of Raining Data's Enterprise Applications Group. His expertise includes management consulting, information technology, biotechnology, product management, sales, and marketing. His career includes cofounding and executive-level positions at several Internet services and software companies. Ramachandran has degrees in molecular cellular biology (genetic engineering) and organizational communications.

Learn more about this topic

Related:
1 2 Page 2
Page 2 of 2