Schema-Based Queries

Any number of schema-based queries may be added by using the Add Query interaction on a namespace node in the metadata tree of the adapter.

You must supply two XSD files: one describing the subscripts of the global (its key) and one describing the fields that comprise the value of the global. The service assumes that MUMPS global values are delimited strings so the value of the delimiter character must also be specified.

Each of the schema files should define a single complex type the elements of which define the subscripts or the fields in the delimited string. The date and time schema types may be used. The adapter will convert the MUMPS values into XSD dates and times and vice versa.

The following is a sample schema file for the three subscripted SP globals:

<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 targetNamespace="http://schemas.ibi.com/iwmumps/sample"
 xmlns:tns="http://schemas.ibi.com/iwmumps/sp"
 elementFormDefault="qualified">
  <xs:element name="SP">
    <xs:complexType>
     <xs:sequence>
         <xs:element name="ID" type="xs:string"/>
         <xs:element name="DT" type="xs:date"/>
         <xs:element name="TM" type="xs:time"/>
     </xs:sequence>
    </xs:complexType>
  </xs:element>  
</xs:schema>

The schema for the values of these globals is shown in the following example:

<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 targetNamespace="http://schemas.ibi.com/iwmumps/sample"
 xmlns:tns="http://schemas.ibi.com/iwmumps/sp"
 elementFormDefault="qualified">
  <xs:element name="ApptHeader">
    <xs:complexType>
      <xs:sequence>
   		<xs:element name="INTERNAL_STAT" type="xs:string" minOccurs="0" maxOccurs="1"/>
  <xs:element name="TEST_PROV" type="xs:string" minOccurs="0" maxOccurs="1"/>
  <xs:element name="VT" type="xs:string" minOccurs="0" maxOccurs="1"/>
  <xs:element name="INTERNAL_SLOT" type="xs:string" minOccurs="0" maxOccurs="1"/>
  <!--  ... and so forth ... -->
  <xs:element name="NO_SHOW_INI" type="xs:string" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Once the service is created, it appears at the bottom of the namespace metadata tree, as shown in the following image.

A sample request document for the service is provided below. Subscript conditions are specified using the same format as the SimpleQuery service.

<tns:SpHeaderQuery 
  location="mumps/EBSCHED/SpHeaderQuery"   
  xmlns:tns="http://schemas.ibi.com/iwmumps/services"> 
    <tns:ID>
  <tns:conditions>
   <tns:eq>57501</tns:eq>
  </tns:conditions>
 </tns:ID>
 <tns:DT />
 <tns:TM>
  <tns:conditions>
   <tns:eq>15:30:00</tns:eq>
  </tns:conditions>
 </tns:TM>
</tns:SpHeaderQuery>

This request returns all appointments for patient number 57501, which were scheduled for 3:30 PM on any date. The following is an example of the response document that is returned:

<SpHeaderQuery xmlns="http://schemas.ibi.com/iwmumps/services">
   <Global>
      <SP>
         <ID>57501</ID>
         <DT>2008-10-14</DT>
         <TM>15:30:00</TM>
      </SP>
      <ApptHeader>
         <INTERNAL_STAT>C</INTERNAL_STAT>
         <TEST_PROV>347</TEST_PROV>
         <VT>6</VT>
         <INTERNAL_SLOT>1186OV3000*1186 </INTERNAL_SLOT>
         <NO_DOCUMENTATION0>6</NO_DOCUMENTATION0>
         <SCHED_INI_SLASH_TERM_NUM>SCHROELL</SCHED_INI_SLASH_TERM_NUM>
         <CAN_OR_BMP_INI_AND_TERM>TANJIJR</CAN_OR_BMP_INI_AND_TERM>
         <CAN_DT>2008-10-13</CAN_DT>
         <DEPT>88</DEPT>
         <NO_DOCUMENTATION1>61278,61076</NO_DOCUMENTATION1>
         <LOC_SHORT_NM>34</LOC_SHORT_NM>
         <CAN_REASONS>7</CAN_REASONS>
         <NO_DOCUMENTATION7>61282,39201</NO_DOCUMENTATION7>
         <RESCHEDULED_APPT_DT>2008-10-14</RESCHEDULED_APPT_DT>
         <RESCHEDULED_APPT_TM>11:30:00</RESCHEDULED_APPT_TM>
         <SEQ>6379</SEQ>
         <RESCHED_FROM_DT>2008-10-20</RESCHED_FROM_DT>
         <RESCHED_FROM_TIME>11:30:00</RESCHED_FROM_TIME>
         <ORGANIZATION>7</ORGANIZATION>
      </ApptHeader>
   </Global>
   <Global>
      <SP>
         <ID>57501</ID>
         <DT>2009-07-17</DT>
         <TM>15:30:00</TM>
      </SP>
     
<ApptHeader>
         <INTERNAL_STAT>C</INTERNAL_STAT>
         <TEST_PROV>347</TEST_PROV>
         <VT>6</VT>
         <INTERNAL_SLOT>1186OV3000*1186 </INTERNAL_SLOT>
         <NO_DOCUMENTATION0>6</NO_DOCUMENTATION0>
         <SCHED_INI_SLASH_TERM_NUM>MCKENZWR</SCHED_INI_SLASH_TERM_NUM>
         <CAN_OR_BMP_COMM>r/s</CAN_OR_BMP_COMM>
         <CAN_OR_BMP_INI_AND_TERM>MCKENZWR</CAN_OR_BMP_INI_AND_TERM>
         <CAN_DT>2009-07-15</CAN_DT>
         <DEPT>88</DEPT>
         <NO_DOCUMENTATION1>61556,50616</NO_DOCUMENTATION1>
         <LOC_SHORT_NM>34</LOC_SHORT_NM>
         <CAN_REASONS>7</CAN_REASONS>
         <NO_DOCUMENTATION7>61557,55720</NO_DOCUMENTATION7>
         <RESCHEDULED_APPT_DT>2009-08-03</RESCHEDULED_APPT_DT>
         <RESCHEDULED_APPT_TM>12:00:00</RESCHEDULED_APPT_TM>
         <SEQ>5595</SEQ>
         <ORGANIZATION>7</ORGANIZATION>
      </ApptHeader>
   </Global>
</SpHeaderQuery>